diff --git a/client/src/main/com/sinch/sdk/SinchClient.java b/client/src/main/com/sinch/sdk/SinchClient.java index a33ef6b42..752fcceb8 100644 --- a/client/src/main/com/sinch/sdk/SinchClient.java +++ b/client/src/main/com/sinch/sdk/SinchClient.java @@ -16,6 +16,7 @@ import com.sinch.sdk.models.VerificationContext; import com.sinch.sdk.models.VoiceContext; import com.sinch.sdk.models.VoiceRegion; +import com.sinch.sdk.models.adapters.DualToneMultiFrequencyMapper; import java.io.IOException; import java.io.InputStream; import java.util.Collection; @@ -410,4 +411,24 @@ private String formatAuxiliaryFlag() { } return String.join(",", values); } + + static { + LocalLazyInit.init(); + } + + static final class LocalLazyInit { + + private LocalLazyInit() { + DualToneMultiFrequencyMapper.initMapper(); + } + + public static LocalLazyInit init() { + return LocalLazyInit.LazyHolder.INSTANCE; + } + + private static class LazyHolder { + + public static final LocalLazyInit INSTANCE = new LocalLazyInit(); + } + } } diff --git a/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java b/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java index 613b0b83e..a36344ea7 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/ApplicationsService.java @@ -6,7 +6,11 @@ import com.sinch.sdk.domains.voice.models.response.AssignedNumbers; import com.sinch.sdk.models.E164PhoneNumber; -/** You can use the API to manage features of applications in your project. */ +/** + * You can use the API to manage features of applications in your project. + * + * @since 1.0 + */ public interface ApplicationsService { /** 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 fd69b3109..e9447cb7b 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/VoiceService.java @@ -9,6 +9,15 @@ */ public interface VoiceService { + /** + * Voice Service V1 + * + * @return V1 service instance for project + * @see Documentation + * @since 1.1 + */ + com.sinch.sdk.domains.voice.api.v1.VoiceService v1(); + /** * Callouts Service instance * 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 index cd1fb432b..5ad7b1189 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java @@ -1,63 +1,41 @@ package com.sinch.sdk.domains.voice.adapters; -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.domains.voice.adapters.api.v1.ApplicationsApi; 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; -import com.sinch.sdk.models.VoiceContext; -import java.util.Map; public class ApplicationsService implements com.sinch.sdk.domains.voice.ApplicationsService { - private final ApplicationsApi api; + private final com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1; - public ApplicationsService( - VoiceContext context, HttpClient httpClient, Map authManagers) { - this.api = - new ApplicationsApi( - httpClient, - context.getVoiceApplicationManagementServer(), - authManagers, - new HttpMapper()); - } - - protected ApplicationsApi getApi() { - return this.api; + public ApplicationsService(com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1) { + this.v1 = v1; } public AssignedNumbers listNumbers() { - - return ApplicationsDtoConverter.convert(getApi().configurationGetNumbers()); + return ApplicationsDtoConverter.convert(v1.listNumbers()); } public CallbackUrls getCallbackUrls(String applicationKey) { - - return ApplicationsDtoConverter.convert(getApi().configurationGetCallbackURLs(applicationKey)); + return ApplicationsDtoConverter.convert(v1.getCallbackUrls(applicationKey)); } public void updateCallbackUrls(String applicationKey, CallbackUrls parameters) { - getApi() - .configurationUpdateCallbackURLs( - applicationKey, ApplicationsDtoConverter.convert(parameters)); + v1.updateCallbackUrls(applicationKey, ApplicationsDtoConverter.convert(parameters)); } public NumberInformation queryNumber(E164PhoneNumber number) { - return ApplicationsDtoConverter.convert(getApi().callingQueryNumber(number.stringValue())); + return ApplicationsDtoConverter.convert(v1.queryNumber(number.stringValue())); } public void assignNumbers(ApplicationsAssignNumbersRequestParameters parameters) { - getApi().configurationUpdateNumbers(ApplicationsDtoConverter.convert(parameters)); + v1.assignNumbers(ApplicationsDtoConverter.convert(parameters)); } public void unassignNumber(E164PhoneNumber phoneNumber, String applicationKey) { - - getApi() - .configurationUnassignNumber(ApplicationsDtoConverter.convert(phoneNumber, 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 index 85948d068..d8c844801 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java @@ -1,49 +1,39 @@ package com.sinch.sdk.domains.voice.adapters; -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.domains.voice.adapters.api.v1.CalloutsApi; 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.models.VoiceContext; -import java.util.Map; +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 CalloutsApi api; + private final com.sinch.sdk.domains.voice.api.v1.CalloutsService v1; - public CalloutsService( - VoiceContext context, HttpClient httpClient, Map authManagers) { - this.api = - new CalloutsApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); - } - - protected CalloutsApi getApi() { - return this.api; + public CalloutsService(com.sinch.sdk.domains.voice.api.v1.CalloutsService v1) { + this.v1 = v1; } public String textToSpeech(CalloutRequestParametersTTS parameters) { - return call(parameters); + return v1.textToSpeech((CalloutRequestTTS) CalloutsDtoConverter.convert(parameters)); } public String conference(CalloutRequestParametersConference parameters) { - return call(parameters); + return v1.conference((CalloutRequestConference) CalloutsDtoConverter.convert(parameters)); } public String custom(CalloutRequestParametersCustom parameters) { - return call(parameters); + return v1.custom((CalloutRequestCustom) CalloutsDtoConverter.convert(parameters)); } public String call(CalloutRequestParameters parameters) { - return CalloutsDtoConverter.convert( - getApi().callouts(CalloutsDtoConverter.convert(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 index 8806c1c58..7742f210b 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java @@ -1,41 +1,30 @@ package com.sinch.sdk.domains.voice.adapters; -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.domains.voice.adapters.api.v1.CallsApi; 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.models.VoiceContext; -import java.util.Map; +import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; public class CallsService implements com.sinch.sdk.domains.voice.CallsService { - private final CallsApi api; + private final com.sinch.sdk.domains.voice.api.v1.CallsService v1; - public CallsService( - VoiceContext context, HttpClient httpClient, Map authManagers) { - this.api = new CallsApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); - } - - protected CallsApi getApi() { - return this.api; + public CallsService(com.sinch.sdk.domains.voice.api.v1.CallsService v1) { + this.v1 = v1; } public CallInformation get(String callId) { - - return CallsDtoConverter.convert(getApi().callingGetCallResult(callId)); + return CallsDtoConverter.convert(v1.get(callId)); } public void update(String callId, SVAMLControl parameters) { - getApi().callingUpdateCall(callId, CallsDtoConverter.convert(parameters)); + v1.update(callId, ControlDtoConverter.convertControl(parameters)); } public void manageWithCallLeg(String callId, CallLegType callLeg, SVAMLControl parameters) { - getApi() - .callingManageCallWithCallLeg( - callId, callLeg.value(), CallsDtoConverter.convert(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 index 49e079975..f1801d432 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java @@ -1,53 +1,39 @@ package com.sinch.sdk.domains.voice.adapters; -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.domains.voice.adapters.api.v1.ConferencesApi; 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.models.VoiceContext; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; import java.util.Collection; -import java.util.Map; public class ConferencesService implements com.sinch.sdk.domains.voice.ConferencesService { - private final ConferencesApi api; + private final com.sinch.sdk.domains.voice.api.v1.ConferencesService v1; - public ConferencesService( - VoiceContext context, HttpClient httpClient, Map authManagers) { - this.api = - new ConferencesApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); - } - - protected ConferencesApi getApi() { - return this.api; + public ConferencesService(com.sinch.sdk.domains.voice.api.v1.ConferencesService v1) { + this.v1 = v1; } public String call(CalloutRequestParametersConference parameters) { - return CalloutsDtoConverter.convert( - getApi().callouts(CalloutsDtoConverter.convert(parameters))); + return v1.call((CalloutRequestConference) CalloutsDtoConverter.convert(parameters)); } public Collection get(String conferenceId) { - return ConferencesDtoConverter.convert(getApi().callingGetConferenceInfo(conferenceId)); + return ConferencesDtoConverter.convert(v1.get(conferenceId)); } public void kickAll(String conferenceId) { - getApi().callingKickConferenceAll(conferenceId); + v1.kickAll(conferenceId); } public void kickParticipant(String conferenceId, String callId) { - getApi().callingKickConferenceParticipant(callId, conferenceId); + v1.kickParticipant(conferenceId, callId); } public void manageParticipant( String conferenceId, String callId, ConferenceManageParticipantRequestParameters parameters) { - getApi() - .callingManageConferenceParticipant( - callId, conferenceId, ConferencesDtoConverter.convert(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 045df5908..d5debcde5 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 @@ -36,6 +36,8 @@ public class VoiceService implements com.sinch.sdk.domains.voice.VoiceService { private Map clientAuthManagers; private Map webhooksAuthManagers; + private final com.sinch.sdk.domains.voice.api.v1.VoiceService v1; + public VoiceService( ApplicationCredentials credentials, VoiceContext context, HttpClient httpClient) { @@ -52,6 +54,10 @@ public VoiceService( this.context = context; this.httpClient = httpClient; setApplicationCredentials(credentials); + + this.v1 = + new com.sinch.sdk.domains.voice.api.v1.adapters.VoiceService( + credentials, context, httpClient); } private void setApplicationCredentials(ApplicationCredentials credentials) { @@ -75,9 +81,7 @@ private void setApplicationCredentials(ApplicationCredentials credentials) { public CalloutsService callouts() { if (null == this.callouts) { checkCredentials(); - this.callouts = - new com.sinch.sdk.domains.voice.adapters.CalloutsService( - context, httpClient, clientAuthManagers); + this.callouts = new com.sinch.sdk.domains.voice.adapters.CalloutsService(v1().callouts()); } return this.callouts; } @@ -86,8 +90,7 @@ public ConferencesService conferences() { if (null == this.conferences) { checkCredentials(); this.conferences = - new com.sinch.sdk.domains.voice.adapters.ConferencesService( - context, httpClient, clientAuthManagers); + new com.sinch.sdk.domains.voice.adapters.ConferencesService(v1.conferences()); } return this.conferences; } @@ -95,9 +98,7 @@ public ConferencesService conferences() { public CallsService calls() { if (null == this.calls) { checkCredentials(); - this.calls = - new com.sinch.sdk.domains.voice.adapters.CallsService( - context, httpClient, clientAuthManagers); + this.calls = new com.sinch.sdk.domains.voice.adapters.CallsService(v1.calls()); } return this.calls; } @@ -106,8 +107,7 @@ public ApplicationsService applications() { if (null == this.applications) { checkCredentials(); this.applications = - new com.sinch.sdk.domains.voice.adapters.ApplicationsService( - context, httpClient, clientAuthManagers); + new com.sinch.sdk.domains.voice.adapters.ApplicationsService(v1.applications()); } return this.applications; } @@ -115,12 +115,15 @@ public ApplicationsService applications() { public WebHooksService webhooks() { checkCredentials(); if (null == this.webhooks) { - this.webhooks = - new com.sinch.sdk.domains.voice.adapters.WebHooksService(webhooksAuthManagers); + 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; + } + private void checkCredentials() throws ApiAuthException { if (null == clientAuthManagers || clientAuthManagers.isEmpty()) { throw new ApiAuthException( 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 index bcdb9d5d5..aee3781e3 100644 --- a/client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java +++ b/client/src/main/com/sinch/sdk/domains/voice/adapters/WebHooksService.java @@ -1,71 +1,33 @@ package com.sinch.sdk.domains.voice.adapters; -import com.fasterxml.jackson.core.JsonProcessingException; import com.sinch.sdk.core.exceptions.ApiMappingException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.utils.MapUtils; -import com.sinch.sdk.core.utils.databind.Mapper; -import com.sinch.sdk.domains.voice.adapters.converters.CallsDtoConverter; +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.dto.v1.SVAMLRequestBodyDto; -import com.sinch.sdk.domains.voice.models.dto.v1.WebhooksEventDto; import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; import com.sinch.sdk.domains.voice.models.webhooks.WebhooksEvent; import java.util.Map; -import java.util.logging.Logger; public class WebHooksService implements com.sinch.sdk.domains.voice.WebHooksService { - private static final Logger LOGGER = Logger.getLogger(WebHooksService.class.getName()); - private final Map authManagers; + private final com.sinch.sdk.domains.voice.api.v1.WebHooksService v1; - public WebHooksService(Map authManagers) { - this.authManagers = authManagers; + 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) { - // convert header keys to use case-insensitive map keys - Map caseInsensitiveHeaders = MapUtils.getCaseInsensitiveMap(headers); - - String authorizationHeader = caseInsensitiveHeaders.get("Authorization"); - - // no authorization required - if (null == authorizationHeader) { - return true; - } - - String[] split = authorizationHeader.split(" "); - String authorizationKeyword = split.length > 0 ? split[0] : ""; - - AuthManager authManager = authManagers.get(authorizationKeyword); - if (null == authManager) { - // unknown auth manager - LOGGER.severe( - String.format("Auth manager for authorization '%s' not found", authorizationKeyword)); - return false; - } - return authManager.validateAuthenticatedRequest(method, path, headers, jsonPayload); + return v1.validateAuthenticationHeader(method, path, headers, jsonPayload); } @Override public WebhooksEvent unserializeWebhooksEvent(String jsonPayload) throws ApiMappingException { - try { - WebhooksEventDto o = Mapper.getInstance().readValue(jsonPayload, WebhooksEventDto.class); - return WebhooksEventDtoConverter.convert(o); - } catch (JsonProcessingException e) { - throw new ApiMappingException(jsonPayload, e); - } + return WebhooksEventDtoConverter.convert(v1.parseEvent(jsonPayload)); } @Override public String serializeWebhooksResponse(SVAMLControl response) throws ApiMappingException { - SVAMLRequestBodyDto dto = CallsDtoConverter.convert(response); - try { - return Mapper.getInstance().writeValueAsString(dto); - } catch (JsonProcessingException e) { - throw new ApiMappingException(response.toString(), e); - } + 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 index 65c785f68..ff6708b3f 100644 --- 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 @@ -5,27 +5,28 @@ 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.dto.v1.CallbacksDto; -import com.sinch.sdk.domains.voice.models.dto.v1.CallbacksUrlDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetNumbersResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetNumbersResponseObjNumbersInnerDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetQueryNumberDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetQueryNumberNumberDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UnassignNumbersDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UpdateNumbersDto; 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(GetNumbersResponseObjDto dto) { + public static AssignedNumbers convert(OwnedNumbersResponse dto) { if (null == dto) { return null; } - List list = dto.getNumbers(); + List list = dto.getNumbers(); if (null == list) { return null; } @@ -35,7 +36,7 @@ public static AssignedNumbers convert(GetNumbersResponseObjDto dto) { .build(); } - public static CallbackUrls convert(CallbacksDto dto) { + public static CallbackUrls convert(Callbacks dto) { if (null == dto) { return null; } @@ -43,24 +44,30 @@ public static CallbackUrls convert(CallbacksDto dto) { return CallbackUrls.builder().setUrl(convert(dto.getUrl())).build(); } - public static CallbacksDto convert(CallbackUrls client) { + public static Callbacks convert(CallbackUrls client) { if (null == client || null == client.getUrl()) { return null; } - CallbacksDto dto = new CallbacksDto(); - dto.url( - new CallbacksUrlDto() - .primary(client.getUrl().getPrimary()) - .fallback(client.getUrl().getFallback())); - return dto; + return Callbacks.builder() + .setUrl( + CallbacksUrl.builder() + .setPrimary(client.getUrl().getPrimary()) + .setFallback(client.getUrl().getFallback()) + .build()) + .build(); } - public static NumberInformation convert(GetQueryNumberDto dto) { - if (null == dto || !dto.getNumberDefined()) { + public static NumberInformation convert(QueryNumberResponse dto) { + if (null == dto) { return null; } - GetQueryNumberNumberDto item = dto.getNumber(); - return NumberInformation.builder() + 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())) @@ -69,33 +76,35 @@ public static NumberInformation convert(GetQueryNumberDto dto) { .build(); } - public static UpdateNumbersDto convert(ApplicationsAssignNumbersRequestParameters client) { + public static UpdateNumbersRequest convert(ApplicationsAssignNumbersRequestParameters client) { if (null == client) { return null; } - UpdateNumbersDto dto = new UpdateNumbersDto(); + UpdateNumbersRequest.Builder dto = UpdateNumbersRequest.builder(); client .getNumbers() .ifPresent( f -> - dto.numbers( + dto.setNumbers( f.stream().map(E164PhoneNumber::stringValue).collect(Collectors.toList()))); - client.getApplicationKey().ifPresent(dto::applicationkey); - client.getCapability().ifPresent(f -> dto.capability(EnumDynamicConverter.convert(f))); - return dto; + client.getApplicationKey().ifPresent(dto::setApplicationKey); + client + .getCapability() + .ifPresent(f -> dto.setCapability(Capability.from(EnumDynamicConverter.convert(f)))); + return dto.build(); } - public static UnassignNumbersDto convert(E164PhoneNumber phoneNumber, String applicationKey) { + public static UnAssignNumberRequest convert(E164PhoneNumber phoneNumber, String applicationKey) { - UnassignNumbersDto dto = new UnassignNumbersDto(); + UnAssignNumberRequest.Builder dto = UnAssignNumberRequest.builder(); if (null != phoneNumber) { - dto.number(phoneNumber.stringValue()); + dto.setNumber(phoneNumber.stringValue()); } - dto.applicationkey(applicationKey); - return dto; + dto.setApplicationKey(applicationKey); + return dto.build(); } - private static ApplicationURL convert(CallbacksUrlDto dto) { + private static ApplicationURL convert(CallbacksUrl dto) { if (null == dto) { return null; } @@ -106,14 +115,14 @@ private static ApplicationURL convert(CallbacksUrlDto dto) { .build(); } - private static ApplicationAssignedNumber convert(GetNumbersResponseObjNumbersInnerDto dto) { + private static ApplicationAssignedNumber convert(OwnedNumberInformation dto) { if (null == dto) { return null; } return ApplicationAssignedNumber.builder() .setNumber(E164PhoneNumberDtoConverter.convert(dto.getNumber())) - .setApplicationKey(dto.getApplicationkey()) + .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 index d5d8582c8..8c3af8186 100644 --- 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 @@ -2,22 +2,30 @@ import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; import com.sinch.sdk.domains.voice.models.ConferenceDtfmOptions; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDto.MethodEnum; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferenceCalloutRequestConferenceDtmfOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferenceCalloutRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.CustomCalloutRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DomainDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetCalloutResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.TtsCalloutRequestDto; 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 { - public static CalloutRequestDto convert(CalloutRequestParameters client) { + private static final Logger LOGGER = Logger.getLogger(CalloutsDtoConverter.class.getName()); + + public static CalloutRequest convert(CalloutRequestParameters client) { if (client instanceof CalloutRequestParametersConference) { CalloutRequestParametersConference parameters = (CalloutRequestParametersConference) client; @@ -32,23 +40,33 @@ public static CalloutRequestDto convert(CalloutRequestParameters client) { return null; } - public static String convert(GetCalloutResponseObjDto dto) { + public static String convert(CalloutResponse dto) { if (null == dto) { return null; } return dto.getCallId(); } - private static CalloutRequestDto convert(CalloutRequestParametersConference client) { + private static CalloutRequestConference convert(CalloutRequestParametersConference client) { - ConferenceCalloutRequestDto dto = new ConferenceCalloutRequestDto(); + CalloutRequestConference.Builder dto = CalloutRequestConference.builder(); - client.getDestination().ifPresent(f -> dto.setDestination(DestinationDtoConverter.convert(f))); + 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(f.stringValue())); + client.getDtfm().ifPresent(f -> dto.setDtmf(DualToneMultiFrequency.valueOf(f.stringValue()))); client.getCustom().ifPresent(dto::setCustom); - client.getConferenceId().ifPresent(dto::conferenceId); + client.getConferenceId().ifPresent(dto::setConferenceId); client.getDtfmOptions().ifPresent(f -> dto.setConferenceDtmfOptions(convert(f))); client.getMaxDuration().ifPresent(dto::setMaxDuration); @@ -57,59 +75,75 @@ private static CalloutRequestDto convert(CalloutRequestParametersConference clie client.getEnablePie().ifPresent(dto::setEnablePie); client.getLocale().ifPresent(dto::setLocale); client.getGreeting().ifPresent(dto::setGreeting); - client.getMusicOnHold().ifPresent(f -> dto.setMohClass(EnumDynamicConverter.convert(f))); - client.getDomain().ifPresent(f -> dto.setDomain(EnumDynamicConverter.convert(f))); + client + .getMusicOnHold() + .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); + client.getDomain().ifPresent(f -> dto.setDomain(Domain.from(EnumDynamicConverter.convert(f)))); - return new CalloutRequestDto() - .method(MethodEnum.CONFERENCECALLOUT.getValue()) - .conferenceCallout(dto); + return dto.build(); } - private static CalloutRequestDto convert(CalloutRequestParametersTTS client) { + private static CalloutRequestTTS convert(CalloutRequestParametersTTS client) { - TtsCalloutRequestDto dto = new TtsCalloutRequestDto(); + CalloutRequestTTS.Builder dto = CalloutRequestTTS.builder(); - client.getDestination().ifPresent(f -> dto.setDestination(DestinationDtoConverter.convert(f))); + 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(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(DomainDto.fromValue(EnumDynamicConverter.convert(f)))); + client.getDomain().ifPresent(f -> dto.setDomain(Domain.from(EnumDynamicConverter.convert(f)))); client.getText().ifPresent(dto::setText); client.getPrompts().ifPresent(dto::setPrompts); - - return new CalloutRequestDto().method(MethodEnum.TTSCALLOUT.getValue()).ttsCallout(dto); + return dto.build(); } - private static CalloutRequestDto convert(CalloutRequestParametersCustom client) { + private static CalloutRequestCustom convert(CalloutRequestParametersCustom client) { - CustomCalloutRequestDto dto = new CustomCalloutRequestDto(); + CalloutRequestCustom.Builder dto = CalloutRequestCustom.builder(); - client.getDestination().ifPresent(f -> dto.setDestination(DestinationDtoConverter.convert(f))); + 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(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.convert(f))); - client.getAce().ifPresent(f -> dto.setAce(ControlDtoConverter.convert(f))); - client.getPie().ifPresent(f -> dto.setPie(ControlDtoConverter.convert(f))); - - return new CalloutRequestDto().method(MethodEnum.CUSTOMCALLOUT.getValue()).customCallout(dto); + 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 ConferenceCalloutRequestConferenceDtmfOptionsDto convert( - ConferenceDtfmOptions client) { - ConferenceCalloutRequestConferenceDtmfOptionsDto dto = - new ConferenceCalloutRequestConferenceDtmfOptionsDto(); - client.getMode().ifPresent(f -> dto.setMode(EnumDynamicConverter.convert(f))); + 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; + 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 index bd7643431..1e013b120 100644 --- 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 @@ -3,44 +3,29 @@ 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.dto.v1.GetCallResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SVAMLRequestBodyDto; 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.SVAMLControl; public class CallsDtoConverter { - public static CallInformation convert(GetCallResponseObjDto dto) { + 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()) : null) + .setDomain(null != dto.getDomain() ? DomainType.from(dto.getDomain().value()) : null) .setCallId(dto.getCallId()) .setDuration(dto.getDuration()) - .setStatus(null != dto.getStatus() ? CallStatusType.from(dto.getStatus()) : null) - .setResult(null != dto.getResult() ? CallResultType.from(dto.getResult().getValue()) : null) - .setReason(null != dto.getReason() ? CallReasonType.from(dto.getReason()) : null) - .setTimeStamp(null != dto.getTimestamp() ? dto.getTimestamp().toInstant() : null) + .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(); } - - public static SVAMLRequestBodyDto convert(SVAMLControl client) { - if (null == client) { - return null; - } - SVAMLRequestBodyDto dto = new SVAMLRequestBodyDto(); - - client - .getInstructions() - .ifPresent(f -> dto.instructions(SVAMLInstructionDtoConverter.convert(f))); - client.getAction().ifPresent(f -> dto.action(SVAMLActionDtoConverter.convert(f))); - return dto; - } } 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 index 633f1759b..3b8d265bc 100644 --- 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 @@ -1,13 +1,14 @@ 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(String dto) { + public static CapabilityType convert(Capability dto) { if (null == dto) { return null; } - return CapabilityType.from(dto); + 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 index 65680ba52..775bb4af9 100644 --- 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 @@ -1,43 +1,50 @@ package com.sinch.sdk.domains.voice.adapters.converters; import com.sinch.sdk.domains.common.adapters.converters.EnumDynamicConverter; -import com.sinch.sdk.domains.voice.models.dto.v1.GetConferenceInfoResponseDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetConferenceInfoResponseParticipantsInnerDto; -import com.sinch.sdk.domains.voice.models.dto.v1.ManageConferenceParticipantRequestDto; 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(GetConferenceInfoResponseDto dto) { + public static Collection convert(GetConferenceInfoResponse dto) { if (null == dto) { return null; } - List list = dto.getParticipants(); + List list = + dto.getParticipants(); return list.stream().map(ConferencesDtoConverter::convert).collect(Collectors.toList()); } - private static ConferenceParticipant convert(GetConferenceInfoResponseParticipantsInnerDto dto) { + 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()) + .setOnhold(dto.getOnHold()) .build(); } - public static ManageConferenceParticipantRequestDto convert( + public static ManageConferenceParticipantRequest convert( ConferenceManageParticipantRequestParameters client) { - ManageConferenceParticipantRequestDto dto = new ManageConferenceParticipantRequestDto(); - client.getCommand().ifPresent(f -> dto.command(EnumDynamicConverter.convert(f))); - client.getMusicOnHold().ifPresent(f -> dto.moh(EnumDynamicConverter.convert(f))); - return dto; + 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 index 6fe7dd93b..3f1fa2bf4 100644 --- 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 @@ -1,40 +1,38 @@ package com.sinch.sdk.domains.voice.adapters.converters; -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.voice.models.requests.Control; import com.sinch.sdk.domains.voice.models.requests.ControlUrl; import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; -import java.util.logging.Logger; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; public class ControlDtoConverter { - private static final Logger LOGGER = Logger.getLogger(SVAMLActionDtoConverter.class.getName()); + 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 String convert(Control client) { - if (null == client) { + public static com.sinch.sdk.domains.voice.models.v1.svaml.Control convertControl( + Control _client) { + if (null == _client) { return null; } - String dto; - if (client instanceof SVAMLControl) { - SVAMLControl value = (SVAMLControl) client; - dto = convertControlToEscapedJSON(value); - } else if (client instanceof ControlUrl) { - ControlUrl value = (ControlUrl) client; - dto = value.getURL(); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); - dto = client.toString(); + + 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(); } - return dto; - } - private static String convertControlToEscapedJSON(SVAMLControl client) { - try { - return Mapper.getInstance().writeValueAsString(CallsDtoConverter.convert(client)); - } catch (JsonProcessingException e) { - throw new ApiMappingException(client.toString(), e); + 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 index e339412aa..143bb3196 100644 --- 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 @@ -1,78 +1,103 @@ package com.sinch.sdk.domains.voice.adapters.converters; -import com.sinch.sdk.domains.voice.models.Destination; 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.dto.v1.DestinationDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DestinationTypeDto; +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.Objects; import java.util.logging.Logger; public class DestinationDtoConverter { private static final Logger LOGGER = Logger.getLogger(DestinationDtoConverter.class.getName()); - public static DestinationDto convert(Destination client) { - DestinationDto dto = new DestinationDto(); + public static Destination convert(com.sinch.sdk.domains.voice.models.Destination client) { + if (null == client) { return null; } - DestinationTypeDto type = null; - String endpoint = null; + if (client instanceof DestinationNumber) { DestinationNumber destination = (DestinationNumber) client; - DestinationNumberType clientType = destination.getType(); - if (clientType == DestinationNumberType.DID) { - type = DestinationTypeDto.DID; - } else if (clientType == DestinationNumberType.PSTN) { - type = DestinationTypeDto.NUMBER; - } else { - LOGGER.severe(String.format("Unexpected type '%s'", destination.getType())); - return dto; + if (DestinationNumberType.DID.equals(destination.getType())) { + return DestinationDid.from( + null != destination.getPhoneNumber() + ? destination.getPhoneNumber().stringValue() + : null); } - endpoint = destination.getPhoneNumber().stringValue(); - } else if (client instanceof DestinationUser) { - DestinationUser destination = (DestinationUser) client; - type = DestinationTypeDto.USERNAME; - endpoint = destination.getUserName(); - } else if (client instanceof DestinationSip) { - DestinationSip destination = (DestinationSip) client; - type = DestinationTypeDto.SIP; - endpoint = destination.getSIPAddress(); - } else { - LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); + 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 (null != type && endpoint != null) { - dto.type(type).endpoint(endpoint); + if (dto instanceof DestinationDid) { + return new DestinationNumber( + E164PhoneNumber.valueOf(((DestinationDid) dto).getEndpoint()), DestinationNumberType.DID); } - return dto; + + LOGGER.severe(String.format("Unexpected class '%s'", dto)); + return null; } - public static Destination convert(DestinationDto dto) { + public static com.sinch.sdk.domains.voice.models.Destination convert(CallInformationFrom dto) { if (null == dto) { return null; } - Destination destination = null; - if (Objects.equals(dto.getType(), DestinationTypeDto.NUMBER) - || Objects.equals(dto.getType(), DestinationTypeDto.NUMBER2)) { - destination = - new DestinationNumber( - E164PhoneNumber.valueOf(dto.getEndpoint()), DestinationNumberType.PSTN); - } else if (Objects.equals(dto.getType(), DestinationTypeDto.USERNAME) - || Objects.equals(dto.getType(), DestinationTypeDto.USERNAME2)) { - destination = new DestinationUser(dto.getEndpoint()); - } else if (Objects.equals(dto.getType(), DestinationTypeDto.SIP)) { - destination = new DestinationSip(dto.getEndpoint()); - } else if (Objects.equals(dto.getType(), DestinationTypeDto.DID)) { - destination = - new DestinationNumber( - E164PhoneNumber.valueOf(dto.getEndpoint()), DestinationNumberType.DID); - } else { - LOGGER.severe(String.format("Unexpected type value '%s'", dto.getType())); + 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 destination; + 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 index 36df521e0..7de97808e 100644 --- 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 @@ -1,7 +1,7 @@ package com.sinch.sdk.domains.voice.adapters.converters; import com.sinch.sdk.domains.voice.models.DomainType; -import com.sinch.sdk.domains.voice.models.dto.v1.DomainDto; +import com.sinch.sdk.domains.voice.models.v1.Domain; public class DomainTypeDtoConverter { @@ -12,10 +12,10 @@ public static DomainType convert(String dto) { return DomainType.from(dto.toLowerCase()); } - public static DomainType convert(DomainDto dto) { + public static DomainType convert(Domain dto) { if (null == dto) { return null; } - return DomainType.from(dto.getValue().toLowerCase()); + return DomainType.from(dto.value().toLowerCase()); } } 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 index 1c5d08577..f446da50d 100644 --- 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 @@ -1,13 +1,14 @@ 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(String dto) { + public static NumberType convert(NumberTypeEnum dto) { if (null == dto) { return null; } - return NumberType.from(dto); + 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 index 9f1b8f0f4..caa4a7cb0 100644 --- 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 @@ -1,11 +1,10 @@ package com.sinch.sdk.domains.voice.adapters.converters; import com.sinch.sdk.domains.voice.models.Price; -import com.sinch.sdk.domains.voice.models.dto.v1.PriceDto; public class PriceDtoConverter { - public static Price convert(PriceDto dto) { + public static Price convert(com.sinch.sdk.domains.voice.models.v1.Price dto) { if (null == dto) { return Price.builder().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 index e1a35983c..60a88ead7 100644 --- 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 @@ -3,20 +3,6 @@ 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.dto.v1.CallHeaderDto; -import com.sinch.sdk.domains.voice.models.dto.v1.MenuDto; -import com.sinch.sdk.domains.voice.models.dto.v1.OptionDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectConfConferenceDtmfOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectConfDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectMxpDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectPstnAmdDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectPstnDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectSipDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionContinueDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionHangupDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionParkDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionRunMenuDto; 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; @@ -27,9 +13,27 @@ 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.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.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; @@ -38,13 +42,12 @@ public class SVAMLActionDtoConverter { private static final Logger LOGGER = Logger.getLogger(SVAMLActionDtoConverter.class.getName()); - public static SvamlActionDto convert(Action client) { + public static SvamlAction convert(Action client) { if (null == client) { return null; } - SvamlActionDto dto = new SvamlActionDto(); - Object convertedDto = null; + SvamlAction convertedDto = null; if (client instanceof ActionConnectConference) { ActionConnectConference typedClient = (ActionConnectConference) client; convertedDto = convertAction(typedClient); @@ -73,161 +76,180 @@ public static SvamlActionDto convert(Action client) { LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); } - dto.setActualInstance(convertedDto); - return dto; + return convertedDto; } - private static SvamlActionConnectConfDto convertAction(ActionConnectConference client) { + private static SvamlActionConnectConference convertAction(ActionConnectConference client) { if (null == client) { return null; } - SvamlActionConnectConfDto dto = new SvamlActionConnectConfDto(); - dto.setName(SvamlActionConnectConfDto.NameEnum.CONNECTCONF.getValue()); + SvamlActionConnectConference.Builder dto = SvamlActionConnectConference.builder(); client.getConferenceId().ifPresent(dto::setConferenceId); - client.getMusicOnHold().ifPresent(f -> dto.setMoh(EnumDynamicConverter.convert(f))); + client + .getMusicOnHold() + .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); client.getDtfmOptions().ifPresent(f -> dto.setConferenceDtmfOptions(convert(f))); - return dto; + return dto.build(); } - private static SvamlActionConnectMxpDto convertAction(ActionConnectMxp client) { + private static SvamlActionConnectMxp convertAction(ActionConnectMxp client) { if (null == client) { return null; } - SvamlActionConnectMxpDto dto = new SvamlActionConnectMxpDto(); - dto.setName(SvamlActionConnectMxpDto.NameEnum.CONNECTMXP.getValue()); - client.getDestination().ifPresent(f -> dto.setDestination(DestinationDtoConverter.convert(f))); + 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; + return dto.build(); } - private static SvamlActionConnectPstnDto convertAction(ActionConnectPstn client) { + private static SvamlActionConnectPstn convertAction(ActionConnectPstn client) { if (null == client) { return null; } - SvamlActionConnectPstnDto dto = new SvamlActionConnectPstnDto(); - dto.setName(SvamlActionConnectPstnDto.NameEnum.CONNECTPSTN.getValue()); + 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 - .getDualToneMultiFrequency() - .ifPresent(f -> dto.setDtmf(DualToneMultiFrequencyDtoConverter.convert(f))); - client.getIndications().ifPresent(f -> dto.setIndications(EnumDynamicConverter.convert(f))); + .getIndications() + .ifPresent(f -> dto.setIndications(IndicationsEnum.from(EnumDynamicConverter.convert(f)))); client.getAnsweringMachineDetection().ifPresent(f -> dto.setAmd(convert(f))); - return dto; + return dto.build(); } - private static SvamlActionConnectSipDto convertAction(ActionConnectSip client) { + private static SvamlActionConnectSip convertAction(ActionConnectSip client) { if (null == client) { return null; } - SvamlActionConnectSipDto dto = new SvamlActionConnectSipDto(); - dto.setName(SvamlActionConnectSipDto.NameEnum.CONNECTSIP.getValue()); - client.getDestination().ifPresent(f -> dto.setDestination(DestinationDtoConverter.convert(f))); + 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(EnumDynamicConverter.convert(f))); + 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.setMoh(EnumDynamicConverter.convert(f))); - return dto; + client + .getMusicOnHold() + .ifPresent(f -> dto.setMusicOnHold(MusicOnHold.from(EnumDynamicConverter.convert(f)))); + return dto.build(); } - private static SvamlActionContinueDto convertAction(ActionContinue client) { + private static SvamlActionContinue convertAction(ActionContinue client) { if (null == client) { return null; } - SvamlActionContinueDto dto = new SvamlActionContinueDto(); - dto.setName(SvamlActionContinueDto.NameEnum.CONTINUE.getValue()); - return dto; + return SvamlActionContinue.DEFAULT; } - private static SvamlActionHangupDto convertAction(ActionHangUp client) { + private static SvamlActionHangup convertAction(ActionHangUp client) { if (null == client) { return null; } - SvamlActionHangupDto dto = new SvamlActionHangupDto(); - dto.setName(SvamlActionHangupDto.NameEnum.HANGUP.getValue()); - return dto; + return SvamlActionHangup.DEFAULT; } - private static SvamlActionParkDto convertAction(ActionPark client) { + private static SvamlActionPark convertAction(ActionPark client) { if (null == client) { return null; } - SvamlActionParkDto dto = new SvamlActionParkDto(); - dto.setName(SvamlActionParkDto.NameEnum.PARK.getValue()); + 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; + return dto.build(); } - private static SvamlActionRunMenuDto convertAction(ActionRunMenu client) { + private static SvamlActionRunMenu convertAction(ActionRunMenu client) { if (null == client) { return null; } - SvamlActionRunMenuDto dto = new SvamlActionRunMenuDto(); - dto.setName(SvamlActionRunMenuDto.NameEnum.RUNMENU.getValue()); + 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; + return dto.build(); } - private static SvamlActionConnectConfConferenceDtmfOptionsDto convert( - ConferenceDtfmOptions client) { + private static ConferenceDtmfOptions convert(ConferenceDtfmOptions client) { if (null == client) { return null; } - SvamlActionConnectConfConferenceDtmfOptionsDto dto = - new SvamlActionConnectConfConferenceDtmfOptionsDto(); - client.getMode().ifPresent(f -> dto.setMode(EnumDynamicConverter.convert(f))); - client.getMaxDigits().ifPresent(dto::setMaxDigits); - client.getTimeoutMills().ifPresent(dto::setTimeoutMills); - return dto; + 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) { + private static List convertHeaderCollection(Collection> client) { if (null == client) { return null; } return client.stream() - .map(f -> new CallHeaderDto().key(f.getLeft()).value(f.getRight())) + .map(f -> CallHeader.builder().setKey(f.getLeft()).setValue(f.getRight()).build()) .collect(Collectors.toList()); } - private static SvamlActionConnectPstnAmdDto convert(AnsweringMachineDetection client) { + private static ConnectPstnAnsweringMachineDetection convert(AnsweringMachineDetection client) { if (null == client) { return null; } - SvamlActionConnectPstnAmdDto dto = new SvamlActionConnectPstnAmdDto(); + ConnectPstnAnsweringMachineDetection.Builder dto = + ConnectPstnAnsweringMachineDetection.builder(); client.getEnabled().ifPresent(dto::setEnabled); - return dto; + return dto.build(); } - private static List convertMenuCollection(Collection client) { + private static List convertMenuCollection( + Collection client) { if (null == client) { return null; } return client.stream().map(SVAMLActionDtoConverter::convert).collect(Collectors.toList()); } - private static MenuDto convert(Menu client) { + private static Menu convert(com.sinch.sdk.domains.voice.models.svaml.Menu client) { if (null == client) { return null; } - MenuDto dto = new MenuDto(); + Menu.Builder dto = Menu.builder(); client.getId().ifPresent(dto::setId); client.getMainPrompt().ifPresent(dto::setMainPrompt); @@ -237,20 +259,21 @@ private static MenuDto convert(Menu client) { client.getTimeoutMills().ifPresent(dto::setTimeoutMills); client.getMaxTimeoutMills().ifPresent(dto::setMaxTimeoutMills); client.getOptions().ifPresent(f -> dto.setOptions(convertMenuOptionCollection(f))); - return dto; + return dto.build(); } - private static List convertMenuOptionCollection(Collection client) { + private static List convertMenuOptionCollection( + Collection client) { if (null == client) { return null; } return client.stream() .map( f -> { - OptionDto dto = new OptionDto(); - f.getAction().ifPresent(f2 -> dto.action(convert(f2))); - f.getDtfm().ifPresent(f2 -> dto.dtmf(DualToneMultiFrequencyDtoConverter.convert(f2))); - return dto; + MenuOption.Builder dto = MenuOption.builder(); + f.getAction().ifPresent(f2 -> dto.setAction(convert(f2))); + f.getDtfm().ifPresent(dto::setDtmf); + return dto.build(); }) .collect(Collectors.toList()); } 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 index 0a90f57ac..0a1b95f10 100644 --- 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 @@ -1,16 +1,5 @@ package com.sinch.sdk.domains.voice.adapters.converters; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionAnswerDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionPlayFilesDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionPlayFilesDto.NameEnum; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSayDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSendDtmfDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSetCookieDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStopRecordingDto; 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; @@ -21,6 +10,14 @@ 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; @@ -32,7 +29,7 @@ public class SVAMLInstructionDtoConverter { private static final Logger LOGGER = Logger.getLogger(SVAMLInstructionDtoConverter.class.getName()); - public static List convert(Collection instructions) { + public static List convert(Collection instructions) { if (null == instructions) { return null; } @@ -41,13 +38,12 @@ public static List convert(Collection instruct .collect(Collectors.toList()); } - private static SvamlInstructionDto convertInstruction(Instruction client) { + private static SvamlInstruction convertInstruction(Instruction client) { if (null == client) { return null; } - SvamlInstructionDto dto = new SvamlInstructionDto(); - Object convertedDto = null; + SvamlInstruction convertedDto = null; if (client instanceof InstructionAnswer) { InstructionAnswer typedClient = (InstructionAnswer) client; convertedDto = convert(typedClient); @@ -73,105 +69,96 @@ private static SvamlInstructionDto convertInstruction(Instruction client) { LOGGER.severe(String.format("Unexpected class '%s'", client.getClass())); } - dto.setActualInstance(convertedDto); - return dto; + return convertedDto; } - private static SvamlInstructionAnswerDto convert(InstructionAnswer client) { + private static SvamlInstructionAnswer convert(InstructionAnswer client) { if (null == client) { return null; } - SvamlInstructionAnswerDto dto = new SvamlInstructionAnswerDto(); - dto.setName(SvamlInstructionAnswerDto.NameEnum.ANSWER.getValue()); - return dto; + return SvamlInstructionAnswer.DEFAULT; } - private static SvamlInstructionPlayFilesDto convert(InstructionPlayFiles client) { + private static SvamlInstructionPlayFiles convert(InstructionPlayFiles client) { if (null == client) { return null; } - SvamlInstructionPlayFilesDto dto = new SvamlInstructionPlayFilesDto(); - dto.setName(NameEnum.PLAYFILES.getValue()); + SvamlInstructionPlayFiles.Builder dto = SvamlInstructionPlayFiles.builder(); client.getIds().ifPresent(f -> dto.setIds(new ArrayList<>(f))); - client.getLocale().ifPresent(dto::locale); - return dto; + client.getLocale().ifPresent(dto::setLocale); + return dto.build(); } - private static SvamlInstructionSayDto convert(InstructionSay client) { + private static SvamlInstructionSay convert(InstructionSay client) { if (null == client) { return null; } - SvamlInstructionSayDto dto = new SvamlInstructionSayDto(); - dto.setName(SvamlInstructionSayDto.NameEnum.SAY.getValue()); + SvamlInstructionSay.Builder dto = SvamlInstructionSay.builder(); client.getText().ifPresent(dto::setText); client.getLocale().ifPresent(dto::setLocale); - return dto; + return dto.build(); } - private static SvamlInstructionSendDtmfDto convert(InstructionSendDtfm client) { + private static SvamlInstructionSendDtmf convert(InstructionSendDtfm client) { if (null == client) { return null; } - SvamlInstructionSendDtmfDto dto = new SvamlInstructionSendDtmfDto(); - dto.setName(SvamlInstructionSendDtmfDto.NameEnum.SENDDTMF.getValue()); + SvamlInstructionSendDtmf.Builder dto = SvamlInstructionSendDtmf.builder(); client.getTDtfm().ifPresent(f -> dto.setValue(f.stringValue())); - return dto; + return dto.build(); } - private static SvamlInstructionSetCookieDto convert(InstructionSetCookie client) { + private static SvamlInstructionSetCookie convert(InstructionSetCookie client) { if (null == client) { return null; } - SvamlInstructionSetCookieDto dto = new SvamlInstructionSetCookieDto(); - dto.setName(SvamlInstructionSetCookieDto.NameEnum.SETCOOKIE.getValue()); - + SvamlInstructionSetCookie.Builder dto = SvamlInstructionSetCookie.builder(); dto.setKey(client.getKey()); dto.setValue(client.getValue()); - return dto; + return dto.build(); } - private static SvamlInstructionStartRecordingDto convert(InstructionStartRecording client) { + private static SvamlInstructionStartRecording convert(InstructionStartRecording client) { if (null == client) { return null; } - SvamlInstructionStartRecordingDto dto = new SvamlInstructionStartRecordingDto(); - dto.setName(SvamlInstructionStartRecordingDto.NameEnum.STARTRECORDING.getValue()); + SvamlInstructionStartRecording.Builder dto = SvamlInstructionStartRecording.builder(); client.getOptions().ifPresent(f -> dto.setOptions(convert(f))); - return dto; + return dto.build(); } - private static SvamlInstructionStopRecordingDto convert(InstructionStopRecording client) { + private static SvamlInstructionStopRecording convert(InstructionStopRecording client) { if (null == client) { return null; } - SvamlInstructionStopRecordingDto dto = new SvamlInstructionStopRecordingDto(); - dto.setName(SvamlInstructionStopRecordingDto.NameEnum.STOPRECORDING.getValue()); - return dto; + return SvamlInstructionStopRecording.DEFAULT; } - private static SvamlInstructionStartRecordingOptionsDto convert(StartRecordingOptions client) { + private static com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions + convert(StartRecordingOptions client) { if (null == client) { return null; } - SvamlInstructionStartRecordingOptionsDto dto = new SvamlInstructionStartRecordingOptionsDto(); + 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; + return dto.build(); } - private static SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto convert( - TranscriptionOptions client) { + private static com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions + convert(TranscriptionOptions client) { if (null == client) { return null; } - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto dto = - new SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto(); + 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::locale); - return dto; + 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 index 07e389c98..45dc8057c 100644 --- 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 @@ -2,19 +2,13 @@ import com.sinch.sdk.core.exceptions.ApiException; import com.sinch.sdk.core.utils.Pair; -import com.sinch.sdk.domains.common.adapters.converters.OffsetDateTimeDtoConverter; import com.sinch.sdk.domains.voice.models.CallReasonType; import com.sinch.sdk.domains.voice.models.CallResultType; -import com.sinch.sdk.domains.voice.models.dto.v1.AceRequestAllOfAmdDto; -import com.sinch.sdk.domains.voice.models.dto.v1.AceRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.CallHeaderDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DiceRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.IceRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.NotifyRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.PieRequestAllOfMenuResultDto; -import com.sinch.sdk.domains.voice.models.dto.v1.PieRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.WebhooksEventDto; -import com.sinch.sdk.domains.voice.models.dto.v1.WebhooksEventRequestDto; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEventAnsweringMachineDetection; +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; @@ -33,7 +27,7 @@ public class WebhooksEventDtoConverter { - public static WebhooksEvent convert(WebhooksEventDto dto) { + public static WebhooksEvent convert(VoiceWebhookEvent dto) { if (null == dto) { return null; @@ -41,25 +35,25 @@ public static WebhooksEvent convert(WebhooksEventDto dto) { WebhooksEvent.Builder builder; - WebhooksEventRequestDto instance = (WebhooksEventRequestDto) dto.getActualInstance(); - if (instance instanceof IceRequestDto) { - builder = convert((IceRequestDto) instance); - } else if (instance instanceof DiceRequestDto) { - builder = convert((DiceRequestDto) instance); - } else if (instance instanceof AceRequestDto) { - builder = convert((AceRequestDto) instance); - } else if (instance instanceof PieRequestDto) { - builder = convert((PieRequestDto) instance); - } else if (instance instanceof NotifyRequestDto) { - builder = convert((NotifyRequestDto) instance); + 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(instance.getCallid()).setVersion(instance.getVersion()).build(); + return builder.setCallId(dto.getCallid()).setVersion(dto.getVersion()).build(); } - private static IncomingCallEvent.Builder convert(IceRequestDto dto) { + private static IncomingCallEvent.Builder convert( + com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent dto) { IncomingCallEvent.Builder builder = IncomingCallEvent.builder(); if (null == dto) { @@ -67,7 +61,7 @@ private static IncomingCallEvent.Builder convert(IceRequestDto dto) { } return builder - .setTimestamp(OffsetDateTimeDtoConverter.convert(dto.getTimestamp())) + .setTimestamp(dto.getTimestamp()) .setCustom(dto.getCustom()) .setCallResourceUrl(dto.getCallResourceUrl()) .setUserRate(PriceDtoConverter.convert(dto.getUserRate())) @@ -81,17 +75,18 @@ private static IncomingCallEvent.Builder convert(IceRequestDto dto) { .setCallHeaders(convertHeaderCollection(dto.getCallHeaders())); } - private static DisconnectCallEvent.Builder convert(DiceRequestDto dto) { + 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(OffsetDateTimeDtoConverter.convert(dto.getTimestamp())) + .setTimestamp(dto.getTimestamp()) .setCustom(dto.getCustom()) - .setReason(null != dto.getReason() ? CallReasonType.from(dto.getReason()) : null) - .setResult(null != dto.getResult() ? CallResultType.from(dto.getResult().getValue()) : null) + .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())) @@ -100,26 +95,28 @@ private static DisconnectCallEvent.Builder convert(DiceRequestDto dto) { .setFrom(dto.getFrom()); } - private static AnsweredCallEvent.Builder convert(AceRequestDto dto) { + 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(OffsetDateTimeDtoConverter.convert(dto.getTimestamp())) + .setTimestamp(dto.getTimestamp()) .setCustom(dto.getCustom()) .setAmd(convert(dto.getAmd())); } - private static PromptInputEvent.Builder convert(PieRequestDto dto) { + 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(OffsetDateTimeDtoConverter.convert(dto.getTimestamp())) + .setTimestamp(dto.getTimestamp()) .setCustom(dto.getCustom()) .setApplicationKey(dto.getApplicationKey()) .setCallId(dto.getCallid()) @@ -127,7 +124,8 @@ private static PromptInputEvent.Builder convert(PieRequestDto dto) { .setMenuResult(convert(dto.getMenuResult())); } - private static NotifyEvent.Builder convert(NotifyRequestDto dto) { + private static NotifyEvent.Builder convert( + com.sinch.sdk.domains.voice.models.v1.webhooks.NotificationEvent dto) { NotifyEvent.Builder builder = NotifyEvent.builder(); if (null == dto) { @@ -140,16 +138,20 @@ private static NotifyEvent.Builder convert(NotifyRequestDto dto) { .setType(dto.getType()); } - private static AmdAnswer convert(AceRequestAllOfAmdDto dto) { + private static AmdAnswer convert(AnsweredCallEventAnsweringMachineDetection dto) { if (null == dto) { return null; } - return AmdAnswer.builder() - .setReason(convertReason(dto.getReason())) - .setStatus(convertStatus(dto.getStatus())) - .setDuration(dto.getDuration()) - .build(); + 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) { @@ -166,19 +168,24 @@ private static AmdAnswerStatusType convertStatus(String dto) { return AmdAnswerStatusType.from(dto); } - private static Collection> convertHeaderCollection(List 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(PieRequestAllOfMenuResultDto dto) { - return MenuResult.builder() - .setMenuId(dto.getMenuId()) - .setType(MenuInputType.from(dto.getType())) - .setValue(dto.getValue()) - .setInputMethod(MenuResultInputMethodType.from(dto.getInputMethod())) - .build(); + 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/api/v1/ApplicationsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/ApplicationsService.java new file mode 100644 index 000000000..356604b3b --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/ApplicationsService.java @@ -0,0 +1,68 @@ +package com.sinch.sdk.domains.voice.api.v1; + +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.OwnedNumbersResponse; +import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse; + +/** + * You can use the API to manage features of applications in your project. + * + * @since 1.4 + */ +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.4 + */ + OwnedNumbersResponse 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.4 + */ + Callbacks getCallbackUrls(String applicationKey); + + /** + * Update the configured callback URLs for the specified application. + * + * @param applicationKey The unique identifying key of the application + * @param parameters Callbacks settings + * @since 1.4 + */ + void updateCallbackUrls(String applicationKey, Callbacks parameters); + + /** + * Returns information about the requested number + * + * @param number The phone number you want to query + * @return Number information + */ + QueryNumberResponse queryNumber(String number); + + /** + * Update or assign a list of numbers to an application. + * + * @param parameters Request parameters + * @since 1.4 + */ + void assignNumbers(UpdateNumbersRequest parameters); + + /** + * Un-assign a number from an application. + * + * @param parameters Request parameters + * @since 1.4 + */ + public void unassignNumber(UnAssignNumberRequest parameters); +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/CalloutsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/CalloutsService.java new file mode 100644 index 000000000..12a71528f --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/CalloutsService.java @@ -0,0 +1,57 @@ +package com.sinch.sdk.domains.voice.api.v1; + +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.4 + */ +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.4 + */ + String textToSpeech(CalloutRequestTTS 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.4 + */ + String conference(CalloutRequestConference 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.4 + */ + String custom(CalloutRequestCustom 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.4 + */ + String call(CalloutRequest parameters); +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/CallsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/CallsService.java new file mode 100644 index 000000000..70cd10e55 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/CallsService.java @@ -0,0 +1,58 @@ +package com.sinch.sdk.domains.voice.api.v1; + +import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation; +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.4 + */ +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 + * @since 1.4 + */ + 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 + * @since 1.4 + */ + 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 + * @since 1.4 + */ + void manageWithCallLeg(String callId, CallLeg callLeg, SvamlControl parameters); +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/ConferencesService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/ConferencesService.java new file mode 100644 index 000000000..4d30b0821 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/ConferencesService.java @@ -0,0 +1,63 @@ +package com.sinch.sdk.domains.voice.api.v1; + +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; +import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; +import com.sinch.sdk.domains.voice.models.v1.conferences.response.GetConferenceInfoResponse; + +/** + * 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.4 + */ +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.4 + */ + String call(CalloutRequestConference 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.4 + */ + GetConferenceInfoResponse get(String conferenceId); + + /** + * Removes all participants from a conference + * + * @param conferenceId The unique identifier of the conference. The user sets this value. + * @since 1.4 + */ + 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.4 + */ + 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 + * @since 1.4 + */ + void manageParticipant( + String conferenceId, String callId, ManageConferenceParticipantRequest parameters); +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/VoiceService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/VoiceService.java new file mode 100644 index 000000000..21ec5834e --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/VoiceService.java @@ -0,0 +1,51 @@ +package com.sinch.sdk.domains.voice.api.v1; + +/** + * Voice service + * + * @see https://developers.sinch.com/docs/voice/ + * @since 1.4 + */ +public interface VoiceService { + + /** + * Callouts Service instance + * + * @return service instance for project + * @since 1.4 + */ + CalloutsService callouts(); + + /** + * Conference Service instance + * + * @return service instance for project + * @since 1.4 + */ + ConferencesService conferences(); + + /** + * Calls Service instance + * + * @return service instance for project + * @since 1.4 + */ + CallsService calls(); + + /** + * Applications Service instance + * + * @return service instance for project + * @since 1.4 + */ + ApplicationsService applications(); + + /** + * Webhooks helpers instance + * + * @return instance service related to webhooks helpers + * @since 1.4 + */ + WebHooksService webhooks(); +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/WebHooksService.java new file mode 100644 index 000000000..fca05fc90 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/WebHooksService.java @@ -0,0 +1,59 @@ +package com.sinch.sdk.domains.voice.api.v1; + +import com.sinch.sdk.core.exceptions.ApiMappingException; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEvent; +import java.util.Map; + +/** + * Webhooks service + * + * @see https://developers.sinch.com/docs/voice/api-reference/voice/tag/Callbacks/ + * @since 1.4 + */ +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.4 + */ + boolean validateAuthenticationHeader( + 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.4 + */ + VoiceWebhookEvent parseEvent(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.4 + */ + String serializeResponse(SvamlControl response) throws ApiMappingException; +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsService.java new file mode 100644 index 000000000..0f7e4852a --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsService.java @@ -0,0 +1,57 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +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.domains.voice.api.v1.internal.ApplicationsApi; +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.OwnedNumbersResponse; +import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse; +import com.sinch.sdk.models.VoiceContext; +import java.util.Map; + +public class ApplicationsService implements com.sinch.sdk.domains.voice.api.v1.ApplicationsService { + + private final ApplicationsApi api; + + public ApplicationsService( + VoiceContext context, HttpClient httpClient, Map authManagers) { + this.api = + new ApplicationsApi( + httpClient, + context.getVoiceApplicationManagementServer(), + authManagers, + new HttpMapper()); + } + + protected ApplicationsApi getApi() { + return this.api; + } + + public OwnedNumbersResponse listNumbers() { + return getApi().configurationGetNumbers(); + } + + public Callbacks getCallbackUrls(String applicationKey) { + return getApi().configurationGetCallbackURLs(applicationKey); + } + + public void updateCallbackUrls(String applicationKey, Callbacks parameters) { + + getApi().configurationUpdateCallbackURLs(applicationKey, parameters); + } + + public QueryNumberResponse queryNumber(String number) { + return getApi().callingQueryNumber(number); + } + + public void assignNumbers(UpdateNumbersRequest parameters) { + getApi().configurationUpdateNumbers(parameters); + } + + public void unassignNumber(UnAssignNumberRequest parameters) { + getApi().configurationUnassignNumber(parameters); + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsService.java new file mode 100644 index 000000000..873dabc3d --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsService.java @@ -0,0 +1,76 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +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.domains.voice.api.v1.adapters.mapper.CalloutRequestCustomMapper; +import com.sinch.sdk.domains.voice.api.v1.internal.CalloutsApi; +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.request.internal.CalloutRequestInternalImpl; +import com.sinch.sdk.domains.voice.models.v1.callouts.response.CalloutResponse; +import com.sinch.sdk.models.VoiceContext; +import java.util.Map; + +public class CalloutsService implements com.sinch.sdk.domains.voice.api.v1.CalloutsService { + + private final CalloutsApi api; + + static { + LocalLazyInit.init(); + } + + public CalloutsService( + VoiceContext context, HttpClient httpClient, Map authManagers) { + this.api = + new CalloutsApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); + } + + protected CalloutsApi getApi() { + return this.api; + } + + public String textToSpeech(CalloutRequestTTS parameters) { + + return call(parameters); + } + + public String conference(CalloutRequestConference parameters) { + + return call(parameters); + } + + public String custom(CalloutRequestCustom parameters) { + + return call(parameters); + } + + public String call(CalloutRequest parameters) { + + CalloutRequestInternalImpl request = new CalloutRequestInternalImpl(); + request.setActualInstance(parameters); + CalloutResponse response = getApi().callouts(request); + if (null == response) { + return null; + } + return response.getCallId(); + } + + public static final class LocalLazyInit { + + private LocalLazyInit() { + CalloutRequestCustomMapper.initMapper(); + } + + public static LocalLazyInit init() { + return LazyHolder.INSTANCE; + } + + private static class LazyHolder { + + public static final LocalLazyInit INSTANCE = new LocalLazyInit(); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CallsService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CallsService.java new file mode 100644 index 000000000..811b99105 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/CallsService.java @@ -0,0 +1,58 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +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.domains.voice.api.v1.adapters.mapper.CallInformationMapper; +import com.sinch.sdk.domains.voice.api.v1.internal.CallsApi; +import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.models.VoiceContext; +import java.util.Map; + +public class CallsService implements com.sinch.sdk.domains.voice.api.v1.CallsService { + + private final CallsApi api; + + static { + LocalLazyInit.init(); + } + + public CallsService( + VoiceContext context, HttpClient httpClient, Map authManagers) { + this.api = new CallsApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); + } + + protected CallsApi getApi() { + return this.api; + } + + public CallInformation get(String callId) { + return getApi().callingGetCallResult(callId); + } + + public void update(String callId, SvamlControl parameters) { + getApi().callingUpdateCall(callId, parameters); + } + + public void manageWithCallLeg(String callId, CallLeg callLeg, SvamlControl parameters) { + getApi().callingManageCallWithCallLeg(callId, callLeg.value(), parameters); + } + + public static final class LocalLazyInit { + + private LocalLazyInit() { + CallInformationMapper.initMapper(); + } + + public static CallsService.LocalLazyInit init() { + return CallsService.LocalLazyInit.LazyHolder.INSTANCE; + } + + private static class LazyHolder { + + public static final CallsService.LocalLazyInit INSTANCE = new LocalLazyInit(); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesService.java new file mode 100644 index 000000000..a3f1c8400 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesService.java @@ -0,0 +1,52 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +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.domains.voice.api.v1.internal.ConferencesApi; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; +import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; +import com.sinch.sdk.domains.voice.models.v1.conferences.response.GetConferenceInfoResponse; +import com.sinch.sdk.models.VoiceContext; +import java.util.Map; + +public class ConferencesService implements com.sinch.sdk.domains.voice.api.v1.ConferencesService { + + private final ConferencesApi api; + private final CalloutsService calloutsService; + + public ConferencesService( + VoiceContext context, + HttpClient httpClient, + Map authManagers, + CalloutsService calloutsService) { + this.api = + new ConferencesApi(httpClient, context.getVoiceServer(), authManagers, new HttpMapper()); + this.calloutsService = calloutsService; + } + + protected ConferencesApi getApi() { + return this.api; + } + + public String call(CalloutRequestConference parameters) { + return calloutsService.conference(parameters); + } + + public GetConferenceInfoResponse get(String conferenceId) { + return getApi().callingGetConferenceInfo(conferenceId); + } + + public void kickAll(String conferenceId) { + getApi().callingKickConferenceAll(conferenceId); + } + + public void kickParticipant(String conferenceId, String callId) { + getApi().callingKickConferenceParticipant(callId, conferenceId); + } + + public void manageParticipant( + String conferenceId, String callId, ManageConferenceParticipantRequest parameters) { + getApi().callingManageConferenceParticipant(callId, conferenceId, parameters); + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/VoiceService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/VoiceService.java new file mode 100644 index 000000000..9630599f7 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/VoiceService.java @@ -0,0 +1,145 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +import com.sinch.sdk.auth.adapters.ApplicationAuthManager; +import com.sinch.sdk.auth.adapters.BasicAuthManager; +import com.sinch.sdk.core.exceptions.ApiAuthException; +import com.sinch.sdk.core.http.AuthManager; +import com.sinch.sdk.core.http.HttpClient; +import com.sinch.sdk.core.utils.StringUtil; +import com.sinch.sdk.domains.voice.api.v1.adapters.CallsService.LocalLazyInit; +import com.sinch.sdk.domains.voice.api.v1.adapters.mapper.DestinationMapper; +import com.sinch.sdk.models.ApplicationCredentials; +import com.sinch.sdk.models.VoiceContext; +import java.util.Map; +import java.util.Objects; +import java.util.TreeMap; +import java.util.logging.Logger; + +public class VoiceService implements com.sinch.sdk.domains.voice.api.v1.VoiceService { + private static final Logger LOGGER = Logger.getLogger(VoiceService.class.getName()); + + private static final String SECURITY_SCHEME_KEYWORD = "Signed"; + + private static final String BASIC_SECURITY_SCHEME_KEYWORD = "Basic"; + + private static final String APPLICATION_SECURITY_SCHEME_KEYWORD = "Application"; + + private final VoiceContext context; + private final HttpClient httpClient; + private CalloutsService callouts; + private ConferencesService conferences; + private CallsService calls; + private ApplicationsService applications; + private WebHooksService webhooks; + + private Map clientAuthManagers; + private Map webhooksAuthManagers; + + static { + LocalLazyInit.init(); + } + + public VoiceService( + ApplicationCredentials credentials, VoiceContext context, HttpClient httpClient) { + + // Currently, we are not supporting unified credentials: ensure application credentials are + // defined + Objects.requireNonNull(credentials, "Credentials must be defined"); + Objects.requireNonNull(context, "Context must be defined"); + StringUtil.requireNonEmpty(credentials.getApplicationKey(), "'applicationKey' must be defined"); + StringUtil.requireNonEmpty( + credentials.getApplicationSecret(), "'applicationSecret' must be defined"); + + LOGGER.fine("Activate voice API with server='" + context.getVoiceServer().getUrl() + "'"); + + this.context = context; + this.httpClient = httpClient; + setApplicationCredentials(credentials); + } + + private void setApplicationCredentials(ApplicationCredentials credentials) { + + AuthManager basicAuthManager = + new BasicAuthManager(credentials.getApplicationKey(), credentials.getApplicationSecret()); + AuthManager applicationAuthManager = + new ApplicationAuthManager( + credentials.getApplicationKey(), credentials.getApplicationSecret()); + + clientAuthManagers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + clientAuthManagers.put(SECURITY_SCHEME_KEYWORD, applicationAuthManager); + + // here we need both auth managers to handle webhooks because we are receiving an Authorization + // header with "Application" keyword + webhooksAuthManagers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + webhooksAuthManagers.put(BASIC_SECURITY_SCHEME_KEYWORD, basicAuthManager); + webhooksAuthManagers.put(APPLICATION_SECURITY_SCHEME_KEYWORD, applicationAuthManager); + } + + public CalloutsService callouts() { + if (null == this.callouts) { + checkCredentials(); + this.callouts = new CalloutsService(context, httpClient, clientAuthManagers); + } + return this.callouts; + } + + public ConferencesService conferences() { + if (null == this.conferences) { + checkCredentials(); + this.conferences = + new ConferencesService(context, httpClient, clientAuthManagers, this.callouts()); + } + return this.conferences; + } + + public CallsService calls() { + if (null == this.calls) { + checkCredentials(); + this.calls = new CallsService(context, httpClient, clientAuthManagers); + } + return this.calls; + } + + public ApplicationsService applications() { + if (null == this.applications) { + checkCredentials(); + this.applications = + new com.sinch.sdk.domains.voice.api.v1.adapters.ApplicationsService( + context, httpClient, clientAuthManagers); + } + return this.applications; + } + + public WebHooksService webhooks() { + checkCredentials(); + if (null == this.webhooks) { + this.webhooks = new WebHooksService(webhooksAuthManagers); + } + return this.webhooks; + } + + private void checkCredentials() throws ApiAuthException { + if (null == clientAuthManagers || clientAuthManagers.isEmpty()) { + throw new ApiAuthException( + String.format( + "Service '%s' cannot be called without defined credentials", + this.getClass().getSimpleName())); + } + } + + public static final class LocalLazyInit { + + private LocalLazyInit() { + DestinationMapper.initMapper(); + } + + public static LocalLazyInit init() { + return LocalLazyInit.LazyHolder.INSTANCE; + } + + private static class LazyHolder { + + public static final LocalLazyInit INSTANCE = new LocalLazyInit(); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/WebHooksService.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/WebHooksService.java new file mode 100644 index 000000000..4457caac2 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/WebHooksService.java @@ -0,0 +1,68 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.sinch.sdk.core.exceptions.ApiMappingException; +import com.sinch.sdk.core.http.AuthManager; +import com.sinch.sdk.core.utils.MapUtils; +import com.sinch.sdk.core.utils.StringUtil; +import com.sinch.sdk.core.utils.databind.Mapper; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.internal.WebhooksEventInternalImpl; +import java.util.Map; +import java.util.logging.Logger; + +public class WebHooksService implements com.sinch.sdk.domains.voice.api.v1.WebHooksService { + private static final Logger LOGGER = Logger.getLogger(WebHooksService.class.getName()); + + private final Map authManagers; + + public WebHooksService(Map authManagers) { + this.authManagers = authManagers; + } + + public boolean validateAuthenticationHeader( + String method, String path, Map headers, String jsonPayload) { + + // convert header keys to use case-insensitive map keys + Map caseInsensitiveHeaders = MapUtils.getCaseInsensitiveMap(headers); + + String authorizationHeader = caseInsensitiveHeaders.get("Authorization"); + + if (StringUtil.isEmpty(authorizationHeader)) { + return false; + } + + String[] split = authorizationHeader.split(" "); + String authorizationKeyword = split.length > 0 ? split[0] : ""; + + AuthManager authManager = authManagers.get(authorizationKeyword); + if (null == authManager) { + // unknown auth manager + LOGGER.severe( + String.format("Auth manager for authorization '%s' not found", authorizationKeyword)); + return false; + } + return authManager.validateAuthenticatedRequest(method, path, headers, jsonPayload); + } + + @Override + public VoiceWebhookEvent parseEvent(String jsonPayload) throws ApiMappingException { + try { + WebhooksEventInternalImpl o = + Mapper.getInstance().readValue(jsonPayload, WebhooksEventInternalImpl.class); + return (VoiceWebhookEvent) o.getActualInstance(); + } catch (JsonProcessingException e) { + throw new ApiMappingException(jsonPayload, e); + } + } + + @Override + public String serializeResponse(SvamlControl response) throws ApiMappingException { + try { + return Mapper.getInstance().writeValueAsString(response); + } catch (JsonProcessingException e) { + throw new ApiMappingException(response.toString(), e); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CallInformationMapper.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CallInformationMapper.java new file mode 100644 index 000000000..c986b9c49 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CallInformationMapper.java @@ -0,0 +1,81 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters.mapper; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.sinch.sdk.core.utils.databind.Mapper; +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.internal.DestinationInternalImpl; +import java.io.IOException; +import java.util.logging.Logger; + +public class CallInformationMapper { + + private static final Logger LOGGER = Logger.getLogger(CallInformationMapper.class.getName()); + + public static void initMapper() { + + SimpleModule module = new SimpleModule(); + module.addDeserializer(CallInformationFrom.class, new CallInformationFromDeserializer()); + module.addDeserializer(CallInformationTo.class, new CallInformationToDeserializer()); + Mapper.getInstance().registerModule(module); + } + + static class CallInformationFromDeserializer extends StdDeserializer { + + public CallInformationFromDeserializer() { + this(null); + } + + public CallInformationFromDeserializer(Class vc) { + super(vc); + } + + @Override + public CallInformationFrom deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + DestinationInternalImpl read = jp.readValueAs(DestinationInternalImpl.class); + + if (null == read) { + return null; + } + Object instance = read.getActualInstance(); + if (!(instance instanceof CallInformationFrom)) { + LOGGER.severe("Unexpected class: " + instance); + return null; + } + return (CallInformationFrom) instance; + } + } + + static class CallInformationToDeserializer extends StdDeserializer { + + public CallInformationToDeserializer() { + this(null); + } + + public CallInformationToDeserializer(Class vc) { + super(vc); + } + + @Override + public CallInformationTo deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + DestinationInternalImpl read = jp.readValueAs(DestinationInternalImpl.class); + + if (null == read) { + return null; + } + Object instance = read.getActualInstance(); + if (!(instance instanceof CallInformationTo)) { + LOGGER.severe("Unexpected class: " + instance); + return null; + } + return (CallInformationTo) instance; + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CalloutRequestCustomMapper.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CalloutRequestCustomMapper.java new file mode 100644 index 000000000..ddad3dc85 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/CalloutRequestCustomMapper.java @@ -0,0 +1,76 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters.mapper; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.core.utils.databind.Mapper; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.CustomCalloutInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.CustomCalloutInternalImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.Control; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import java.io.IOException; + +public class CalloutRequestCustomMapper { + + public static void initMapper() { + Mapper.getInstance() + .addMixIn(CustomCalloutInternal.class, CalloutRequestCustomMapperMixin.class); + } + + public static class CalloutRequestCustomMapperMixin extends CustomCalloutInternalImpl { + + @Override + @JsonSerialize(using = InlineControlSerializer.class) + public OptionalValue ace() { + return super.ace(); + } + + @Override + @JsonSerialize(using = InlineControlSerializer.class) + public OptionalValue ice() { + return super.ice(); + } + + @Override + @JsonSerialize(using = InlineControlSerializer.class) + public OptionalValue pie() { + return super.pie(); + } + } + + static class InlineControlSerializer extends JsonSerializer> { + + public InlineControlSerializer() { + super(); + } + + @Override + public void serialize( + OptionalValue _value, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + + if (!_value.isPresent()) { + return; + } + + Control value = _value.get(); + + ObjectMapper mapper = (ObjectMapper) jgen.getCodec(); + String serialized = null; + if (value instanceof SvamlControl) { + serialized = mapper.writeValueAsString(value); + } + + if (value instanceof com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl) { + com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl url = + (com.sinch.sdk.domains.voice.models.v1.svaml.ControlUrl) value; + serialized = url.getUrl(); + } + + jgen.writeString(serialized); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/DestinationMapper.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/DestinationMapper.java new file mode 100644 index 000000000..f645afbd6 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/adapters/mapper/DestinationMapper.java @@ -0,0 +1,45 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters.mapper; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.sinch.sdk.core.utils.databind.Mapper; +import com.sinch.sdk.domains.voice.models.v1.destination.Destination; +import com.sinch.sdk.domains.voice.models.v1.destination.internal.DestinationInternalImpl; +import java.io.IOException; +import java.util.logging.Logger; + +public class DestinationMapper { + + private static final Logger LOGGER = Logger.getLogger(DestinationMapper.class.getName()); + + public static void initMapper() { + + SimpleModule module = new SimpleModule(); + module.addDeserializer(Destination.class, new DestinationDeserializer()); + Mapper.getInstance().registerModule(module); + } + + static class DestinationDeserializer extends StdDeserializer { + + public DestinationDeserializer() { + this(null); + } + + public DestinationDeserializer(Class vc) { + super(vc); + } + + @Override + public Destination deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + + DestinationInternalImpl read = jp.readValueAs(DestinationInternalImpl.class); + + if (null == read) { + return null; + } + return (Destination) read.getActualInstance(); + } + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/api/v1/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/api/v1/package-info.java new file mode 100644 index 000000000..3aef5315a --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/api/v1/package-info.java @@ -0,0 +1,8 @@ +/** + * Voice API interface V1 + * + * @see https://developers.sinch.com/docs/voice + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.api.v1; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/package-info.java new file mode 100644 index 000000000..8df776093 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Applications + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.applications; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/package-info.java new file mode 100644 index 000000000..7669c3e17 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Applications requests + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.applications.request; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/package-info.java new file mode 100644 index 000000000..d7569a8b9 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Applications responses + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.applications.response; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequest.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequest.java new file mode 100644 index 000000000..e0e9c32cd --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequest.java @@ -0,0 +1,8 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.request; + +/** + * Base class related a Callout request + * + * @since 1.4 + */ +public interface CalloutRequest {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/package-info.java new file mode 100644 index 000000000..22cfbc52b --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Callouts requests + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.callouts.request; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/package-info.java new file mode 100644 index 000000000..d7a301589 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Callouts responses + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.callouts.response; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/CallLeg.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/CallLeg.java new file mode 100644 index 000000000..20f93044d --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/CallLeg.java @@ -0,0 +1,43 @@ +package com.sinch.sdk.domains.voice.models.v1.calls.request; + +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. + * + * @since 1.4 + */ +public class CallLeg extends EnumDynamic { + + public static final CallLeg CALLER = new CallLeg("caller"); + public static final CallLeg CALLEE = new CallLeg("callee"); + public static final CallLeg BOTH = new CallLeg("both"); + + /** */ + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(CallLeg.class, CallLeg::new, Arrays.asList(CALLER, CALLEE, BOTH)); + + private CallLeg(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static CallLeg from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(CallLeg e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/package-info.java new file mode 100644 index 000000000..216dffea0 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/request/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Calls requests + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.calls.request; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationFrom.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationFrom.java new file mode 100644 index 000000000..3c3f413a9 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationFrom.java @@ -0,0 +1,9 @@ +package com.sinch.sdk.domains.voice.models.v1.calls.response; + +/** + * Class related to a From destination for {@link CallInformation#getFrom()} + * + * @see com.sinch.sdk.domains.voice.api.v1.CallsService#get(String) + * @since 1.4 + */ +public interface CallInformationFrom {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationTo.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationTo.java new file mode 100644 index 000000000..232f42482 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationTo.java @@ -0,0 +1,9 @@ +package com.sinch.sdk.domains.voice.models.v1.calls.response; + +/** + * Class related to a To destination for {@link CallInformation#getTo()} + * + * @see com.sinch.sdk.domains.voice.api.v1.CallsService#get(String) + * @since 1.4 + */ +public interface CallInformationTo {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/package-info.java new file mode 100644 index 000000000..6590a5ba4 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Calls responses + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.calls.response; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/package-info.java new file mode 100644 index 000000000..58fb80c60 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Conferences + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.conferences; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/package-info.java new file mode 100644 index 000000000..eaa8f6134 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Conferences requests + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.conferences.request; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/package-info.java new file mode 100644 index 000000000..55d036feb --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice Conferences responses + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.conferences.response; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/Destination.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/Destination.java new file mode 100644 index 000000000..104c98165 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/Destination.java @@ -0,0 +1,8 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +/** + * Base class related to a Destination + * + * @since 1.4 + */ +public interface Destination {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationConference.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationConference.java new file mode 100644 index 000000000..8e3ccf0a4 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationConference.java @@ -0,0 +1,11 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; + +/** + * Base class related to a Conference call destination + * + * @see com.sinch.sdk.domains.voice.api.v1.CalloutsService#conference(CalloutRequestConference) + * @since 1.4 + */ +public interface DestinationConference {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationCustom.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationCustom.java new file mode 100644 index 000000000..7660ba3ef --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationCustom.java @@ -0,0 +1,11 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustom; + +/** + * Base class related to a Custom call destination + * + * @see com.sinch.sdk.domains.voice.api.v1.CalloutsService#custom(CalloutRequestCustom) + * @since 1.4 + */ +public interface DestinationCustom {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTextToSpeech.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTextToSpeech.java new file mode 100644 index 000000000..529858ec5 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTextToSpeech.java @@ -0,0 +1,11 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTS; + +/** + * Base class related to a Text To Speech call destination + * + * @see com.sinch.sdk.domains.voice.api.v1.CalloutsService#textToSpeech(CalloutRequestTTS) + * @since 1.4 + */ +public interface DestinationTextToSpeech {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/package-info.java new file mode 100644 index 000000000..eb44073a9 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/destination/package-info.java @@ -0,0 +1,6 @@ +/** + * Destination related classes + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.destination; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/package-info.java new file mode 100644 index 000000000..08434a4cc --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/package-info.java @@ -0,0 +1,6 @@ +/** + * Voice API interface V1 models + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/Control.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/Control.java new file mode 100644 index 000000000..9b4bfa34a --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/Control.java @@ -0,0 +1,10 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml; + +/** + * Base class related to a control + * + *

Could be a URL or an SVAML control object + * + * @since 1.4 + */ +public interface Control {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/ControlUrl.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/ControlUrl.java new file mode 100644 index 000000000..18619cf43 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/ControlUrl.java @@ -0,0 +1,41 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml; + +/** + * Control URL used during a custom callout + * + * @see Custom + * Callout Description + * @since 1.4 + */ +public class ControlUrl implements 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 + * @since 1.4 + */ + public static ControlUrl from(String URL) { + return new ControlUrl(URL); + } +} 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 new file mode 100644 index 000000000..9bc3bf03c --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactory.java @@ -0,0 +1,61 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +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; + +/** Menu option action factory helper */ +public class MenuOptionActionFactory { + + public static 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); + } + } + + public static String menuAction(String id) { + return build(MenuOptionActionType.MENU, id); + } + + public static String returnAction(String id) { + return build(MenuOptionActionType.RETURN, id); + } + + public static String build(MenuOptionActionType type, String id) { + Objects.requireNonNull(type, "Action type cannot be null"); + return String.format("%s(%s)", type.value(), id); + } +} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlAction.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlAction.java new file mode 100644 index 000000000..024d200cd --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlAction.java @@ -0,0 +1,8 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +/** + * Base class related SVAML actions + * + * @since 1.4 + */ +public interface SvamlAction {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/package-info.java new file mode 100644 index 000000000..015d07d3f --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice SVAML actions + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstruction.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstruction.java new file mode 100644 index 000000000..ed409eb2f --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstruction.java @@ -0,0 +1,8 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +/** + * Base class related SVAML instructions + * + * @since 1.4 + */ +public interface SvamlInstruction {} diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/package-info.java new file mode 100644 index 000000000..fa7d34f26 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice SVAML instructions + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; diff --git a/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/package-info.java b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/package-info.java new file mode 100644 index 000000000..91387c459 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/package-info.java @@ -0,0 +1,6 @@ +/** + * Models related to Voice SVAML + * + * @since 1.4 + */ +package com.sinch.sdk.domains.voice.models.v1.svaml; 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 new file mode 100644 index 000000000..2f6c91da4 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/package-info.java @@ -0,0 +1,6 @@ +/** + * 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/models/adapters/DualToneMultiFrequencyMapper.java b/client/src/main/com/sinch/sdk/models/adapters/DualToneMultiFrequencyMapper.java new file mode 100644 index 000000000..d52a7d96d --- /dev/null +++ b/client/src/main/com/sinch/sdk/models/adapters/DualToneMultiFrequencyMapper.java @@ -0,0 +1,70 @@ +package com.sinch.sdk.models.adapters; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.sinch.sdk.core.utils.databind.Mapper; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.io.IOException; +import java.util.logging.Logger; + +public class DualToneMultiFrequencyMapper { + private static final Logger LOGGER = + Logger.getLogger(DualToneMultiFrequencyMapper.class.getName()); + + public static void initMapper() { + SimpleModule module = + new SimpleModule() + .addSerializer(DualToneMultiFrequency.class, new Serializer()) + .addDeserializer(DualToneMultiFrequency.class, new Deserializer()); + Mapper.getInstance().registerModule(module); + } + + static class Serializer extends StdSerializer { + + public Serializer() { + this(null); + } + + public Serializer(Class t) { + super(t); + } + + @Override + public void serialize( + DualToneMultiFrequency raw, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + if (null == raw) { + // avoid exception + LOGGER.severe("Unexpected type'" + raw + "'"); + return; + } + jgen.writeObject(raw.stringValue()); + } + } + + static final class Deserializer extends StdDeserializer { + + private static final long serialVersionUID = 1L; + + public Deserializer() { + this(DualToneMultiFrequency.class); + } + + public Deserializer(Class vc) { + super(vc); + } + + @Override + public DualToneMultiFrequency deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + String strValue = Mapper.getInstance().readValue(jp, String.class); + return DualToneMultiFrequency.valueOf(strValue); + } + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java index 1e9a275dc..8eb23f545 100644 --- a/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java +++ b/client/src/test/java/com/sinch/sdk/domains/verification/api/v1/adapters/VerificationServiceTest.java @@ -1,5 +1,6 @@ package com.sinch.sdk.domains.verification.api.v1.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; @@ -87,4 +88,16 @@ void doNotAcceptNullVerificationUrl() { () -> new VerificationService(credentials, context, httpClient)); assertTrue(exception.getMessage().contains("verificationUrl")); } + + @Test + void passInit() { + ApplicationCredentials credentials = + ApplicationCredentials.builder() + .setApplicationKey("foo key") + .setApplicationSecret("Zm9vIHNlY3JldA==") + .build(); + + assertDoesNotThrow( + () -> new VerificationService(credentials, context, httpClient), "Init passed"); + } } 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 index 3f74dc1f3..978b263a3 100644 --- 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 @@ -1,29 +1,24 @@ package com.sinch.sdk.domains.voice.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.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.domains.voice.adapters.api.v1.ApplicationsApi; 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.dto.v1.ApplicationsCallbackUrlsDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ApplicationsGetNumbersResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CallbacksDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UnassignNumbersDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UpdateNumbersDto; 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 com.sinch.sdk.models.VoiceContext; -import java.util.Map; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,47 +29,39 @@ @TestWithResources public class ApplicationsServiceTest extends BaseTest { - @Mock ApplicationsApi api; - @Mock VoiceContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; + @Mock com.sinch.sdk.domains.voice.api.v1.ApplicationsService v1; @Captor ArgumentCaptor applicationKeyCaptor; - @Captor ArgumentCaptor callbacksDtoCaptor; - @Captor ArgumentCaptor updateNumbersDtoCaptor; - @Captor ArgumentCaptor unassignNumbersDtoCaptor; + @Captor ArgumentCaptor callbacksDtoCaptor; + @Captor ArgumentCaptor updateNumbersRequestDtoCaptor; + @Captor ArgumentCaptor unAssignNumberRequestDtoCaptor; ApplicationsService service; @BeforeEach public void initMocks() { - service = spy(new ApplicationsService(context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); + service = spy(new ApplicationsService(v1)); } @Test void getNumbers() throws ApiException { - when(api.configurationGetNumbers()).thenReturn(ApplicationsGetNumbersResponseDtoTest.expected); + when(v1.listNumbers()).thenReturn(OwnedNumbersResponseTest.expected); AssignedNumbers response = service.listNumbers(); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(ApplicationsDtoConverterTest.expectedAssignedNumbersResponse); + TestHelpers.recursiveEquals( + response, ApplicationsDtoConverterTest.expectedAssignedNumbersResponse); } @Test void getCallbackUrls() throws ApiException { - - when(api.configurationGetCallbackURLs(eq("app id"))) - .thenReturn(ApplicationsCallbackUrlsDtoTest.expected); + when(v1.getCallbackUrls(eq("app id"))).thenReturn(GetCallbackUrlsResponseTest.expected); CallbackUrls response = service.getCallbackUrls("app id"); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls); + TestHelpers.recursiveEquals( + response, ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls); } @Test @@ -83,18 +70,16 @@ void updateCallbackUrls() { service.updateCallbackUrls( "app key", ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls); - verify(api) - .configurationUpdateCallbackURLs( - applicationKeyCaptor.capture(), callbacksDtoCaptor.capture()); + verify(v1).updateCallbackUrls(applicationKeyCaptor.capture(), callbacksDtoCaptor.capture()); String appKey = applicationKeyCaptor.getValue(); Assertions.assertThat(appKey).isEqualTo("app key"); - CallbacksDto body = callbacksDtoCaptor.getValue(); - Assertions.assertThat(body) - .isEqualTo( - ApplicationsDtoConverter.convert( - ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls)); + Callbacks body = callbacksDtoCaptor.getValue(); + TestHelpers.recursiveEquals( + body, + ApplicationsDtoConverter.convert( + ApplicationsDtoConverterTest.expectedApplicationsCallbackUrls)); } @Test @@ -102,25 +87,24 @@ void updateNumbers() { service.assignNumbers( ApplicationsDtoConverterTest.expectedApplicationsAssignNumbersRequestParameters); - verify(api).configurationUpdateNumbers(updateNumbersDtoCaptor.capture()); + verify(v1).assignNumbers(updateNumbersRequestDtoCaptor.capture()); - UpdateNumbersDto body = updateNumbersDtoCaptor.getValue(); - Assertions.assertThat(body) - .isEqualTo( - ApplicationsDtoConverter.convert( - ApplicationsDtoConverterTest.expectedApplicationsAssignNumbersRequestParameters)); + UpdateNumbersRequest body = updateNumbersRequestDtoCaptor.getValue(); + TestHelpers.recursiveEquals( + body, + ApplicationsDtoConverter.convert( + ApplicationsDtoConverterTest.expectedApplicationsAssignNumbersRequestParameters)); } @Test void unassignNumber() { service.unassignNumber(E164PhoneNumber.valueOf("+12345678"), "application key"); - verify(api).configurationUnassignNumber(unassignNumbersDtoCaptor.capture()); + verify(v1).unassignNumber(unAssignNumberRequestDtoCaptor.capture()); - UnassignNumbersDto body = unassignNumbersDtoCaptor.getValue(); - Assertions.assertThat(body) - .isEqualTo( - ApplicationsDtoConverter.convert( - E164PhoneNumber.valueOf("+12345678"), "application key")); + 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 index 00d21c931..e16426486 100644 --- 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 @@ -1,74 +1,77 @@ package com.sinch.sdk.domains.voice.adapters; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doReturn; +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.exceptions.ApiException; -import com.sinch.sdk.core.http.AuthManager; -import com.sinch.sdk.core.http.HttpClient; -import com.sinch.sdk.domains.voice.adapters.api.v1.CalloutsApi; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutResponseDtoTest; 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.models.VoiceContext; -import java.util.Map; +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 BaseTest { - - @Mock CalloutsApi api; - @Mock VoiceContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; +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(context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); + service = spy(new CalloutsService(v1)); } @Test - void callConference() throws ApiException { + void conference() throws ApiException { - when(api.callouts(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + when(v1.conference(any(CalloutRequestConference.class))) + .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); String response = - service.call(CalloutRequestParametersConferenceTest.conferenceRequestParameters); + 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 callTTS() throws ApiException { + void custom() throws ApiException { - when(api.callouts(eq(CalloutRequestDtoTest.ttsRequestDto))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + when(v1.custom(any(CalloutRequestCustom.class))) + .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - String response = service.call(CalloutRequestParametersTTSTest.ttsRequestParameters); + String response = service.custom(CalloutRequestParametersCustomTest.customRequestParameters); Assertions.assertThat(response) .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); } @Test - void callCustom() throws ApiException { + void call() throws ApiException { - when(api.callouts(eq(CalloutRequestDtoTest.customRequestDto))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + when(v1.call(any(CalloutRequest.class))) + .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); String response = service.call(CalloutRequestParametersCustomTest.customRequestParameters); 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 index 0c902fee3..8f7775a24 100644 --- 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 @@ -1,25 +1,21 @@ package com.sinch.sdk.domains.voice.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.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.domains.voice.adapters.api.v1.CallsApi; import com.sinch.sdk.domains.voice.adapters.converters.CallsDtoConverterTest; import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.dto.v1.CallsResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.SVAMLRequestBodyDto; import com.sinch.sdk.domains.voice.models.response.CallInformation; import com.sinch.sdk.domains.voice.models.svaml.SVAMLControlTest; -import com.sinch.sdk.models.VoiceContext; -import java.util.Map; +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; @@ -30,49 +26,40 @@ @TestWithResources public class CallsServiceTest extends BaseTest { - @Mock CallsApi api; - @Mock VoiceContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; + @Mock com.sinch.sdk.domains.voice.api.v1.CallsService v1; @Captor ArgumentCaptor callIdCaptor; - @Captor ArgumentCaptor callLegCaptor; - @Captor ArgumentCaptor updateParametersCaptor; + @Captor ArgumentCaptor callLegCaptor; + @Captor ArgumentCaptor updateParametersCaptor; CallsService service; @BeforeEach public void initMocks() { - service = spy(new CallsService(context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); + service = spy(new CallsService(v1)); } @Test void get() throws ApiException { - - when(api.callingGetCallResult( - eq(CallsResponseDtoTest.expectedCallsGetInformationResponseDto.getCallId()))) - .thenReturn(CallsResponseDtoTest.expectedCallsGetInformationResponseDto); + when(v1.get(eq(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()))) + .thenReturn(CallInformationTest.expectedCallsGetInformationResponseDto); CallInformation response = - service.get(CallsResponseDtoTest.expectedCallsGetInformationResponseDto.getCallId()); + service.get(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(CallsDtoConverterTest.expectedCallInformation); + TestHelpers.recursiveEquals(response, CallsDtoConverterTest.expectedCallInformation); } @Test void update() throws ApiException { - service.update("call id", SVAMLControlTest.parameters); - verify(api).callingUpdateCall(callIdCaptor.capture(), updateParametersCaptor.capture()); + verify(v1).update(callIdCaptor.capture(), updateParametersCaptor.capture()); String callId = callIdCaptor.getValue(); Assertions.assertThat(callId).isEqualTo("call id"); - SVAMLRequestBodyDto body = updateParametersCaptor.getValue(); - Assertions.assertThat(body).isEqualTo(CallsDtoConverterTest.svamlRequestBodyDto); + SvamlControl body = updateParametersCaptor.getValue(); + TestHelpers.recursiveEquals(body, CallsDtoConverterTest.svamlControlDto); } @Test @@ -80,17 +67,17 @@ void manageWithCallLeg() throws ApiException { service.manageWithCallLeg("call id", CallLegType.BOTH, SVAMLControlTest.parameters); - verify(api) - .callingManageCallWithCallLeg( + verify(v1) + .manageWithCallLeg( callIdCaptor.capture(), callLegCaptor.capture(), updateParametersCaptor.capture()); String callId = callIdCaptor.getValue(); Assertions.assertThat(callId).isEqualTo("call id"); - String legType = callLegCaptor.getValue(); - Assertions.assertThat(legType).isEqualTo("both"); + CallLeg legType = callLegCaptor.getValue(); + Assertions.assertThat(legType).isEqualTo(CallLeg.BOTH); - SVAMLRequestBodyDto body = updateParametersCaptor.getValue(); - Assertions.assertThat(body).isEqualTo(CallsDtoConverterTest.svamlRequestBodyDto); + 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 index 3df744174..acde2ff1c 100644 --- 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 @@ -1,29 +1,24 @@ package com.sinch.sdk.domains.voice.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.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.domains.voice.adapters.api.v1.ConferencesApi; import com.sinch.sdk.domains.voice.adapters.converters.ConferencesDtoConverterTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferencesRequestDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferencesResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ManageConferenceParticipantRequestDto; 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.models.VoiceContext; +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 java.util.Map; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,27 +29,23 @@ @TestWithResources public class ConferencesServiceTest extends BaseTest { - @Mock ConferencesApi api; - @Mock VoiceContext context; - @Mock HttpClient httpClient; - @Mock Map authManagers; + @Mock com.sinch.sdk.domains.voice.api.v1.ConferencesService v1; @Captor ArgumentCaptor conferenceIdCaptor; @Captor ArgumentCaptor callIdCaptor; - @Captor ArgumentCaptor participantCaptor; + @Captor ArgumentCaptor participantCaptor; ConferencesService service; @BeforeEach public void initMocks() { - service = spy(new ConferencesService(context, httpClient, authManagers)); - doReturn(api).when(service).getApi(); + service = spy(new ConferencesService(v1)); } @Test void call() throws ApiException { - when(api.callouts(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto))) - .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + when(v1.call(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto))) + .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); String response = service.call(CalloutRequestParametersConferenceTest.conferenceRequestParameters); @@ -66,83 +57,63 @@ void call() throws ApiException { @Test void get() throws ApiException { - when(api.callingGetConferenceInfo( - eq( - CalloutRequestDtoTest.conferenceRequestCalloutDto - .getConferenceCallout() - .getConferenceId()))) + when(v1.get(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()))) .thenReturn(ConferencesResponseDtoTest.expectedGetConferenceInfoResponseDto); Collection response = - service.get( - CalloutRequestDtoTest.conferenceRequestCalloutDto - .getConferenceCallout() - .getConferenceId()); + service.get(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - Assertions.assertThat(response) - .usingRecursiveComparison() - .isEqualTo(ConferencesDtoConverterTest.expectedConferenceGetInfoResponse); + TestHelpers.recursiveEquals( + response, ConferencesDtoConverterTest.expectedConferenceGetInfoResponse); } @Test void kickParticipant() throws ApiException { - service.kickParticipant( - CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceCallout().getConferenceId(), + CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); - verify(api) - .callingKickConferenceParticipant(callIdCaptor.capture(), conferenceIdCaptor.capture()); + 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 - .getConferenceCallout() - .getConferenceId()); + .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); } @Test void kickAll() throws ApiException { - service.kickAll( - CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceCallout().getConferenceId()); - verify(api).callingKickConferenceAll(conferenceIdCaptor.capture()); + service.kickAll(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); + verify(v1).kickAll(conferenceIdCaptor.capture()); String parameter = conferenceIdCaptor.getValue(); Assertions.assertThat(parameter) - .isEqualTo( - CalloutRequestDtoTest.conferenceRequestCalloutDto - .getConferenceCallout() - .getConferenceId()); + .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); } @Test void manageParticipant() throws ApiException { service.manageParticipant( - CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceCallout().getConferenceId(), + CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId(), ConferenceManageParticipantRequestParametersTest .conferenceManageParticipantRequestParameters); - verify(api) - .callingManageConferenceParticipant( - callIdCaptor.capture(), conferenceIdCaptor.capture(), participantCaptor.capture()); + 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 - .getConferenceCallout() - .getConferenceId()); + .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); - ManageConferenceParticipantRequestDto participant = participantCaptor.getValue(); + 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 index 9b565c63f..0af9f3e41 100644 --- 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 @@ -1,5 +1,6 @@ package com.sinch.sdk.domains.voice.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; @@ -13,9 +14,10 @@ class VoiceServiceTest { @Mock HttpClient httpClient; + VoiceContext context = VoiceContext.builder().build(); + @Test void doNotAcceptNullApplicationCredentials() { - VoiceContext context = VoiceContext.builder().build(); Exception exception = assertThrows(NullPointerException.class, () -> new VoiceService(null, context, httpClient)); @@ -40,7 +42,6 @@ void doNotAcceptNullApplicationKey() { .setApplicationKey(null) .setApplicationSecret("foo secret") .build(); - VoiceContext context = VoiceContext.builder().build(); Exception exception = assertThrows( @@ -57,7 +58,6 @@ void doNotAcceptNullApplicationSecret() { .setApplicationKey("foo key") .setApplicationSecret(null) .build(); - VoiceContext context = VoiceContext.builder().build(); Exception exception = assertThrows( @@ -66,4 +66,15 @@ void doNotAcceptNullApplicationSecret() { assertTrue(exception.getMessage().contains("applicationSecret")); } + + @Test + void passInit() { + ApplicationCredentials credentials = + ApplicationCredentials.builder() + .setApplicationKey("foo key") + .setApplicationSecret("Zm9vIHNlY3JldA==") + .build(); + + assertDoesNotThrow(() -> new VoiceService(credentials, context, httpClient), "Init passed"); + } } 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 index 4ea9d1320..55a560f00 100644 --- 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 @@ -2,6 +2,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.voice.models.ApplicationAssignedNumber; import com.sinch.sdk.domains.voice.models.ApplicationURL; import com.sinch.sdk.domains.voice.models.CallbackUrls; @@ -9,17 +10,16 @@ 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.dto.v1.ApplicationsCallbackUrlsDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ApplicationsGetNumbersResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ApplicationsQueryNumberResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ApplicationsUnassignNumberRequestDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ApplicationsUpdateNumberRequestDtoTest; 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.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @TestWithResources @@ -68,48 +68,43 @@ public class ApplicationsDtoConverterTest extends BaseTest { @Test void convertGetApplicationsNumbersResponseDto() { - Assertions.assertThat( - ApplicationsDtoConverter.convert(ApplicationsGetNumbersResponseDtoTest.expected)) - .usingRecursiveComparison() - .isEqualTo(expectedAssignedNumbersResponse); + TestHelpers.recursiveEquals( + ApplicationsDtoConverter.convert(OwnedNumbersResponseTest.expected), + expectedAssignedNumbersResponse); } @Test void convertCallbackUrlsResponseDto() { - Assertions.assertThat( - ApplicationsDtoConverter.convert(ApplicationsCallbackUrlsDtoTest.expected)) - .usingRecursiveComparison() - .isEqualTo(expectedApplicationsCallbackUrls); + TestHelpers.recursiveEquals( + ApplicationsDtoConverter.convert(UpdateCallbackUrlsRequestTest.expected), + expectedApplicationsCallbackUrls); } @Test void convertCallbackUrlsRequestDto() { - Assertions.assertThat(ApplicationsDtoConverter.convert(expectedApplicationsCallbackUrls)) - .usingRecursiveComparison() - .isEqualTo(ApplicationsCallbackUrlsDtoTest.expected); + TestHelpers.recursiveEquals( + ApplicationsDtoConverter.convert(expectedApplicationsCallbackUrls), + UpdateCallbackUrlsRequestTest.expected); } @Test void convertGetQueryNumberDto() { - Assertions.assertThat( - ApplicationsDtoConverter.convert(ApplicationsQueryNumberResponseDtoTest.expected)) - .usingRecursiveComparison() - .isEqualTo(expectedApplicationsNumberInformation); + TestHelpers.recursiveEquals( + ApplicationsDtoConverter.convert(QueryNumberResponseTest.expected), + expectedApplicationsNumberInformation); } @Test void convertApplicationsUpdateNumberRequestParameters() { - Assertions.assertThat( - ApplicationsDtoConverter.convert(expectedApplicationsAssignNumbersRequestParameters)) - .usingRecursiveComparison() - .isEqualTo(ApplicationsUpdateNumberRequestDtoTest.updateNumbersDto); + TestHelpers.recursiveEquals( + ApplicationsDtoConverter.convert(expectedApplicationsAssignNumbersRequestParameters), + UpdateNumbersRequestTest.updateNumbersDto); } @Test - void convertUnassignNumbersDto() { - Assertions.assertThat( - ApplicationsDtoConverter.convert(E164PhoneNumber.valueOf("+12073091712"), "an app key")) - .usingRecursiveComparison() - .isEqualTo(ApplicationsUnassignNumberRequestDtoTest.unassignNumberDto); + 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 index e944594af..c9e6d940b 100644 --- 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 @@ -2,10 +2,10 @@ import com.adelean.inject.resources.junit.jupiter.TestWithResources; import com.sinch.sdk.BaseTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDtoTest; 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 org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; 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 index b9aaa2317..078233685 100644 --- 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 @@ -2,24 +2,22 @@ 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.dto.svaml.ActionConnectConfDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionAnswerDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.CallsResponseDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.SVAMLRequestBodyDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionDto; 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.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @TestWithResources @@ -41,26 +39,24 @@ public class CallsDtoConverterTest extends BaseTest { .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.5274F).build()) .build(); - public static SVAMLRequestBodyDto svamlRequestBodyDto = - new SVAMLRequestBodyDto() - .action(new SvamlActionDto(ActionConnectConfDtoTest.dto)) - .instructions( - Collections.singletonList(new SvamlInstructionDto(InstructionAnswerDtoTest.dto))); + public static SvamlControl svamlControlDto = + SvamlControl.builder() + .setAction(SvamlActionConnectConferenceTest.dto) + .setInstructions(Collections.singletonList(SvamlInstructionAnswerTest.dto)) + .build(); @Test void convertCallInformation() { - Assertions.assertThat( - CallsDtoConverter.convert(CallsResponseDtoTest.expectedCallsGetInformationResponseDto)) - .usingRecursiveComparison() - .isEqualTo(expectedCallInformation); + TestHelpers.recursiveEquals( + CallsDtoConverter.convert(CallInformationTest.expectedCallsGetInformationResponseDto), + expectedCallInformation); } @Test void convertCallsUpdateRequestParameters() { - Assertions.assertThat(svamlRequestBodyDto) - .usingRecursiveComparison() - .isEqualTo(CallsDtoConverter.convert(SVAMLControlTest.parameters)); + 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 index ca5b957b1..9a68fc154 100644 --- 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 @@ -1,9 +1,10 @@ package com.sinch.sdk.domains.voice.adapters.converters; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferencesRequestDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.ConferencesResponseDtoTest; 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; @@ -12,14 +13,15 @@ public class ConferencesDtoConverterTest { public static Collection expectedConferenceGetInfoResponse = - Collections.singletonList( - ConferenceParticipant.builder() - .setCli("a cli") - .setId("an id") - .setDuration(5) - .setMuted(true) - .setOnhold(false) - .build()); + new ArrayList<>( + Collections.singletonList( + ConferenceParticipant.builder() + .setCli("a cli") + .setId("an id") + .setDuration(5) + .setMuted(true) + .setOnhold(false) + .build())); @Test void convertGetConferenceInfoResponseDto() { 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 index 054003e2a..8375d02b1 100644 --- 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 @@ -1,5 +1,6 @@ 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; @@ -7,15 +8,6 @@ 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.dto.svaml.ActionConnectConfDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionConnectMxpDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionConnectPstnDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionConnectSipDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionContinueDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionHangUpDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionParkDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.ActionRunMenuDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionDto; 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; @@ -30,10 +22,17 @@ 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.SvamlActionConnectConferenceTest; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectMxpTest; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstnTest; +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.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; public class SVAMLActionDtoConverterTest { @@ -121,57 +120,50 @@ public class SVAMLActionDtoConverterTest { @Test void convertActionConnectConf() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionConnectConference)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionConnectConfDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionConnectConference), + SvamlActionConnectConferenceTest.dto); } @Test void convertActionConnectMxp() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionConnectMxp)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionConnectMxpDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionConnectMxp), SvamlActionConnectMxpTest.dto); } @Test void convertActionConnectPstn() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionConnectPstn)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionConnectPstnDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionConnectPstn), SvamlActionConnectPstnTest.dto); } @Test void convertActionConnectSip() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionConnectSip)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionConnectSipDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionConnectSip), SvamlActionConnectSipTest.dto); } @Test void convertActionContinue() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionContinue)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionContinueDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionContinue), SvamlActionContinueTest.dto); } @Test void convertActionHangup() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionHanghup)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionHangUpDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionHanghup), SvamlActionHangupTest.dto); } @Test void convertActionPark() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionPark)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionParkDtoTest.dto)); + TestHelpers.recursiveEquals( + SVAMLActionDtoConverter.convert(actionPark), SvamlActionParkTest.dto); } @Test void convertActionRunMenu() { - Assertions.assertThat(SVAMLActionDtoConverter.convert(actionRunMenu)) - .usingRecursiveComparison() - .isEqualTo(new SvamlActionDto(ActionRunMenuDtoTest.dto)); + 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 index 3dfe12578..401600fcf 100644 --- 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 @@ -1,13 +1,6 @@ package com.sinch.sdk.domains.voice.adapters.converters; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionAnswerDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionPlayFilesDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionSayDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionSendDtfmDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionSetCookieDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionStartRecordingDtoTest; -import com.sinch.sdk.domains.voice.models.dto.svaml.InstructionStopRecordingDtoTest; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionDto; +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; @@ -17,9 +10,16 @@ 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.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; public class SVAMLInstructionDtoConverterTest { @@ -58,67 +58,50 @@ public class SVAMLInstructionDtoConverterTest { @Test void convertInstructionAnswer() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionAnswer))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList(new SvamlInstructionDto(InstructionAnswerDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionAnswer)), + new ArrayList<>(Collections.singletonList(SvamlInstructionAnswerTest.dto))); } @Test void convertInstructionPlayFiles() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionPlayFiles))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList(new SvamlInstructionDto(InstructionPlayFilesDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionPlayFiles)), + new ArrayList<>(Collections.singletonList(SvamlInstructionPlayFilesTest.dto))); } @Test void convertInstructionSay() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSay))) - .usingRecursiveComparison() - .isEqualTo(Collections.singletonList(new SvamlInstructionDto(InstructionSayDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSay)), + new ArrayList<>(Collections.singletonList(SvamlInstructionSayTest.dto))); } @Test void convertInstructionSendDtfm() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionDtfm))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList(new SvamlInstructionDto(InstructionSendDtfmDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionDtfm)), + new ArrayList<>(Collections.singletonList(SvamlInstructionSendDtmfDtoTest.dto))); } @Test void convertInstructionSetCookie() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSetCookie))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList(new SvamlInstructionDto(InstructionSetCookieDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionSetCookie)), + new ArrayList<>(Collections.singletonList(SvamlInstructionSetCookieTest.dto))); } @Test void convertInstructionStartRecording() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert( - Collections.singletonList(instructionStartRecording))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList( - new SvamlInstructionDto(InstructionStartRecordingDtoTest.dto))); + TestHelpers.recursiveEquals( + SVAMLInstructionDtoConverter.convert(Collections.singletonList(instructionStartRecording)), + new ArrayList<>(Collections.singletonList(SvamlInstructionStartRecordingTest.dto))); } @Test void convertInstructionStopRecording() { - Assertions.assertThat( - SVAMLInstructionDtoConverter.convert( - Collections.singletonList(instructionStopRecording))) - .usingRecursiveComparison() - .isEqualTo( - Collections.singletonList( - new SvamlInstructionDto(InstructionStopRecordingDtoTest.dto))); + 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 index e9bbac2d4..8cb1abf7f 100644 --- 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 @@ -2,13 +2,14 @@ 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.dto.v1.WebhooksEventDtoTest; +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; @@ -22,7 +23,6 @@ import com.sinch.sdk.domains.voice.models.webhooks.PromptInputEvent; import java.time.Instant; import java.util.Collections; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @TestWithResources @@ -102,45 +102,40 @@ public class WebhooksEventDtoConverterTest extends BaseTest { @Test void convertIncomingCallRequest() { - Assertions.assertThat( - WebhooksEventDtoConverter.convert(WebhooksEventDtoTest.expectedIceRequestDto)) - .usingRecursiveComparison() - .isEqualTo(expectedIncomingCallEvent); + TestHelpers.recursiveEquals( + WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedIceRequestDto), + expectedIncomingCallEvent); } @Test void convertDisconnectCallRequest() { - Assertions.assertThat( - WebhooksEventDtoConverter.convert(WebhooksEventDtoTest.expectedDiceRequestDto)) - .usingRecursiveComparison() - .isEqualTo(expectedDisconnectCallEvent); + TestHelpers.recursiveEquals( + WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedDiceRequestDto), + expectedDisconnectCallEvent); } @Test void convertAnsweredCallEvent() { - Assertions.assertThat( - WebhooksEventDtoConverter.convert(WebhooksEventDtoTest.expectedAceRequestDto)) - .usingRecursiveComparison() - .isEqualTo(expectedAnsweredCallEvent); + TestHelpers.recursiveEquals( + WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedAceRequestDto), + expectedAnsweredCallEvent); } @Test void convertPieEvent() { - Assertions.assertThat( - WebhooksEventDtoConverter.convert(WebhooksEventDtoTest.expectedPieRequestDto)) - .usingRecursiveComparison() - .isEqualTo(expectedPromptInputEvent); + TestHelpers.recursiveEquals( + WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedPieRequestDto), + expectedPromptInputEvent); } @Test void convertNotifyEvent() { - Assertions.assertThat( - WebhooksEventDtoConverter.convert(WebhooksEventDtoTest.expectedNotifyRequestDto)) - .usingRecursiveComparison() - .isEqualTo(expectedNotifyEvent); + TestHelpers.recursiveEquals( + WebhooksEventDtoConverter.convert(VoiceWebhookEventTest.expectedNotifyRequestDto), + expectedNotifyEvent); } } diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsServiceTest.java new file mode 100644 index 000000000..86365d09d --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ApplicationsServiceTest.java @@ -0,0 +1,113 @@ +package com.sinch.sdk.domains.voice.api.v1.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.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.domains.voice.api.v1.internal.ApplicationsApi; +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.UnAssignNumberRequestTest; +import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateCallbackUrlsRequestTest; +import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest; +import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequestTest; +import com.sinch.sdk.domains.voice.models.v1.applications.response.GetCallbackUrlsResponseTest; +import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponse; +import com.sinch.sdk.domains.voice.models.v1.applications.response.OwnedNumbersResponseTest; +import com.sinch.sdk.models.VoiceContext; +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 ApplicationsServiceTest extends BaseTest { + + @Mock ApplicationsApi api; + @Mock VoiceContext context; + @Mock HttpClient httpClient; + @Mock Map authManagers; + + @Captor ArgumentCaptor applicationKeyCaptor; + @Captor ArgumentCaptor callbacksDtoCaptor; + @Captor ArgumentCaptor updateNumbersDtoCaptor; + @Captor ArgumentCaptor unassignNumbersDtoCaptor; + + com.sinch.sdk.domains.voice.api.v1.adapters.ApplicationsService service; + + @BeforeEach + public void initMocks() { + service = spy(new ApplicationsService(context, httpClient, authManagers)); + doReturn(api).when(service).getApi(); + } + + @Test + void getNumbers() throws ApiException { + + when(api.configurationGetNumbers()).thenReturn(OwnedNumbersResponseTest.expected); + + OwnedNumbersResponse response = service.listNumbers(); + + TestHelpers.recursiveEquals(response, OwnedNumbersResponseTest.expected); + } + + @Test + void getCallbackUrls() throws ApiException { + + when(api.configurationGetCallbackURLs(eq("app id"))) + .thenReturn(GetCallbackUrlsResponseTest.expected); + + Callbacks response = service.getCallbackUrls("app id"); + + TestHelpers.recursiveEquals(response, GetCallbackUrlsResponseTest.expected); + } + + @Test + void updateCallbackUrls() { + + service.updateCallbackUrls("app key", UpdateCallbackUrlsRequestTest.expected); + + verify(api) + .configurationUpdateCallbackURLs( + applicationKeyCaptor.capture(), callbacksDtoCaptor.capture()); + + String appKey = applicationKeyCaptor.getValue(); + Assertions.assertThat(appKey).isEqualTo("app key"); + + Callbacks body = callbacksDtoCaptor.getValue(); + TestHelpers.recursiveEquals(body, UpdateCallbackUrlsRequestTest.expected); + } + + @Test + void updateNumbers() { + + service.assignNumbers(UpdateNumbersRequestTest.updateNumbersDto); + + verify(api).configurationUpdateNumbers(updateNumbersDtoCaptor.capture()); + + UpdateNumbersRequest body = updateNumbersDtoCaptor.getValue(); + TestHelpers.recursiveEquals(body, UpdateNumbersRequestTest.updateNumbersDto); + } + + @Test + void unassignNumber() { + + service.unassignNumber(UnAssignNumberRequestTest.unAssignNumberDto); + + verify(api).configurationUnassignNumber(unassignNumbersDtoCaptor.capture()); + + UnAssignNumberRequest body = unassignNumbersDtoCaptor.getValue(); + TestHelpers.recursiveEquals(body, UnAssignNumberRequestTest.unAssignNumberDto); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsServiceTest.java new file mode 100644 index 000000000..f94b3a37b --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CalloutsServiceTest.java @@ -0,0 +1,95 @@ +package com.sinch.sdk.domains.voice.api.v1.adapters; + +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.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.voice.api.v1.internal.CalloutsApi; +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.callouts.request.internal.CalloutRequestInternalImpl; +import com.sinch.sdk.models.VoiceContext; +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 +public class CalloutsServiceTest extends BaseTest { + + @Mock CalloutsApi api; + @Mock VoiceContext context; + @Mock HttpClient httpClient; + @Mock Map authManagers; + + CalloutsService service; + + @BeforeEach + public void initMocks() { + service = spy(new CalloutsService(context, httpClient, authManagers)); + doReturn(api).when(service).getApi(); + } + + @Test + void conference() throws ApiException { + + CalloutRequestInternalImpl request = new CalloutRequestInternalImpl(); + request.setActualInstance(CalloutRequestDtoTest.conferenceRequestCalloutDto); + + when(api.callouts(eq(request))).thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + + String response = service.conference(CalloutRequestDtoTest.conferenceRequestCalloutDto); + + Assertions.assertThat(response) + .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + } + + @Test + void textToSpeech() throws ApiException { + + CalloutRequestInternalImpl request = new CalloutRequestInternalImpl(); + request.setActualInstance(CalloutRequestDtoTest.ttsRequestDto); + + when(api.callouts(eq(request))).thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + + String response = service.textToSpeech(CalloutRequestDtoTest.ttsRequestDto); + + Assertions.assertThat(response) + .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + } + + @Test + void custom() throws ApiException { + + CalloutRequestInternalImpl request = new CalloutRequestInternalImpl(); + request.setActualInstance(CalloutRequestDtoTest.customRequestDto); + + when(api.callouts(eq(request))).thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + + String response = service.custom(CalloutRequestDtoTest.customRequestDto); + + Assertions.assertThat(response) + .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + } + + @Test + void call() throws ApiException { + + CalloutRequestInternalImpl request = new CalloutRequestInternalImpl(); + request.setActualInstance(CalloutRequestDtoTest.customRequestDto); + + when(api.callouts(eq(request))).thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto); + + String response = service.call(CalloutRequestDtoTest.customRequestDto); + + Assertions.assertThat(response) + .isEqualTo(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CallsServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CallsServiceTest.java new file mode 100644 index 000000000..26789b984 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/CallsServiceTest.java @@ -0,0 +1,93 @@ +package com.sinch.sdk.domains.voice.api.v1.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.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.domains.voice.api.v1.internal.CallsApi; +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.calls.response.CallInformation; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControlTest; +import com.sinch.sdk.models.VoiceContext; +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 CallsServiceTest extends BaseTest { + + @Mock CallsApi api; + @Mock VoiceContext context; + @Mock HttpClient httpClient; + @Mock Map authManagers; + + @Captor ArgumentCaptor callIdCaptor; + @Captor ArgumentCaptor callLegCaptor; + @Captor ArgumentCaptor updateParametersCaptor; + CallsService service; + + @BeforeEach + public void initMocks() { + service = spy(new CallsService(context, httpClient, authManagers)); + doReturn(api).when(service).getApi(); + } + + @Test + void get() throws ApiException { + when(api.callingGetCallResult( + eq(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()))) + .thenReturn(CallInformationTest.expectedCallsGetInformationResponseDto); + + CallInformation response = + service.get(CallInformationTest.expectedCallsGetInformationResponseDto.getCallId()); + + TestHelpers.recursiveEquals( + response, CallInformationTest.expectedCallsGetInformationResponseDto); + } + + @Test + void update() throws ApiException { + service.update("call id", SvamlControlTest.expectedSvamlControl); + + verify(api).callingUpdateCall(callIdCaptor.capture(), updateParametersCaptor.capture()); + + String callId = callIdCaptor.getValue(); + Assertions.assertThat(callId).isEqualTo("call id"); + + SvamlControl body = updateParametersCaptor.getValue(); + TestHelpers.recursiveEquals(body, SvamlControlTest.expectedSvamlControl); + } + + @Test + void manageWithCallLeg() throws ApiException { + + service.manageWithCallLeg("call id", CallLeg.BOTH, SvamlControlTest.expectedSvamlControl); + + verify(api) + .callingManageCallWithCallLeg( + callIdCaptor.capture(), callLegCaptor.capture(), updateParametersCaptor.capture()); + + String callId = callIdCaptor.getValue(); + Assertions.assertThat(callId).isEqualTo("call id"); + + String legType = callLegCaptor.getValue(); + Assertions.assertThat(legType).isEqualTo("both"); + + SvamlControl body = updateParametersCaptor.getValue(); + TestHelpers.recursiveEquals(body, SvamlControlTest.expectedSvamlControl); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesServiceTest.java new file mode 100644 index 000000000..4196b3352 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/ConferencesServiceTest.java @@ -0,0 +1,130 @@ +package com.sinch.sdk.domains.voice.api.v1.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.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.domains.voice.api.v1.internal.ConferencesApi; +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 com.sinch.sdk.domains.voice.models.v1.conferences.response.GetConferenceInfoResponse; +import com.sinch.sdk.models.VoiceContext; +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 ConferencesServiceTest extends BaseTest { + + @Mock ConferencesApi api; + @Mock VoiceContext context; + @Mock HttpClient httpClient; + @Mock Map authManagers; + @Mock CalloutsService calloutsService; + @Captor ArgumentCaptor conferenceIdCaptor; + @Captor ArgumentCaptor callIdCaptor; + @Captor ArgumentCaptor participantCaptor; + static ConferencesService service; + + @BeforeEach + public void initMocks() { + service = spy(new ConferencesService(context, httpClient, authManagers, calloutsService)); + } + + @Test + void call() throws ApiException { + + when(calloutsService.conference(eq(CalloutRequestDtoTest.conferenceRequestCalloutDto))) + .thenReturn(CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + + String response = service.call(CalloutRequestDtoTest.conferenceRequestCalloutDto); + + TestHelpers.recursiveEquals( + response, CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + } + + @Test + void get() throws ApiException { + doReturn(api).when(service).getApi(); + + when(api.callingGetConferenceInfo( + eq(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()))) + .thenReturn(ConferencesResponseDtoTest.expectedGetConferenceInfoResponseDto); + + GetConferenceInfoResponse response = + service.get(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); + + TestHelpers.recursiveEquals( + response, ConferencesResponseDtoTest.expectedGetConferenceInfoResponseDto); + } + + @Test + void kickParticipant() throws ApiException { + doReturn(api).when(service).getApi(); + service.kickParticipant( + CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), + CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId()); + verify(api) + .callingKickConferenceParticipant(callIdCaptor.capture(), conferenceIdCaptor.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 { + doReturn(api).when(service).getApi(); + + service.kickAll(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); + verify(api).callingKickConferenceAll(conferenceIdCaptor.capture()); + + String parameter = conferenceIdCaptor.getValue(); + Assertions.assertThat(parameter) + .isEqualTo(CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId()); + } + + @Test + void manageParticipant() throws ApiException { + + doReturn(api).when(service).getApi(); + + service.manageParticipant( + CalloutRequestDtoTest.conferenceRequestCalloutDto.getConferenceId(), + CalloutResponseDtoTest.expectedCalloutResponseDto.getCallId(), + ConferencesRequestDtoTest.manageConferenceParticipantRequestDto); + + verify(api) + .callingManageConferenceParticipant( + callIdCaptor.capture(), conferenceIdCaptor.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/api/v1/adapters/VoiceServiceTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/VoiceServiceTest.java new file mode 100644 index 000000000..c1e7c4bac --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/api/v1/adapters/VoiceServiceTest.java @@ -0,0 +1,69 @@ +package com.sinch.sdk.domains.voice.api.v1.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.models.ApplicationCredentials; +import com.sinch.sdk.models.VoiceContext; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; + +class VoiceServiceTest { + + @Mock HttpClient httpClient; + + @Test + void doNotAcceptNullApplicationCredentials() { + VoiceContext context = VoiceContext.builder().build(); + Exception exception = + assertThrows(NullPointerException.class, () -> new VoiceService(null, context, httpClient)); + + assertTrue(exception.getMessage().contains("Credentials must be defined")); + } + + @Test + void doNotAcceptNullContext() { + ApplicationCredentials credentials = ApplicationCredentials.builder().build(); + + Exception exception = + assertThrows( + NullPointerException.class, () -> new VoiceService(credentials, null, httpClient)); + + assertTrue(exception.getMessage().contains("Context must be defined")); + } + + @Test + void doNotAcceptNullApplicationKey() { + ApplicationCredentials credentials = + ApplicationCredentials.builder() + .setApplicationKey(null) + .setApplicationSecret("foo secret") + .build(); + VoiceContext context = VoiceContext.builder().build(); + + Exception exception = + assertThrows( + IllegalArgumentException.class, + () -> new VoiceService(credentials, context, httpClient)); + + assertTrue(exception.getMessage().contains("applicationKey")); + } + + @Test + void doNotAcceptNullApplicationSecret() { + ApplicationCredentials credentials = + ApplicationCredentials.builder() + .setApplicationKey("foo key") + .setApplicationSecret(null) + .build(); + VoiceContext context = VoiceContext.builder().build(); + + Exception exception = + assertThrows( + IllegalArgumentException.class, + () -> new VoiceService(credentials, context, httpClient)); + + assertTrue(exception.getMessage().contains("applicationSecret")); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactoryTest.java b/client/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactoryTest.java new file mode 100644 index 000000000..e257d8ebe --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionActionFactoryTest.java @@ -0,0 +1,46 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.action; + +import static org.junit.jupiter.api.Assertions.*; + +import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory.MenuOptionActionType; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class MenuOptionActionFactoryTest { + + @Test + void buildMenu() { + String value = MenuOptionActionFactory.build(MenuOptionActionType.MENU, "my value"); + Assertions.assertEquals(value, "menu(my value)"); + } + + @Test + void buildReturn() { + String value = MenuOptionActionFactory.build(MenuOptionActionType.RETURN, "my value"); + Assertions.assertEquals(value, "return(my value)"); + } + + @Test + void menuAction() { + String value = MenuOptionActionFactory.menuAction("my value"); + Assertions.assertEquals(value, "menu(my value)"); + } + + @Test + void returnAction() { + String value = MenuOptionActionFactory.returnAction("my value"); + Assertions.assertEquals(value, "return(my value)"); + } + + @Test + void actionRequired() { + + Exception thrown = + Assertions.assertThrows( + Exception.class, + () -> MenuOptionActionFactory.build(null, "my value"), + "Expected build() to throw, but it didn't"); + + Assertions.assertEquals(thrown.getMessage(), "Action type cannot be null"); + } +} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConversationIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConversationIT.java index e801e5119..f865e2159 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConversationIT.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/ConversationIT.java @@ -1,10 +1,16 @@ package com.sinch.sdk.e2e.domains.conversation; +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("Conversation V1") @IncludeEngines("cucumber") @SelectClasspathResource("features/conversation") +@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.sinch.sdk.e2e.domains.conversation") public class ConversationIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/VoiceIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/VoiceIT.java deleted file mode 100644 index 176ca6816..000000000 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/VoiceIT.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.sinch.sdk.e2e.domains.voice; - -import org.junit.platform.suite.api.IncludeEngines; -import org.junit.platform.suite.api.SelectClasspathResource; -import org.junit.platform.suite.api.Suite; - -@Suite -@IncludeEngines("cucumber") -@SelectClasspathResource("features/voice") -public class VoiceIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/ApplicationsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java similarity index 99% rename from client/src/test/java/com/sinch/sdk/e2e/domains/voice/ApplicationsSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java index b7d3a2cd6..0995eaa21 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/ApplicationsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ApplicationsSteps.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.e2e.domains.voice; +package com.sinch.sdk.e2e.domains.voice.v0; import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.voice.ApplicationsService; diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/CalloutsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java similarity index 99% rename from client/src/test/java/com/sinch/sdk/e2e/domains/voice/CalloutsSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java index 0d67b1cd0..31b6ce12d 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/CalloutsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CalloutsSteps.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.e2e.domains.voice; +package com.sinch.sdk.e2e.domains.voice.v0; import com.sinch.sdk.domains.voice.CalloutsService; import com.sinch.sdk.domains.voice.models.DestinationNumber; diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/CallsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java similarity index 99% rename from client/src/test/java/com/sinch/sdk/e2e/domains/voice/CallsSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java index e8d3ef0e0..ecdeabbb1 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/CallsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/CallsSteps.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.e2e.domains.voice; +package com.sinch.sdk.e2e.domains.voice.v0; import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.core.exceptions.ApiException; diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/ConferenceSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java similarity index 99% rename from client/src/test/java/com/sinch/sdk/e2e/domains/voice/ConferenceSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java index d77cf9677..20b77039c 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/ConferenceSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/ConferenceSteps.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.e2e.domains.voice; +package com.sinch.sdk.e2e.domains.voice.v0; import com.sinch.sdk.core.TestHelpers; import com.sinch.sdk.domains.voice.ConferencesService; 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 new file mode 100644 index 000000000..269765e95 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/VoiceIT.java @@ -0,0 +1,16 @@ +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/WebhooksEventsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java similarity index 82% rename from client/src/test/java/com/sinch/sdk/e2e/domains/voice/WebhooksEventsSteps.java rename to client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java index 60d7ae04a..0aeb6a8f8 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/WebhooksEventsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v0/WebhooksEventsSteps.java @@ -1,13 +1,16 @@ -package com.sinch.sdk.e2e.domains.voice; +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; @@ -15,6 +18,7 @@ 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; @@ -34,6 +38,7 @@ public class WebhooksEventsSteps { WebhooksHelper.Response pieSequence; WebhooksHelper.Response diceEvent; WebhooksHelper.Response aceEvent; + WebhooksHelper.Response iceEvent; PromptInputEvent expectedPieReturnEvent = PromptInputEvent.builder() @@ -90,6 +95,24 @@ public class WebhooksEventsSteps { .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(); + @Given("^the Voice Webhooks handler is available$") public void serviceAvailable() { service = Config.getSinchClient().voice().webhooks(); @@ -121,6 +144,12 @@ public void sendACEEvent() throws IOException { 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); + } + @Then("the header of the {string} event with a {string} type contains a valid authorization") public void validatePieHeader(String event, String type) { @@ -146,6 +175,8 @@ public void validateHeader(String event) { receivedEvent = diceEvent; } else if (event.equals("ACE")) { receivedEvent = aceEvent; + } else if (event.equals("ICE")) { + receivedEvent = iceEvent; } else { Assertions.fail(); } @@ -184,6 +215,9 @@ public void validateEvent(String event) { } else if (event.equals("ACE")) { receivedEvent = aceEvent; expectedEvent = expectedAceEvent; + } else if (event.equals("ICE")) { + receivedEvent = iceEvent; + expectedEvent = expectedIceEvent; } else { Assertions.fail(); } diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/ApplicationsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/ApplicationsSteps.java new file mode 100644 index 000000000..b5616b97b --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/ApplicationsSteps.java @@ -0,0 +1,166 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; +import com.sinch.sdk.domains.voice.models.v1.Price; +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.QueryNumberInformation.NumberTypeEnum; +import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse; +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.util.Arrays; +import java.util.Collections; +import org.junit.jupiter.api.Assertions; + +public class ApplicationsSteps { + + ApplicationsService service; + + OwnedNumbersResponse listNumbersResponse; + Boolean assignNumbersPassed; + Boolean unassignNumberPassed; + + QueryNumberResponse queryNumberResult; + Callbacks getCallbackUrlsResult; + Boolean updateCallbackUrlsPassed; + + @Given("^the Voice service \"Applications\" is available") + public void serviceAvailable() { + + service = Config.getSinchClient().voice().v1().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() { + + UpdateNumbersRequest request = + UpdateNumbersRequest.builder() + .setNumbers(Collections.singletonList("+12012222222")) + .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") + .setCapability(Capability.VOICE) + .build(); + service.assignNumbers(request); + assignNumbersPassed = true; + } + + @When("^I send a request to unassign a number from a Voice Application$") + public void unassignNumber() { + + UnAssignNumberRequest request = + UnAssignNumberRequest.builder().setNumber("+12012222222").build(); + service.unassignNumber(request); + unassignNumberPassed = true; + } + + @When("^I send a request to get information about a specific number$") + public void queryNumber() { + + queryNumberResult = service.queryNumber("+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() { + Callbacks request = + Callbacks.builder() + .setUrl( + CallbacksUrl.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() { + OwnedNumbersResponse expected = + OwnedNumbersResponse.builder() + .setNumbers( + Arrays.asList( + OwnedNumberInformation.builder() + .setNumber("+12012222222") + .setCapability(Capability.VOICE) + .build(), + OwnedNumberInformation.builder() + .setNumber("+12013333333") + .setCapability(Capability.VOICE) + .setApplicationKey("ba5eba11-1dea-1337-babe-5a1ad00d1eaf") + .build(), + OwnedNumberInformation.builder() + .setNumber("+12014444444") + .setCapability(Capability.VOICE) + .build(), + OwnedNumberInformation.builder() + .setNumber("+12015555555") + .setCapability(Capability.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() { + QueryNumberResponse expected = + QueryNumberResponse.builder() + .setNumber( + QueryNumberInformation.builder() + .setCountryId("US") + .setNumberType(NumberTypeEnum.FIXED) + .setNormalizedNumber("+12015555555") + .setRestricted(true) + .setRate(Price.builder().setCurrencyId("USD").setAmount(0.01F).build()) + .build()) + .build(); + TestHelpers.recursiveEquals(queryNumberResult, expected); + } + + @Then("the response contains callback URLs details") + public void getCallbackUrlsResult() { + Callbacks expected = + Callbacks.builder() + .setUrl( + CallbacksUrl.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/v1/CalloutsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/CalloutsSteps.java new file mode 100644 index 000000000..25d35b49d --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/CalloutsSteps.java @@ -0,0 +1,157 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +import com.sinch.sdk.domains.voice.api.v1.CalloutsService; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +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.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.Menu; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOption; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenu; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecording; +import com.sinch.sdk.e2e.Config; +import com.sinch.sdk.models.DualToneMultiFrequency; +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().v1().callouts(); + } + + @When("^I send a request to make a TTS call$") + public void createTTS() { + + CalloutRequestTTS request = + CalloutRequestTTS.builder() + .setLocale("en-US") + .setDestination(DestinationPstn.from("+12017777777")) + .setCli("+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() { + CalloutRequestConference request = + CalloutRequestConference.builder() + .setLocale("en-US") + .setDestination(DestinationPstn.from("+12017777777")) + .setCli("+12015555555") + .setConferenceId("myConferenceId-E2E") + .setGreeting("Welcome to this conference call.") + .setMusicOnHold(MusicOnHold.MUSIC1) + .build(); + + conferenceResponse = service.conference(request); + } + + @When("^I send a request to make a Custom call$") + public void createCustom() { + CalloutRequestCustom request = + CalloutRequestCustom.builder() + .setDestination(DestinationPstn.from("+12017777777")) + .setCli("+12015555555") + .setCustom("Custom text") + .setIce( + SvamlControl.builder() + .setAction( + SvamlActionConnectPstn.builder() + .setNumber("+12017777777") + .setCli("+12015555555") + .build()) + .setInstructions( + Arrays.asList( + SvamlInstructionSay.builder() + .setText("Welcome to Sinch.") + .setLocale("en-US/male") + .build(), + SvamlInstructionStartRecording.builder() + .setOptions( + StartRecordingOptions.builder() + .setDestinationUrl("To specify") + .setCredentials("To specify") + .build()) + .build())) + .build()) + .setAce( + SvamlControl.builder() + .setAction( + SvamlActionRunMenu.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() + .setDtmf(DualToneMultiFrequency.valueOf("1")) + .setAction( + MenuOptionActionFactory.menuAction( + "confirm")) + .build(), + MenuOption.builder() + .setDtmf(DualToneMultiFrequency.valueOf("2")) + .setAction( + MenuOptionActionFactory.returnAction( + "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/v1/CallsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/CallsSteps.java new file mode 100644 index 000000000..26a5ef5e1 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/CallsSteps.java @@ -0,0 +1,134 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.core.exceptions.ApiException; +import com.sinch.sdk.domains.voice.api.v1.CallsService; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.DomainEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.ReasonEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.StatusEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +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.instruction.SvamlInstructionPlayFiles; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; +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().v1().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( + SvamlInstructionSay.builder() + .setText("Sorry, the conference has been cancelled. The call will end now.") + .setLocale("en-US") + .build())) + .setAction(SvamlActionHangup.DEFAULT) + .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( + SvamlInstructionSay.builder() + .setText("Sorry, the conference has been cancelled. The call will end now.") + .setLocale("en-US") + .build())) + .setAction(SvamlActionHangup.DEFAULT) + .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( + SvamlInstructionPlayFiles.builder() + .setIds( + Arrays.asList( + "https://samples-files.com/samples/Audio/mp3/sample-file-4.mp3")) + .build())) + .setAction(SvamlActionContinue.DEFAULT) + .build(); + service.manageWithCallLeg("1ce0ffee-ca11-ca11-ca11-abcdef000022", CallLeg.CALLEE, request); + manageWithCallLegPassed = true; + } + + @Then("the response contains the information about the call") + public void getCallResult() { + CallInformation information = + CallInformation.builder() + .setTo(DestinationPstn.from("+12017777777")) + .setDomain(DomainEnum.PSTN) + .setCallId("1ce0ffee-ca11-ca11-ca11-abcdef000003") + .setDuration(14) + .setStatus(StatusEnum.FINAL) + .setResult(CallResult.ANSWERED) + .setReason(ReasonEnum.MANAGERHANGUP) + .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/v1/ConferenceSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/ConferenceSteps.java new file mode 100644 index 000000000..d4f0532f9 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/ConferenceSteps.java @@ -0,0 +1,128 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceParticipant; +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 com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; +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.util.ArrayList; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public class ConferenceSteps { + + ConferencesService service; + String callResponse; + GetConferenceInfoResponse getResponse; + Boolean manageParticipantPassed; + Boolean kickParticipantPassed; + Boolean kickAllParticipantPassed; + + @Given("^the Voice service \"Conferences\" is available$") + public void serviceAvailable() { + service = Config.getSinchClient().voice().v1().conferences(); + } + + @When("^I send a request to make a Conference call with the \"Conferences\" service$") + public void createCall() { + + CalloutRequestConference request = + CalloutRequestConference.builder() + .setLocale("en-US") + .setDestination(DestinationPstn.from("+12017777777")) + .setCli("+12015555555") + .setConferenceId("myConferenceId-E2E") + .setGreeting("Welcome to this conference call.") + .setMusicOnHold(MusicOnHold.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() { + + ManageConferenceParticipantRequest request = + ManageConferenceParticipantRequest.builder() + .setCommand(CommandEnum.ONHOLD) + .setMusicOnHold(MusicOnHold.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() { + GetConferenceInfoResponse reponse = + GetConferenceInfoResponse.builder() + .setParticipants( + 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()))) + .build(); + TestHelpers.recursiveEquals(getResponse, reponse); + } + + @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/v1/VoiceIT.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/VoiceIT.java new file mode 100644 index 000000000..421a7a053 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/VoiceIT.java @@ -0,0 +1,16 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +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 V1") +@IncludeEngines("cucumber") +@SelectClasspathResource("features/voice") +@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "com.sinch.sdk.e2e.domains.voice.v1") +public class VoiceIT {} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/WebhooksEventsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/WebhooksEventsSteps.java new file mode 100644 index 000000000..369bea8c3 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/voice/v1/WebhooksEventsSteps.java @@ -0,0 +1,219 @@ +package com.sinch.sdk.e2e.domains.voice.v1; + +import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.domains.voice.api.v1.WebHooksService; +import com.sinch.sdk.domains.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationDid; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; +import com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent.ReasonEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult; +import com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.InputMethodEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.TypeEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEvent; +import com.sinch.sdk.domains.voice.models.v1.webhooks.VoiceWebhookEvent; +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 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; + + 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(TypeEnum.RETURN) + .setValue("cancel") + .setMenuId("main") + .setInputMethod(InputMethodEnum.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(TypeEnum.SEQUENCE) + .setValue("1234") + .setMenuId("confirm") + .setInputMethod(InputMethodEnum.DTMF) + .build()) + .build(); + + DisconnectedCallEvent expectedDiceEvent = + DisconnectedCallEvent.builder() + .setCallid("1ce0ffee-ca11-ca11-ca11-abcdef000033") + .setTimestamp(Instant.parse("2024-06-06T16:59:42Z")) + .setReason(ReasonEnum.MANAGERHANGUP) + .setResult(CallResult.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(DestinationPstn.from("12017777777")) + .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") + .setDuration(12) + .setFrom("12015555555") + .build(); + AnsweredCallEvent expectedAceEvent = + AnsweredCallEvent.builder() + .setCallid("1ce0ffee-ca11-ca11-ca11-abcdef000043") + .setTimestamp(Instant.parse("2024-06-06T17:10:34Z")) + .setVersion(1) + .setCustom("Custom text") + .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") + .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(DestinationDid.from("+12017777777")) + .setDomain(Domain.PSTN) + .setApplicationKey("f00dcafe-abba-c0de-1dea-dabb1ed4caf3") + .setOriginationType(Domain.PSTN2) + .setRdnis("") + .build(); + + @Given("^the Voice Webhooks handler is available$") + public void serviceAvailable() { + service = Config.getSinchClient().voice().v1().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::parseEvent); + } + + @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::parseEvent); + } + + @When("^I send a request to trigger a \"DICE\" event$") + public void sendDICEEvent() throws IOException { + diceEvent = WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/dice"), service::parseEvent); + } + + @When("^I send a request to trigger a \"ACE\" event$") + public void sendACEEvent() throws IOException { + aceEvent = WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/ace"), service::parseEvent); + } + + @When("^I send a request to trigger a \"ICE\" event$") + public void sendICEEvent() throws IOException { + iceEvent = WebhooksHelper.callURL(new URL(WEBHOOKS_URL + "/ice"), service::parseEvent); + } + + @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.validateAuthenticationHeader( + "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 { + Assertions.fail(); + } + boolean validated = + service.validateAuthenticationHeader( + "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 validatePieEvent(String event, String type) { + + WebhooksHelper.Response receivedEvent = null; + VoiceWebhookEvent 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 { + Assertions.fail(); + } + + TestHelpers.recursiveEquals(expectedEvent, receivedEvent.event); + } + + @Then("the Voice event describes a {string} event") + public void validateEvent(String event) { + + WebhooksHelper.Response receivedEvent = null; + VoiceWebhookEvent 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/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ApplicationsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ApplicationsApi.java similarity index 85% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ApplicationsApi.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ApplicationsApi.java index c9c047a41..c08aea04f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ApplicationsApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ApplicationsApi.java @@ -1,16 +1,14 @@ /* * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. * - * The version of the OpenAPI document: 1.0.1 + * OpenAPI document version: 1.0.1 * 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.voice.adapters.api.v1; +package com.sinch.sdk.domains.voice.api.v1.internal; import com.fasterxml.jackson.core.type.TypeReference; import com.sinch.sdk.core.exceptions.ApiException; @@ -25,11 +23,11 @@ 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.voice.models.dto.v1.CallbacksDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetNumbersResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetQueryNumberDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UnassignNumbersDto; -import com.sinch.sdk.domains.voice.models.dto.v1.UpdateNumbersDto; +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.OwnedNumbersResponse; +import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberResponse; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -61,10 +59,10 @@ public ApplicationsApi( * Query number Returns information about the requested number. * * @param number The phone number you want to query. (required) - * @return GetQueryNumberDto + * @return QueryNumberResponse * @throws ApiException if fails to make API call */ - public GetQueryNumberDto callingQueryNumber(String number) throws ApiException { + public QueryNumberResponse callingQueryNumber(String number) throws ApiException { LOGGER.finest("[callingQueryNumber]" + " " + "number: " + number); @@ -74,8 +72,8 @@ public GetQueryNumberDto callingQueryNumber(String number) throws ApiException { this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = + new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -125,10 +123,10 @@ private HttpRequest callingQueryNumberRequestBuilder(String number) throws ApiEx * Get Callback URLs Returns any callback URLs configured for the specified application. * * @param applicationkey The unique identifying key of the application. (required) - * @return CallbacksDto + * @return Callbacks * @throws ApiException if fails to make API call */ - public CallbacksDto configurationGetCallbackURLs(String applicationkey) throws ApiException { + public Callbacks configurationGetCallbackURLs(String applicationkey) throws ApiException { LOGGER.finest("[configurationGetCallbackURLs]" + " " + "applicationkey: " + applicationkey); @@ -138,7 +136,7 @@ public CallbacksDto configurationGetCallbackURLs(String applicationkey) throws A this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = new TypeReference() {}; + TypeReference localVarReturnType = new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -193,10 +191,10 @@ private HttpRequest configurationGetCallbackURLsRequestBuilder(String applicatio * 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 GetNumbersResponseObjDto + * @return OwnedNumbersResponse * @throws ApiException if fails to make API call */ - public GetNumbersResponseObjDto configurationGetNumbers() throws ApiException { + public OwnedNumbersResponse configurationGetNumbers() throws ApiException { LOGGER.finest("[configurationGetNumbers]"); @@ -206,8 +204,8 @@ public GetNumbersResponseObjDto configurationGetNumbers() throws ApiException { this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = + new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -248,16 +246,16 @@ private HttpRequest configurationGetNumbersRequestBuilder() throws ApiException /** * Un-assign number Un-assign a number from an application. * - * @param unassignNumbersDto (optional) + * @param unAssignNumberRequest (optional) * @throws ApiException if fails to make API call */ - public void configurationUnassignNumber(UnassignNumbersDto unassignNumbersDto) + public void configurationUnassignNumber(UnAssignNumberRequest unAssignNumberRequest) throws ApiException { LOGGER.finest( - "[configurationUnassignNumber]" + " " + "unassignNumbersDto: " + unassignNumbersDto); + "[configurationUnassignNumber]" + " " + "unAssignNumberRequest: " + unAssignNumberRequest); - HttpRequest httpRequest = configurationUnassignNumberRequestBuilder(unassignNumbersDto); + HttpRequest httpRequest = configurationUnassignNumberRequestBuilder(unAssignNumberRequest); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -275,7 +273,7 @@ public void configurationUnassignNumber(UnassignNumbersDto unassignNumbersDto) } private HttpRequest configurationUnassignNumberRequestBuilder( - UnassignNumbersDto unassignNumbersDto) throws ApiException { + UnAssignNumberRequest unAssignNumberRequest) throws ApiException { String localVarPath = "/v1/configuration/numbers"; @@ -288,7 +286,7 @@ private HttpRequest configurationUnassignNumberRequestBuilder( final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, unassignNumbersDto); + final String serializedBody = mapper.serialize(localVarContentTypes, unAssignNumberRequest); return new HttpRequest( localVarPath, @@ -305,10 +303,10 @@ private HttpRequest configurationUnassignNumberRequestBuilder( * Update Callbacks Update the configured callback URLs for the specified application. * * @param applicationkey The unique identifying key of the application. (required) - * @param callbacksDto (optional) + * @param callbacks (optional) * @throws ApiException if fails to make API call */ - public void configurationUpdateCallbackURLs(String applicationkey, CallbacksDto callbacksDto) + public void configurationUpdateCallbackURLs(String applicationkey, Callbacks callbacks) throws ApiException { LOGGER.finest( @@ -317,11 +315,11 @@ public void configurationUpdateCallbackURLs(String applicationkey, CallbacksDto + "applicationkey: " + applicationkey + ", " - + "callbacksDto: " - + callbacksDto); + + "callbacks: " + + callbacks); HttpRequest httpRequest = - configurationUpdateCallbackURLsRequestBuilder(applicationkey, callbacksDto); + configurationUpdateCallbackURLsRequestBuilder(applicationkey, callbacks); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -339,7 +337,7 @@ public void configurationUpdateCallbackURLs(String applicationkey, CallbacksDto } private HttpRequest configurationUpdateCallbackURLsRequestBuilder( - String applicationkey, CallbacksDto callbacksDto) throws ApiException { + String applicationkey, Callbacks callbacks) throws ApiException { // verify the required parameter 'applicationkey' is set if (applicationkey == null) { throw new ApiException( @@ -363,7 +361,7 @@ private HttpRequest configurationUpdateCallbackURLsRequestBuilder( final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, callbacksDto); + final String serializedBody = mapper.serialize(localVarContentTypes, callbacks); return new HttpRequest( localVarPath, @@ -379,14 +377,16 @@ private HttpRequest configurationUpdateCallbackURLsRequestBuilder( /** * Update Numbers Assign a number or a list of numbers to an application. * - * @param updateNumbersDto (optional) + * @param updateNumbersRequest (optional) * @throws ApiException if fails to make API call */ - public void configurationUpdateNumbers(UpdateNumbersDto updateNumbersDto) throws ApiException { + public void configurationUpdateNumbers(UpdateNumbersRequest updateNumbersRequest) + throws ApiException { - LOGGER.finest("[configurationUpdateNumbers]" + " " + "updateNumbersDto: " + updateNumbersDto); + LOGGER.finest( + "[configurationUpdateNumbers]" + " " + "updateNumbersRequest: " + updateNumbersRequest); - HttpRequest httpRequest = configurationUpdateNumbersRequestBuilder(updateNumbersDto); + HttpRequest httpRequest = configurationUpdateNumbersRequestBuilder(updateNumbersRequest); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -403,8 +403,8 @@ public void configurationUpdateNumbers(UpdateNumbersDto updateNumbersDto) throws mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest configurationUpdateNumbersRequestBuilder(UpdateNumbersDto updateNumbersDto) - throws ApiException { + private HttpRequest configurationUpdateNumbersRequestBuilder( + UpdateNumbersRequest updateNumbersRequest) throws ApiException { String localVarPath = "/v1/configuration/numbers"; @@ -417,7 +417,7 @@ private HttpRequest configurationUpdateNumbersRequestBuilder(UpdateNumbersDto up final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, updateNumbersDto); + final String serializedBody = mapper.serialize(localVarContentTypes, updateNumbersRequest); return new HttpRequest( localVarPath, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CalloutsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CalloutsApi.java similarity index 80% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CalloutsApi.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CalloutsApi.java index bea71e7fb..768f2ca53 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CalloutsApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CalloutsApi.java @@ -1,16 +1,14 @@ /* * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. * - * The version of the OpenAPI document: 1.0.1 + * OpenAPI document version: 1.0.1 * 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.voice.adapters.api.v1; +package com.sinch.sdk.domains.voice.api.v1.internal; import com.fasterxml.jackson.core.type.TypeReference; import com.sinch.sdk.core.exceptions.ApiException; @@ -24,8 +22,8 @@ import com.sinch.sdk.core.http.HttpStatus; import com.sinch.sdk.core.http.URLParameter; import com.sinch.sdk.core.models.ServerConfiguration; -import com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetCalloutResponseObjDto; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.CalloutRequestInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.response.CalloutResponse; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -58,23 +56,22 @@ public CalloutsApi( * 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 calloutRequestDto (optional) - * @return GetCalloutResponseObjDto + * @param calloutRequestInternal (optional) + * @return CalloutResponse * @throws ApiException if fails to make API call */ - public GetCalloutResponseObjDto callouts(CalloutRequestDto calloutRequestDto) + public CalloutResponse callouts(CalloutRequestInternal calloutRequestInternal) throws ApiException { - LOGGER.finest("[callouts]" + " " + "calloutRequestDto: " + calloutRequestDto); + LOGGER.finest("[callouts]" + " " + "calloutRequestInternal: " + calloutRequestInternal); - HttpRequest httpRequest = calloutsRequestBuilder(calloutRequestDto); + HttpRequest httpRequest = calloutsRequestBuilder(calloutRequestInternal); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -86,7 +83,7 @@ public GetCalloutResponseObjDto callouts(CalloutRequestDto calloutRequestDto) mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest calloutsRequestBuilder(CalloutRequestDto calloutRequestDto) + private HttpRequest calloutsRequestBuilder(CalloutRequestInternal calloutRequestInternal) throws ApiException { String localVarPath = "/calling/v1/callouts"; @@ -100,7 +97,7 @@ private HttpRequest calloutsRequestBuilder(CalloutRequestDto calloutRequestDto) final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, calloutRequestDto); + final String serializedBody = mapper.serialize(localVarContentTypes, calloutRequestInternal); return new HttpRequest( localVarPath, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CallsApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CallsApi.java similarity index 82% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CallsApi.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CallsApi.java index d373e5b64..3c80670a0 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/CallsApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/CallsApi.java @@ -1,16 +1,14 @@ /* * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. * - * The version of the OpenAPI document: 1.0.1 + * OpenAPI document version: 1.0.1 * 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.voice.adapters.api.v1; +package com.sinch.sdk.domains.voice.api.v1.internal; import com.fasterxml.jackson.core.type.TypeReference; import com.sinch.sdk.core.exceptions.ApiException; @@ -25,8 +23,8 @@ 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.voice.models.dto.v1.GetCallResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SVAMLRequestBodyDto; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -63,10 +61,10 @@ public CallsApi( * * @param callId The unique identifier of the call. This value is generated by the system. * (required) - * @return GetCallResponseObjDto + * @return CallInformation * @throws ApiException if fails to make API call */ - public GetCallResponseObjDto callingGetCallResult(String callId) throws ApiException { + public CallInformation callingGetCallResult(String callId) throws ApiException { LOGGER.finest("[callingGetCallResult]" + " " + "callId: " + callId); @@ -76,8 +74,7 @@ public GetCallResponseObjDto callingGetCallResult(String callId) throws ApiExcep this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -128,8 +125,8 @@ private HttpRequest callingGetCallResultRequestBuilder(String callId) throws Api * 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](/docs/voice/api-reference/svaml/) documentation. Note: You can only use this method for - * calls that originate from or terminate to PSTN or SIP networks. + * API](https://developers.sinch.com/docs/voice/api-reference/svaml/) documentation. Note: You can + * only use this method for calls that originate from or terminate to PSTN or SIP networks. * * @param callId The unique identifier of the call. This value is generated by the system. * (required) @@ -137,14 +134,14 @@ private HttpRequest callingGetCallResultRequestBuilder(String callId) throws Api * 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`.</br><Warning>The `callLeg` identifier is ignored + * `caller`.<br><Warning>The `callLeg` identifier is ignored * for calls that are part of a conference and calls initiated using the Callout * API.</Warning> (required) - * @param svAMLRequestBodyDto (optional) + * @param svamlControl (optional) * @throws ApiException if fails to make API call */ - public void callingManageCallWithCallLeg( - String callId, String callLeg, SVAMLRequestBodyDto svAMLRequestBodyDto) throws ApiException { + public void callingManageCallWithCallLeg(String callId, String callLeg, SvamlControl svamlControl) + throws ApiException { LOGGER.finest( "[callingManageCallWithCallLeg]" @@ -155,11 +152,11 @@ public void callingManageCallWithCallLeg( + "callLeg: " + callLeg + ", " - + "svAMLRequestBodyDto: " - + svAMLRequestBodyDto); + + "svamlControl: " + + svamlControl); HttpRequest httpRequest = - callingManageCallWithCallLegRequestBuilder(callId, callLeg, svAMLRequestBodyDto); + callingManageCallWithCallLegRequestBuilder(callId, callLeg, svamlControl); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -177,7 +174,7 @@ public void callingManageCallWithCallLeg( } private HttpRequest callingManageCallWithCallLegRequestBuilder( - String callId, String callLeg, SVAMLRequestBodyDto svAMLRequestBodyDto) throws ApiException { + String callId, String callLeg, SvamlControl svamlControl) throws ApiException { // verify the required parameter 'callId' is set if (callId == null) { throw new ApiException( @@ -205,7 +202,7 @@ private HttpRequest callingManageCallWithCallLegRequestBuilder( final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, svAMLRequestBodyDto); + final String serializedBody = mapper.serialize(localVarContentTypes, svamlControl); return new HttpRequest( localVarPath, @@ -221,28 +218,21 @@ private HttpRequest callingManageCallWithCallLegRequestBuilder( /** * Update a call in progress 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](/docs/voice/api-reference/svaml/) - * documentation. This method can only be used for calls that originate from or terminate to PSTN - * or SIP networks. + * information about SVAML, see the [Callback + * API](https://developers.sinch.com/docs/voice/api-reference/svaml/) documentation. This method + * can only be used for calls that originate from or terminate to PSTN or SIP networks. * * @param callId The unique identifier of the call. This value is generated by the system. * (required) - * @param svAMLRequestBodyDto (optional) + * @param svamlControl (optional) * @throws ApiException if fails to make API call */ - public void callingUpdateCall(String callId, SVAMLRequestBodyDto svAMLRequestBodyDto) - throws ApiException { + public void callingUpdateCall(String callId, SvamlControl svamlControl) throws ApiException { LOGGER.finest( - "[callingUpdateCall]" - + " " - + "callId: " - + callId - + ", " - + "svAMLRequestBodyDto: " - + svAMLRequestBodyDto); + "[callingUpdateCall]" + " " + "callId: " + callId + ", " + "svamlControl: " + svamlControl); - HttpRequest httpRequest = callingUpdateCallRequestBuilder(callId, svAMLRequestBodyDto); + HttpRequest httpRequest = callingUpdateCallRequestBuilder(callId, svamlControl); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -259,8 +249,8 @@ public void callingUpdateCall(String callId, SVAMLRequestBodyDto svAMLRequestBod mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest callingUpdateCallRequestBuilder( - String callId, SVAMLRequestBodyDto svAMLRequestBodyDto) throws ApiException { + private HttpRequest callingUpdateCallRequestBuilder(String callId, SvamlControl svamlControl) + throws ApiException { // verify the required parameter 'callId' is set if (callId == null) { throw new ApiException( @@ -281,7 +271,7 @@ private HttpRequest callingUpdateCallRequestBuilder( final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, svAMLRequestBodyDto); + final String serializedBody = mapper.serialize(localVarContentTypes, svamlControl); return new HttpRequest( localVarPath, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ConferencesApi.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ConferencesApi.java similarity index 89% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ConferencesApi.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ConferencesApi.java index 7c5293dd0..e07596322 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/adapters/api/v1/ConferencesApi.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/api/v1/internal/ConferencesApi.java @@ -1,16 +1,14 @@ /* * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. * - * The version of the OpenAPI document: 1.0.1 + * OpenAPI document version: 1.0.1 * 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.voice.adapters.api.v1; +package com.sinch.sdk.domains.voice.api.v1.internal; import com.fasterxml.jackson.core.type.TypeReference; import com.sinch.sdk.core.exceptions.ApiException; @@ -25,10 +23,10 @@ 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.voice.models.dto.v1.CalloutRequestDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetCalloutResponseObjDto; -import com.sinch.sdk.domains.voice.models.dto.v1.GetConferenceInfoResponseDto; -import com.sinch.sdk.domains.voice.models.dto.v1.ManageConferenceParticipantRequestDto; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.CalloutRequestInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.response.CalloutResponse; +import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; +import com.sinch.sdk.domains.voice.models.v1.conferences.response.GetConferenceInfoResponse; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -62,10 +60,10 @@ public ConferencesApi( * * @param conferenceId The unique identifier of the conference. The user sets this value. * (required) - * @return GetConferenceInfoResponseDto + * @return GetConferenceInfoResponse * @throws ApiException if fails to make API call */ - public GetConferenceInfoResponseDto callingGetConferenceInfo(String conferenceId) + public GetConferenceInfoResponse callingGetConferenceInfo(String conferenceId) throws ApiException { LOGGER.finest("[callingGetConferenceInfo]" + " " + "conferenceId: " + conferenceId); @@ -76,8 +74,8 @@ public GetConferenceInfoResponseDto callingGetConferenceInfo(String conferenceId this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = + new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -283,13 +281,13 @@ private HttpRequest callingKickConferenceParticipantRequestBuilder( * (required) * @param conferenceId The unique identifier of the conference. The user sets this value. * (required) - * @param manageConferenceParticipantRequestDto (optional) + * @param manageConferenceParticipantRequest (optional) * @throws ApiException if fails to make API call */ public void callingManageConferenceParticipant( String callId, String conferenceId, - ManageConferenceParticipantRequestDto manageConferenceParticipantRequestDto) + ManageConferenceParticipantRequest manageConferenceParticipantRequest) throws ApiException { LOGGER.finest( @@ -301,12 +299,12 @@ public void callingManageConferenceParticipant( + "conferenceId: " + conferenceId + ", " - + "manageConferenceParticipantRequestDto: " - + manageConferenceParticipantRequestDto); + + "manageConferenceParticipantRequest: " + + manageConferenceParticipantRequest); HttpRequest httpRequest = callingManageConferenceParticipantRequestBuilder( - callId, conferenceId, manageConferenceParticipantRequestDto); + callId, conferenceId, manageConferenceParticipantRequest); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); @@ -326,7 +324,7 @@ public void callingManageConferenceParticipant( private HttpRequest callingManageConferenceParticipantRequestBuilder( String callId, String conferenceId, - ManageConferenceParticipantRequestDto manageConferenceParticipantRequestDto) + ManageConferenceParticipantRequest manageConferenceParticipantRequest) throws ApiException { // verify the required parameter 'callId' is set if (callId == null) { @@ -360,7 +358,7 @@ private HttpRequest callingManageConferenceParticipantRequestBuilder( final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); final String serializedBody = - mapper.serialize(localVarContentTypes, manageConferenceParticipantRequestDto); + mapper.serialize(localVarContentTypes, manageConferenceParticipantRequest); return new HttpRequest( localVarPath, @@ -378,23 +376,22 @@ private HttpRequest callingManageConferenceParticipantRequestBuilder( * 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 calloutRequestDto (optional) - * @return GetCalloutResponseObjDto + * @param calloutRequestInternal (optional) + * @return CalloutResponse * @throws ApiException if fails to make API call */ - public GetCalloutResponseObjDto callouts(CalloutRequestDto calloutRequestDto) + public CalloutResponse callouts(CalloutRequestInternal calloutRequestInternal) throws ApiException { - LOGGER.finest("[callouts]" + " " + "calloutRequestDto: " + calloutRequestDto); + LOGGER.finest("[callouts]" + " " + "calloutRequestInternal: " + calloutRequestInternal); - HttpRequest httpRequest = calloutsRequestBuilder(calloutRequestDto); + HttpRequest httpRequest = calloutsRequestBuilder(calloutRequestInternal); HttpResponse response = httpClient.invokeAPI( this.serverConfiguration, this.authManagersByOasSecuritySchemes, httpRequest); if (HttpStatus.isSuccessfulStatus(response.getCode())) { - TypeReference localVarReturnType = - new TypeReference() {}; + TypeReference localVarReturnType = new TypeReference() {}; return mapper.deserialize(response, localVarReturnType); } // fallback to default errors handling: @@ -406,7 +403,7 @@ public GetCalloutResponseObjDto callouts(CalloutRequestDto calloutRequestDto) mapper.deserialize(response, new TypeReference>() {})); } - private HttpRequest calloutsRequestBuilder(CalloutRequestDto calloutRequestDto) + private HttpRequest calloutsRequestBuilder(CalloutRequestInternal calloutRequestInternal) throws ApiException { String localVarPath = "/calling/v1/callouts"; @@ -420,7 +417,7 @@ private HttpRequest calloutsRequestBuilder(CalloutRequestDto calloutRequestDto) final Collection localVarContentTypes = Arrays.asList("application/json"); final Collection localVarAuthNames = Arrays.asList("Basic", "Signed"); - final String serializedBody = mapper.serialize(localVarContentTypes, calloutRequestDto); + final String serializedBody = mapper.serialize(localVarContentTypes, calloutRequestInternal); return new HttpRequest( localVarPath, diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/AceRequestAllOfAmdDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/AceRequestAllOfAmdDto.java deleted file mode 100644 index 4f41afbe4..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/AceRequestAllOfAmdDto.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * If [Answering Machine Detection](/docs/voice/api-reference/amd_v2) (AMD) is enabled, this object - * contains information about whether the call was answered by a machine. - */ -@JsonPropertyOrder({ - AceRequestAllOfAmdDto.JSON_PROPERTY_STATUS, - AceRequestAllOfAmdDto.JSON_PROPERTY_REASON, - AceRequestAllOfAmdDto.JSON_PROPERTY_DURATION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class AceRequestAllOfAmdDto { - private static final long serialVersionUID = 1L; - - /** The determination by the system of who answered the call. */ - public enum StatusEnum { - MACHINE("machine"), - - HUMAN("human"), - - NOTSURE("notsure"), - - HANGUP("hangup"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - private boolean statusDefined = false; - - /** The reason that the system used to determine who answered the call. */ - public enum ReasonEnum { - LONGGREETING("longgreeting"), - - INITIALSILENCE("initialsilence"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - ReasonEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ReasonEnum fromValue(String value) { - for (ReasonEnum b : ReasonEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_REASON = "reason"; - private String reason; - private boolean reasonDefined = false; - - public static final String JSON_PROPERTY_DURATION = "duration"; - private Integer duration; - private boolean durationDefined = false; - - public AceRequestAllOfAmdDto() {} - - public AceRequestAllOfAmdDto status(String status) { - this.status = status; - this.statusDefined = true; - return this; - } - - /** - * The determination by the system of who answered the call. - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getStatus() { - return status; - } - - @JsonIgnore - public boolean getStatusDefined() { - return statusDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStatus(String status) { - this.status = status; - this.statusDefined = true; - } - - public AceRequestAllOfAmdDto reason(String reason) { - this.reason = reason; - this.reasonDefined = true; - return this; - } - - /** - * The reason that the system used to determine who answered the call. - * - * @return reason - */ - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getReason() { - return reason; - } - - @JsonIgnore - public boolean getReasonDefined() { - return reasonDefined; - } - - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReason(String reason) { - this.reason = reason; - this.reasonDefined = true; - } - - public AceRequestAllOfAmdDto duration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - return this; - } - - /** - * The length of the call. - * - * @return duration - */ - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDuration() { - return duration; - } - - @JsonIgnore - public boolean getDurationDefined() { - return durationDefined; - } - - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDuration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - } - - /** Return true if this aceRequest_allOf_amd object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AceRequestAllOfAmdDto aceRequestAllOfAmd = (AceRequestAllOfAmdDto) o; - return Objects.equals(this.status, aceRequestAllOfAmd.status) - && Objects.equals(this.reason, aceRequestAllOfAmd.reason) - && Objects.equals(this.duration, aceRequestAllOfAmd.duration); - } - - @Override - public int hashCode() { - return Objects.hash(status, reason, duration); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AceRequestAllOfAmdDto {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).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/voice/models/dto/v1/AceRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/AceRequestDto.java deleted file mode 100644 index 4cf017719..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/AceRequestDto.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** The request body of an Answered Call Event. */ -@JsonPropertyOrder({ - AceRequestDto.JSON_PROPERTY_EVENT, - AceRequestDto.JSON_PROPERTY_TIMESTAMP, - AceRequestDto.JSON_PROPERTY_CUSTOM, - AceRequestDto.JSON_PROPERTY_APPLICATION_KEY, - AceRequestDto.JSON_PROPERTY_AMD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -public class AceRequestDto extends WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - - /** Must have the value `ace`. */ - public enum EventEnum { - ACE("ace"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EventEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EventEnum fromValue(String value) { - for (EventEnum b : EventEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; - private String applicationKey; - private boolean applicationKeyDefined = false; - - public static final String JSON_PROPERTY_AMD = "amd"; - private AceRequestAllOfAmdDto amd; - private boolean amdDefined = false; - - public AceRequestDto() {} - - public AceRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `ace`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public AceRequestDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The timestamp in UTC format. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public AceRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public AceRequestDto applicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - return this; - } - - /** - * The unique application key. You can find it in the Sinch - * [dashboard](https://dashboard.sinch.com/voice/apps). - * - * @return applicationKey - */ - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationKey() { - return applicationKey; - } - - @JsonIgnore - public boolean getApplicationKeyDefined() { - return applicationKeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - } - - public AceRequestDto amd(AceRequestAllOfAmdDto amd) { - this.amd = amd; - this.amdDefined = true; - return this; - } - - /** - * Get amd - * - * @return amd - */ - @JsonProperty(JSON_PROPERTY_AMD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public AceRequestAllOfAmdDto getAmd() { - return amd; - } - - @JsonIgnore - public boolean getAmdDefined() { - return amdDefined; - } - - @JsonProperty(JSON_PROPERTY_AMD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAmd(AceRequestAllOfAmdDto amd) { - this.amd = amd; - this.amdDefined = true; - } - - @Override - public AceRequestDto callid(String callid) { - this.setCallid(callid); - return this; - } - - @Override - public AceRequestDto version(Integer version) { - this.setVersion(version); - return this; - } - - /** Return true if this aceRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AceRequestDto aceRequest = (AceRequestDto) o; - return Objects.equals(this.event, aceRequest.event) - && Objects.equals(this.timestamp, aceRequest.timestamp) - && Objects.equals(this.custom, aceRequest.custom) - && Objects.equals(this.applicationKey, aceRequest.applicationKey) - && Objects.equals(this.amd, aceRequest.amd) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(event, timestamp, custom, applicationKey, amd, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AceRequestDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); - sb.append(" amd: ").append(toIndentedString(amd)).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("aceRequest", AceRequestDto.class); - JSONNavigator.registerDiscriminator(AceRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallResultDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallResultDto.java deleted file mode 100644 index 39068c706..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallResultDto.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Contains the result of a call. */ -public enum CallResultDto { - N_A("N/A"), - - ANSWERED("ANSWERED"), - - BUSY("BUSY"), - - NOANSWER("NOANSWER"), - - FAILED("FAILED"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - CallResultDto(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static CallResultDto fromValue(String value) { - for (CallResultDto b : CallResultDto.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDto.java deleted file mode 100644 index 01163c1a8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDto.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Currently three types of callouts are supported: 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. - */ -@JsonPropertyOrder({ - CalloutRequestDto.JSON_PROPERTY_METHOD, - CalloutRequestDto.JSON_PROPERTY_CONFERENCE_CALLOUT, - CalloutRequestDto.JSON_PROPERTY_TTS_CALLOUT, - CalloutRequestDto.JSON_PROPERTY_CUSTOM_CALLOUT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CalloutRequestDto { - private static final long serialVersionUID = 1L; - - /** Sets the type of callout. */ - public enum MethodEnum { - CONFERENCECALLOUT("conferenceCallout"), - - TTSCALLOUT("ttsCallout"), - - CUSTOMCALLOUT("customCallout"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MethodEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static MethodEnum fromValue(String value) { - for (MethodEnum b : MethodEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_METHOD = "method"; - private String method; - private boolean methodDefined = false; - - public static final String JSON_PROPERTY_CONFERENCE_CALLOUT = "conferenceCallout"; - private ConferenceCalloutRequestDto conferenceCallout; - private boolean conferenceCalloutDefined = false; - - public static final String JSON_PROPERTY_TTS_CALLOUT = "ttsCallout"; - private TtsCalloutRequestDto ttsCallout; - private boolean ttsCalloutDefined = false; - - public static final String JSON_PROPERTY_CUSTOM_CALLOUT = "customCallout"; - private CustomCalloutRequestDto customCallout; - private boolean customCalloutDefined = false; - - public CalloutRequestDto() {} - - public CalloutRequestDto method(String method) { - this.method = method; - this.methodDefined = true; - return this; - } - - /** - * Sets the type of callout. - * - * @return method - */ - @JsonProperty(JSON_PROPERTY_METHOD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getMethod() { - return method; - } - - @JsonIgnore - public boolean getMethodDefined() { - return methodDefined; - } - - @JsonProperty(JSON_PROPERTY_METHOD) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setMethod(String method) { - this.method = method; - this.methodDefined = true; - } - - public CalloutRequestDto conferenceCallout(ConferenceCalloutRequestDto conferenceCallout) { - this.conferenceCallout = conferenceCallout; - this.conferenceCalloutDefined = true; - return this; - } - - /** - * Get conferenceCallout - * - * @return conferenceCallout - */ - @JsonProperty(JSON_PROPERTY_CONFERENCE_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ConferenceCalloutRequestDto getConferenceCallout() { - return conferenceCallout; - } - - @JsonIgnore - public boolean getConferenceCalloutDefined() { - return conferenceCalloutDefined; - } - - @JsonProperty(JSON_PROPERTY_CONFERENCE_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setConferenceCallout(ConferenceCalloutRequestDto conferenceCallout) { - this.conferenceCallout = conferenceCallout; - this.conferenceCalloutDefined = true; - } - - public CalloutRequestDto ttsCallout(TtsCalloutRequestDto ttsCallout) { - this.ttsCallout = ttsCallout; - this.ttsCalloutDefined = true; - return this; - } - - /** - * Get ttsCallout - * - * @return ttsCallout - */ - @JsonProperty(JSON_PROPERTY_TTS_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public TtsCalloutRequestDto getTtsCallout() { - return ttsCallout; - } - - @JsonIgnore - public boolean getTtsCalloutDefined() { - return ttsCalloutDefined; - } - - @JsonProperty(JSON_PROPERTY_TTS_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTtsCallout(TtsCalloutRequestDto ttsCallout) { - this.ttsCallout = ttsCallout; - this.ttsCalloutDefined = true; - } - - public CalloutRequestDto customCallout(CustomCalloutRequestDto customCallout) { - this.customCallout = customCallout; - this.customCalloutDefined = true; - return this; - } - - /** - * Get customCallout - * - * @return customCallout - */ - @JsonProperty(JSON_PROPERTY_CUSTOM_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public CustomCalloutRequestDto getCustomCallout() { - return customCallout; - } - - @JsonIgnore - public boolean getCustomCalloutDefined() { - return customCalloutDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM_CALLOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustomCallout(CustomCalloutRequestDto customCallout) { - this.customCallout = customCallout; - this.customCalloutDefined = true; - } - - /** Return true if this CalloutRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CalloutRequestDto calloutRequest = (CalloutRequestDto) o; - return Objects.equals(this.method, calloutRequest.method) - && Objects.equals(this.conferenceCallout, calloutRequest.conferenceCallout) - && Objects.equals(this.ttsCallout, calloutRequest.ttsCallout) - && Objects.equals(this.customCallout, calloutRequest.customCallout); - } - - @Override - public int hashCode() { - return Objects.hash(method, conferenceCallout, ttsCallout, customCallout); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CalloutRequestDto {\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append(" conferenceCallout: ").append(toIndentedString(conferenceCallout)).append("\n"); - sb.append(" ttsCallout: ").append(toIndentedString(ttsCallout)).append("\n"); - sb.append(" customCallout: ").append(toIndentedString(customCallout)).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/voice/models/dto/v1/ConferenceCalloutRequestConferenceDtmfOptionsDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ConferenceCalloutRequestConferenceDtmfOptionsDto.java deleted file mode 100644 index fb2341269..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ConferenceCalloutRequestConferenceDtmfOptionsDto.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Options to control how DTMF signals are used by the participant in the conference. For - * information on how to use this feature, read more [here](../../../conference-dtmf). - */ -@JsonPropertyOrder({ - ConferenceCalloutRequestConferenceDtmfOptionsDto.JSON_PROPERTY_MODE, - ConferenceCalloutRequestConferenceDtmfOptionsDto.JSON_PROPERTY_MAX_DIGITS, - ConferenceCalloutRequestConferenceDtmfOptionsDto.JSON_PROPERTY_TIMEOUT_MILLS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ConferenceCalloutRequestConferenceDtmfOptionsDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_MODE = "mode"; - private String mode; - private boolean modeDefined = false; - - public static final String JSON_PROPERTY_MAX_DIGITS = "maxDigits"; - private Integer maxDigits; - private boolean maxDigitsDefined = false; - - public static final String JSON_PROPERTY_TIMEOUT_MILLS = "timeoutMills"; - private Integer timeoutMills; - private boolean timeoutMillsDefined = false; - - public ConferenceCalloutRequestConferenceDtmfOptionsDto() {} - - public ConferenceCalloutRequestConferenceDtmfOptionsDto mode(String mode) { - this.mode = mode; - this.modeDefined = true; - return this; - } - - /** - * Determines what DTMF mode the participant will use in the call. - * - * @return mode - */ - @JsonProperty(JSON_PROPERTY_MODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMode() { - return mode; - } - - @JsonIgnore - public boolean getModeDefined() { - return modeDefined; - } - - @JsonProperty(JSON_PROPERTY_MODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMode(String mode) { - this.mode = mode; - this.modeDefined = true; - } - - public ConferenceCalloutRequestConferenceDtmfOptionsDto maxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - 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. - * - * @return maxDigits - */ - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDigits() { - return maxDigits; - } - - @JsonIgnore - public boolean getMaxDigitsDefined() { - return maxDigitsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - } - - public ConferenceCalloutRequestConferenceDtmfOptionsDto timeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - return this; - } - - /** - * The number of milliseconds that the system will wait between entered digits before triggering - * the PIE callback. The default value is `3000`. - * - * @return timeoutMills - */ - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getTimeoutMills() { - return timeoutMills; - } - - @JsonIgnore - public boolean getTimeoutMillsDefined() { - return timeoutMillsDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - } - - /** Return true if this conferenceCalloutRequest_conferenceDtmfOptions object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConferenceCalloutRequestConferenceDtmfOptionsDto conferenceCalloutRequestConferenceDtmfOptions = - (ConferenceCalloutRequestConferenceDtmfOptionsDto) o; - return Objects.equals(this.mode, conferenceCalloutRequestConferenceDtmfOptions.mode) - && Objects.equals(this.maxDigits, conferenceCalloutRequestConferenceDtmfOptions.maxDigits) - && Objects.equals( - this.timeoutMills, conferenceCalloutRequestConferenceDtmfOptions.timeoutMills); - } - - @Override - public int hashCode() { - return Objects.hash(mode, maxDigits, timeoutMills); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConferenceCalloutRequestConferenceDtmfOptionsDto {\n"); - sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); - sb.append(" maxDigits: ").append(toIndentedString(maxDigits)).append("\n"); - sb.append(" timeoutMills: ").append(toIndentedString(timeoutMills)).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/voice/models/dto/v1/ConferenceCalloutRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ConferenceCalloutRequestDto.java deleted file mode 100644 index 944222169..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ConferenceCalloutRequestDto.java +++ /dev/null @@ -1,622 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 conference callout calls a phone number or a user. When the call is answered, it's - * connected to a conference room. - */ -@JsonPropertyOrder({ - ConferenceCalloutRequestDto.JSON_PROPERTY_DESTINATION, - ConferenceCalloutRequestDto.JSON_PROPERTY_CONFERENCE_ID, - ConferenceCalloutRequestDto.JSON_PROPERTY_CLI, - ConferenceCalloutRequestDto.JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS, - ConferenceCalloutRequestDto.JSON_PROPERTY_DTMF, - ConferenceCalloutRequestDto.JSON_PROPERTY_MAX_DURATION, - ConferenceCalloutRequestDto.JSON_PROPERTY_ENABLE_ACE, - ConferenceCalloutRequestDto.JSON_PROPERTY_ENABLE_DICE, - ConferenceCalloutRequestDto.JSON_PROPERTY_ENABLE_PIE, - ConferenceCalloutRequestDto.JSON_PROPERTY_LOCALE, - ConferenceCalloutRequestDto.JSON_PROPERTY_GREETING, - ConferenceCalloutRequestDto.JSON_PROPERTY_MOH_CLASS, - ConferenceCalloutRequestDto.JSON_PROPERTY_CUSTOM, - ConferenceCalloutRequestDto.JSON_PROPERTY_DOMAIN -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ConferenceCalloutRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_DESTINATION = "destination"; - private DestinationDto destination; - private boolean destinationDefined = false; - - public static final String JSON_PROPERTY_CONFERENCE_ID = "conferenceId"; - private String conferenceId; - private boolean conferenceIdDefined = false; - - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS = "conferenceDtmfOptions"; - private ConferenceCalloutRequestConferenceDtmfOptionsDto conferenceDtmfOptions; - private boolean conferenceDtmfOptionsDefined = false; - - public static final String JSON_PROPERTY_DTMF = "dtmf"; - private String dtmf; - private boolean dtmfDefined = false; - - public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; - private Integer maxDuration; - private boolean maxDurationDefined = false; - - public static final String JSON_PROPERTY_ENABLE_ACE = "enableAce"; - private Boolean enableAce; - private boolean enableAceDefined = false; - - public static final String JSON_PROPERTY_ENABLE_DICE = "enableDice"; - private Boolean enableDice; - private boolean enableDiceDefined = false; - - public static final String JSON_PROPERTY_ENABLE_PIE = "enablePie"; - private Boolean enablePie; - private boolean enablePieDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public static final String JSON_PROPERTY_GREETING = "greeting"; - private String greeting; - private boolean greetingDefined = false; - - public static final String JSON_PROPERTY_MOH_CLASS = "mohClass"; - private String mohClass; - private boolean mohClassDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_DOMAIN = "domain"; - private String domain; - private boolean domainDefined = false; - - public ConferenceCalloutRequestDto() {} - - public ConferenceCalloutRequestDto destination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - return this; - } - - /** - * Get destination - * - * @return destination - */ - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public DestinationDto getDestination() { - return destination; - } - - @JsonIgnore - public boolean getDestinationDefined() { - return destinationDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setDestination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - } - - public ConferenceCalloutRequestDto conferenceId(String conferenceId) { - this.conferenceId = conferenceId; - this.conferenceIdDefined = true; - return this; - } - - /** - * 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. - * - * @return conferenceId - */ - @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getConferenceId() { - return conferenceId; - } - - @JsonIgnore - public boolean getConferenceIdDefined() { - return conferenceIdDefined; - } - - @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setConferenceId(String conferenceId) { - this.conferenceId = conferenceId; - this.conferenceIdDefined = true; - } - - public ConferenceCalloutRequestDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * 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. The number must be in - * [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public ConferenceCalloutRequestDto conferenceDtmfOptions( - ConferenceCalloutRequestConferenceDtmfOptionsDto conferenceDtmfOptions) { - this.conferenceDtmfOptions = conferenceDtmfOptions; - this.conferenceDtmfOptionsDefined = true; - return this; - } - - /** - * Get conferenceDtmfOptions - * - * @return conferenceDtmfOptions - */ - @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public ConferenceCalloutRequestConferenceDtmfOptionsDto getConferenceDtmfOptions() { - return conferenceDtmfOptions; - } - - @JsonIgnore - public boolean getConferenceDtmfOptionsDefined() { - return conferenceDtmfOptionsDefined; - } - - @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setConferenceDtmfOptions( - ConferenceCalloutRequestConferenceDtmfOptionsDto conferenceDtmfOptions) { - this.conferenceDtmfOptions = conferenceDtmfOptions; - this.conferenceDtmfOptionsDefined = true; - } - - public ConferenceCalloutRequestDto dtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - return this; - } - - /** - * When the destination picks up, this DTMF tones will be played to the callee. Valid characters - * in the string are \"0\"-\"9\", \"#\" and \"w\". A - * \"w\" will render a 500 ms pause. Example: \"ww1234#w#\" will render a 1s - * pause, the DTMF tones \"1\", \"2\", \"3\", \"4\" and - * \"#\" followed by a 0.5s pause and finally the DTMF tone for \"#\". This - * can be used if the callout destination for instance require a conference PIN code or an - * extension to be entered. - * - * @return dtmf - */ - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDtmf() { - return dtmf; - } - - @JsonIgnore - public boolean getDtmfDefined() { - return dtmfDefined; - } - - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - } - - public ConferenceCalloutRequestDto maxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - return this; - } - - /** - * Get maxDuration - * - * @return maxDuration - */ - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDuration() { - return maxDuration; - } - - @JsonIgnore - public boolean getMaxDurationDefined() { - return maxDurationDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - } - - public ConferenceCalloutRequestDto enableAce(Boolean enableAce) { - this.enableAce = enableAce; - this.enableAceDefined = true; - return this; - } - - /** - * 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.<br><b>Note </b> 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. - * - * @return enableAce - */ - @JsonProperty(JSON_PROPERTY_ENABLE_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableAce() { - return enableAce; - } - - @JsonIgnore - public boolean getEnableAceDefined() { - return enableAceDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableAce(Boolean enableAce) { - this.enableAce = enableAce; - this.enableAceDefined = true; - } - - public ConferenceCalloutRequestDto enableDice(Boolean enableDice) { - this.enableDice = enableDice; - this.enableDiceDefined = true; - return this; - } - - /** - * 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.<br><b>Note</b> 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. - * - * @return enableDice - */ - @JsonProperty(JSON_PROPERTY_ENABLE_DICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableDice() { - return enableDice; - } - - @JsonIgnore - public boolean getEnableDiceDefined() { - return enableDiceDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_DICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableDice(Boolean enableDice) { - this.enableDice = enableDice; - this.enableDiceDefined = true; - } - - public ConferenceCalloutRequestDto enablePie(Boolean enablePie) { - this.enablePie = enablePie; - this.enablePieDefined = true; - return this; - } - - /** - * 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. - * - * @return enablePie - */ - @JsonProperty(JSON_PROPERTY_ENABLE_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnablePie() { - return enablePie; - } - - @JsonIgnore - public boolean getEnablePieDefined() { - return enablePieDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnablePie(Boolean enablePie) { - this.enablePie = enablePie; - this.enablePieDefined = true; - } - - public ConferenceCalloutRequestDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * 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. Supported languages and - * voices are detailed [here](../../../voice-locales/) - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - public ConferenceCalloutRequestDto greeting(String greeting) { - this.greeting = greeting; - this.greetingDefined = true; - return this; - } - - /** - * The text that will be spoken as a greeting. - * - * @return greeting - */ - @JsonProperty(JSON_PROPERTY_GREETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getGreeting() { - return greeting; - } - - @JsonIgnore - public boolean getGreetingDefined() { - return greetingDefined; - } - - @JsonProperty(JSON_PROPERTY_GREETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setGreeting(String greeting) { - this.greeting = greeting; - this.greetingDefined = true; - } - - public ConferenceCalloutRequestDto mohClass(String mohClass) { - this.mohClass = mohClass; - this.mohClassDefined = true; - return this; - } - - /** - * 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. It can take one of these pre-defined - * values:<ul><li>`ring` (progress - * tone)</li><li>`music1` (music - * file)</li><li>`music2` (music - * file)</li><li>`music3` (music file)</li></ul></br>If no - * “music-on-hold” is specified, the user will only hear silence. - * - * @return mohClass - */ - @JsonProperty(JSON_PROPERTY_MOH_CLASS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMohClass() { - return mohClass; - } - - @JsonIgnore - public boolean getMohClassDefined() { - return mohClassDefined; - } - - @JsonProperty(JSON_PROPERTY_MOH_CLASS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMohClass(String mohClass) { - this.mohClass = mohClass; - this.mohClassDefined = true; - } - - public ConferenceCalloutRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * Used to input custom data. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public ConferenceCalloutRequestDto domain(String domain) { - this.domain = domain; - this.domainDefined = true; - return this; - } - - /** - * can be either “pstn” for PSTN endpoint or “mxp” for data (app or web) clients. - * - * @return domain - */ - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDomain() { - return domain; - } - - @JsonIgnore - public boolean getDomainDefined() { - return domainDefined; - } - - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDomain(String domain) { - this.domain = domain; - this.domainDefined = true; - } - - /** Return true if this conferenceCalloutRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConferenceCalloutRequestDto conferenceCalloutRequest = (ConferenceCalloutRequestDto) o; - return Objects.equals(this.destination, conferenceCalloutRequest.destination) - && Objects.equals(this.conferenceId, conferenceCalloutRequest.conferenceId) - && Objects.equals(this.cli, conferenceCalloutRequest.cli) - && Objects.equals( - this.conferenceDtmfOptions, conferenceCalloutRequest.conferenceDtmfOptions) - && Objects.equals(this.dtmf, conferenceCalloutRequest.dtmf) - && Objects.equals(this.maxDuration, conferenceCalloutRequest.maxDuration) - && Objects.equals(this.enableAce, conferenceCalloutRequest.enableAce) - && Objects.equals(this.enableDice, conferenceCalloutRequest.enableDice) - && Objects.equals(this.enablePie, conferenceCalloutRequest.enablePie) - && Objects.equals(this.locale, conferenceCalloutRequest.locale) - && Objects.equals(this.greeting, conferenceCalloutRequest.greeting) - && Objects.equals(this.mohClass, conferenceCalloutRequest.mohClass) - && Objects.equals(this.custom, conferenceCalloutRequest.custom) - && Objects.equals(this.domain, conferenceCalloutRequest.domain); - } - - @Override - public int hashCode() { - return Objects.hash( - destination, - conferenceId, - cli, - conferenceDtmfOptions, - dtmf, - maxDuration, - enableAce, - enableDice, - enablePie, - locale, - greeting, - mohClass, - custom, - domain); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConferenceCalloutRequestDto {\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" conferenceDtmfOptions: ") - .append(toIndentedString(conferenceDtmfOptions)) - .append("\n"); - sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); - sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); - sb.append(" enableAce: ").append(toIndentedString(enableAce)).append("\n"); - sb.append(" enableDice: ").append(toIndentedString(enableDice)).append("\n"); - sb.append(" enablePie: ").append(toIndentedString(enablePie)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" greeting: ").append(toIndentedString(greeting)).append("\n"); - sb.append(" mohClass: ").append(toIndentedString(mohClass)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" domain: ").append(toIndentedString(domain)).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/voice/models/dto/v1/CustomCalloutRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CustomCalloutRequestDto.java deleted file mode 100644 index 3ada2a828..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CustomCalloutRequestDto.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 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. - */ -@JsonPropertyOrder({ - CustomCalloutRequestDto.JSON_PROPERTY_CLI, - CustomCalloutRequestDto.JSON_PROPERTY_DESTINATION, - CustomCalloutRequestDto.JSON_PROPERTY_DTMF, - CustomCalloutRequestDto.JSON_PROPERTY_CUSTOM, - CustomCalloutRequestDto.JSON_PROPERTY_MAX_DURATION, - CustomCalloutRequestDto.JSON_PROPERTY_ICE, - CustomCalloutRequestDto.JSON_PROPERTY_ACE, - CustomCalloutRequestDto.JSON_PROPERTY_PIE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CustomCalloutRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_DESTINATION = "destination"; - private DestinationDto destination; - private boolean destinationDefined = false; - - public static final String JSON_PROPERTY_DTMF = "dtmf"; - private String dtmf; - private boolean dtmfDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; - private Integer maxDuration; - private boolean maxDurationDefined = false; - - public static final String JSON_PROPERTY_ICE = "ice"; - private String ice; - private boolean iceDefined = false; - - public static final String JSON_PROPERTY_ACE = "ace"; - private String ace; - private boolean aceDefined = false; - - public static final String JSON_PROPERTY_PIE = "pie"; - private String pie; - private boolean pieDefined = false; - - public CustomCalloutRequestDto() {} - - public CustomCalloutRequestDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * The number that will be displayed as the incoming caller, to set your own CLI, you may use your - * verified number or your Dashboard virtual number, it must be in - * [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public CustomCalloutRequestDto destination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - return this; - } - - /** - * Get destination - * - * @return destination - */ - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getDestination() { - return destination; - } - - @JsonIgnore - public boolean getDestinationDefined() { - return destinationDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDestination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - } - - public CustomCalloutRequestDto dtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - return this; - } - - /** - * When the destination picks up, this DTMF tones will be played to the callee. Valid characters - * in the string are \"0\"-\"9\", \"#\", and \"w\". A - * \"w\" will render a 500 ms pause. For example, \"ww1234#w#\" will render a - * 1s pause, the DTMF tones \"1\", \"2\", \"3\", \"4\" and - * \"#\" followed by a 0.5s pause and finally the DTMF tone for \"#\". This - * can be used if the callout destination for instance require a conference PIN code or an - * extension to be entered. - * - * @return dtmf - */ - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDtmf() { - return dtmf; - } - - @JsonIgnore - public boolean getDtmfDefined() { - return dtmfDefined; - } - - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - } - - public CustomCalloutRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * Can be used to input custom data. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public CustomCalloutRequestDto maxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - return this; - } - - /** - * The maximum amount of time in seconds that the call will last. - * - * @return maxDuration - */ - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDuration() { - return maxDuration; - } - - @JsonIgnore - public boolean getMaxDurationDefined() { - return maxDurationDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - } - - public CustomCalloutRequestDto ice(String ice) { - this.ice = ice; - this.iceDefined = true; - return this; - } - - /** - * You can use inline [SVAML](../../../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\\\":\\\"connectPstn\\\",\\\"number\\\":\\\"46000000001\\\",\\\"maxDuration\\\":90}}\"``` - * - * @return ice - */ - @JsonProperty(JSON_PROPERTY_ICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getIce() { - return ice; - } - - @JsonIgnore - public boolean getIceDefined() { - return iceDefined; - } - - @JsonProperty(JSON_PROPERTY_ICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setIce(String ice) { - this.ice = ice; - this.iceDefined = true; - } - - public CustomCalloutRequestDto ace(String ace) { - this.ace = ace; - this.aceDefined = true; - return this; - } - - /** - * You can use inline [SVAML](../../../svaml/) to replace a callback URL when using custom - * callouts. Ensure that the JSON object is escaped correctly. 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)\\\"}]}]}}\"``` - * - * @return ace - */ - @JsonProperty(JSON_PROPERTY_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getAce() { - return ace; - } - - @JsonIgnore - public boolean getAceDefined() { - return aceDefined; - } - - @JsonProperty(JSON_PROPERTY_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAce(String ace) { - this.ace = ace; - this.aceDefined = true; - } - - public CustomCalloutRequestDto pie(String pie) { - this.pie = pie; - this.pieDefined = true; - return this; - } - - /** - * <b>Note:</b> PIE callbacks are not available for DATA Calls; only PSTN and SIP - * calls. You can use inline [SVAML](../../../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. Example: - * ```\"https://your-application-server-host/application\"``` - * - * @return pie - */ - @JsonProperty(JSON_PROPERTY_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPie() { - return pie; - } - - @JsonIgnore - public boolean getPieDefined() { - return pieDefined; - } - - @JsonProperty(JSON_PROPERTY_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPie(String pie) { - this.pie = pie; - this.pieDefined = true; - } - - /** Return true if this customCalloutRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CustomCalloutRequestDto customCalloutRequest = (CustomCalloutRequestDto) o; - return Objects.equals(this.cli, customCalloutRequest.cli) - && Objects.equals(this.destination, customCalloutRequest.destination) - && Objects.equals(this.dtmf, customCalloutRequest.dtmf) - && Objects.equals(this.custom, customCalloutRequest.custom) - && Objects.equals(this.maxDuration, customCalloutRequest.maxDuration) - && Objects.equals(this.ice, customCalloutRequest.ice) - && Objects.equals(this.ace, customCalloutRequest.ace) - && Objects.equals(this.pie, customCalloutRequest.pie); - } - - @Override - public int hashCode() { - return Objects.hash(cli, destination, dtmf, custom, maxDuration, ice, ace, pie); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CustomCalloutRequestDto {\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); - sb.append(" ice: ").append(toIndentedString(ice)).append("\n"); - sb.append(" ace: ").append(toIndentedString(ace)).append("\n"); - sb.append(" pie: ").append(toIndentedString(pie)).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/voice/models/dto/v1/DestinationDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DestinationDto.java deleted file mode 100644 index 081792114..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DestinationDto.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 type of device and number or endpoint to call. */ -@JsonPropertyOrder({DestinationDto.JSON_PROPERTY_TYPE, DestinationDto.JSON_PROPERTY_ENDPOINT}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class DestinationDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TYPE = "type"; - private DestinationTypeDto type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; - private String endpoint; - private boolean endpointDefined = false; - - public DestinationDto() {} - - public DestinationDto type(DestinationTypeDto type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * Get type - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public DestinationTypeDto getType() { - return type; - } - - @JsonIgnore - public boolean getTypeDefined() { - return typeDefined; - } - - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(DestinationTypeDto type) { - this.type = type; - this.typeDefined = true; - } - - public DestinationDto endpoint(String endpoint) { - this.endpoint = endpoint; - this.endpointDefined = true; - return this; - } - - /** - * If the type is `number` the value of the endpoint is a phone number. If the type is - * `username` the value is the username for a data endpoint. - * - * @return endpoint - */ - @JsonProperty(JSON_PROPERTY_ENDPOINT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEndpoint() { - return endpoint; - } - - @JsonIgnore - public boolean getEndpointDefined() { - return endpointDefined; - } - - @JsonProperty(JSON_PROPERTY_ENDPOINT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEndpoint(String endpoint) { - this.endpoint = endpoint; - this.endpointDefined = true; - } - - /** Return true if this destination object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DestinationDto destination = (DestinationDto) o; - return Objects.equals(this.type, destination.type) - && Objects.equals(this.endpoint, destination.endpoint); - } - - @Override - public int hashCode() { - return Objects.hash(type, endpoint); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DestinationDto {\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" endpoint: ").append(toIndentedString(endpoint)).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/voice/models/dto/v1/DestinationTypeDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DestinationTypeDto.java deleted file mode 100644 index 1978317cd..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DestinationTypeDto.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Can be of type `number` for PSTN endpoints or of type `username` for data - * endpoints. - */ -public enum DestinationTypeDto { - NUMBER("number"), - - NUMBER2("Number"), - - USERNAME("username"), - - USERNAME2("Username"), - - SIP("sip"), - - DID("did"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - DestinationTypeDto(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DestinationTypeDto fromValue(String value) { - for (DestinationTypeDto b : DestinationTypeDto.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DiceRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DiceRequestDto.java deleted file mode 100644 index 0c987c1a2..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DiceRequestDto.java +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** The request body of a Disconnected Call Event. */ -@JsonPropertyOrder({ - DiceRequestDto.JSON_PROPERTY_EVENT, - DiceRequestDto.JSON_PROPERTY_TIMESTAMP, - DiceRequestDto.JSON_PROPERTY_CUSTOM, - DiceRequestDto.JSON_PROPERTY_APPLICATION_KEY, - DiceRequestDto.JSON_PROPERTY_REASON, - DiceRequestDto.JSON_PROPERTY_RESULT, - DiceRequestDto.JSON_PROPERTY_DEBIT, - DiceRequestDto.JSON_PROPERTY_USER_RATE, - DiceRequestDto.JSON_PROPERTY_TO, - DiceRequestDto.JSON_PROPERTY_DURATION, - DiceRequestDto.JSON_PROPERTY_FROM, - DiceRequestDto.JSON_PROPERTY_CALL_HEADERS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -public class DiceRequestDto extends WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - - /** Must have the value `dice`. */ - public enum EventEnum { - DICE("dice"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EventEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EventEnum fromValue(String value) { - for (EventEnum b : EventEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; - private String applicationKey; - private boolean applicationKeyDefined = false; - - /** The reason the call was disconnected. */ - public enum ReasonEnum { - N_A("N/A"), - - TIMEOUT("TIMEOUT"), - - CALLERHANGUP("CALLERHANGUP"), - - CALLEEHANGUP("CALLEEHANGUP"), - - BLOCKED("BLOCKED"), - - MANAGERHANGUP("MANAGERHANGUP"), - - NOCREDITPARTNER("NOCREDITPARTNER"), - - GENERALERROR("GENERALERROR"), - - CANCEL("CANCEL"), - - USERNOTFOUND("USERNOTFOUND"), - - CALLBACKERROR("CALLBACKERROR"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - ReasonEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ReasonEnum fromValue(String value) { - for (ReasonEnum b : ReasonEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_REASON = "reason"; - private String reason; - private boolean reasonDefined = false; - - public static final String JSON_PROPERTY_RESULT = "result"; - private CallResultDto result; - private boolean resultDefined = false; - - public static final String JSON_PROPERTY_DEBIT = "debit"; - private PriceDto debit; - private boolean debitDefined = false; - - public static final String JSON_PROPERTY_USER_RATE = "userRate"; - private PriceDto userRate; - private boolean userRateDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private DestinationDto to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_DURATION = "duration"; - private Integer duration; - private boolean durationDefined = false; - - public static final String JSON_PROPERTY_FROM = "from"; - private String from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; - private List callHeaders; - private boolean callHeadersDefined = false; - - public DiceRequestDto() {} - - public DiceRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `dice`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public DiceRequestDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The timestamp in UTC format. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public DiceRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public DiceRequestDto applicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - return this; - } - - /** - * The unique application key. You can find it in the Sinch - * [dashboard](https://dashboard.sinch.com/voice/apps). - * - * @return applicationKey - */ - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationKey() { - return applicationKey; - } - - @JsonIgnore - public boolean getApplicationKeyDefined() { - return applicationKeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - } - - public DiceRequestDto reason(String reason) { - this.reason = reason; - this.reasonDefined = true; - return this; - } - - /** - * The reason the call was disconnected. - * - * @return reason - */ - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getReason() { - return reason; - } - - @JsonIgnore - public boolean getReasonDefined() { - return reasonDefined; - } - - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReason(String reason) { - this.reason = reason; - this.reasonDefined = true; - } - - public DiceRequestDto result(CallResultDto result) { - this.result = result; - this.resultDefined = true; - return this; - } - - /** - * Get result - * - * @return result - */ - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public CallResultDto getResult() { - return result; - } - - @JsonIgnore - public boolean getResultDefined() { - return resultDefined; - } - - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setResult(CallResultDto result) { - this.result = result; - this.resultDefined = true; - } - - public DiceRequestDto debit(PriceDto debit) { - this.debit = debit; - this.debitDefined = true; - return this; - } - - /** - * Get debit - * - * @return debit - */ - @JsonProperty(JSON_PROPERTY_DEBIT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getDebit() { - return debit; - } - - @JsonIgnore - public boolean getDebitDefined() { - return debitDefined; - } - - @JsonProperty(JSON_PROPERTY_DEBIT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDebit(PriceDto debit) { - this.debit = debit; - this.debitDefined = true; - } - - public DiceRequestDto userRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - return this; - } - - /** - * Get userRate - * - * @return userRate - */ - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getUserRate() { - return userRate; - } - - @JsonIgnore - public boolean getUserRateDefined() { - return userRateDefined; - } - - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUserRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - } - - public DiceRequestDto to(DestinationDto to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Get to - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(DestinationDto to) { - this.to = to; - this.toDefined = true; - } - - public DiceRequestDto duration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - return this; - } - - /** - * The duration of the call in seconds. - * - * @return duration - */ - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDuration() { - return duration; - } - - @JsonIgnore - public boolean getDurationDefined() { - return durationDefined; - } - - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDuration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - } - - public DiceRequestDto from(String from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Information about the initiator of the call. - * - * @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 DiceRequestDto callHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - return this; - } - - public DiceRequestDto addCallHeadersItem(CallHeaderDto callHeadersItem) { - if (this.callHeaders == null) { - this.callHeaders = new ArrayList<>(); - } - this.callHeadersDefined = true; - this.callHeaders.add(callHeadersItem); - return this; - } - - /** - * If the call was initiated by a Sinch SDK client, call headers are the headers specified by the - * *caller* client. Read more about call headers [here](../../../call-headers/). - * - * @return callHeaders - */ - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getCallHeaders() { - return callHeaders; - } - - @JsonIgnore - public boolean getCallHeadersDefined() { - return callHeadersDefined; - } - - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - } - - @Override - public DiceRequestDto callid(String callid) { - this.setCallid(callid); - return this; - } - - @Override - public DiceRequestDto version(Integer version) { - this.setVersion(version); - return this; - } - - /** Return true if this diceRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DiceRequestDto diceRequest = (DiceRequestDto) o; - return Objects.equals(this.event, diceRequest.event) - && Objects.equals(this.timestamp, diceRequest.timestamp) - && Objects.equals(this.custom, diceRequest.custom) - && Objects.equals(this.applicationKey, diceRequest.applicationKey) - && Objects.equals(this.reason, diceRequest.reason) - && Objects.equals(this.result, diceRequest.result) - && Objects.equals(this.debit, diceRequest.debit) - && Objects.equals(this.userRate, diceRequest.userRate) - && Objects.equals(this.to, diceRequest.to) - && Objects.equals(this.duration, diceRequest.duration) - && Objects.equals(this.from, diceRequest.from) - && Objects.equals(this.callHeaders, diceRequest.callHeaders) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash( - event, - timestamp, - custom, - applicationKey, - reason, - result, - debit, - userRate, - to, - duration, - from, - callHeaders, - super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DiceRequestDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); - sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\n"); - sb.append(" debit: ").append(toIndentedString(debit)).append("\n"); - sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).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("diceRequest", DiceRequestDto.class); - JSONNavigator.registerDiscriminator(DiceRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DomainDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DomainDto.java deleted file mode 100644 index 6c0453efb..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/DomainDto.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Can be either `pstn` for PSTN endpoint or `mxp` for data (app or web) - * clients. - */ -public enum DomainDto { - PSTN("pstn"), - - MXP("mxp"), - - PSTN2("PSTN"), - - MXP2("MXP"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - DomainDto(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DomainDto fromValue(String value) { - for (DomainDto b : DomainDto.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ErrorDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ErrorDto.java deleted file mode 100644 index 36f7a28e8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ErrorDto.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** ErrorDto */ -@JsonPropertyOrder({ - ErrorDto.JSON_PROPERTY_STATUS, - ErrorDto.JSON_PROPERTY_ERROR_CODE, - ErrorDto.JSON_PROPERTY_MESSAGE, - ErrorDto.JSON_PROPERTY_REFERENCE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ErrorDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - private boolean statusDefined = false; - - public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; - private String errorCode; - private boolean errorCodeDefined = false; - - public static final String JSON_PROPERTY_MESSAGE = "message"; - private String message; - private boolean messageDefined = false; - - public static final String JSON_PROPERTY_REFERENCE = "reference"; - private String reference; - private boolean referenceDefined = false; - - public ErrorDto() {} - - public ErrorDto status(String status) { - this.status = status; - this.statusDefined = true; - return this; - } - - /** - * A summary of the HTTP error code and error type. - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getStatus() { - return status; - } - - @JsonIgnore - public boolean getStatusDefined() { - return statusDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStatus(String status) { - this.status = status; - this.statusDefined = true; - } - - public ErrorDto errorCode(String errorCode) { - this.errorCode = errorCode; - this.errorCodeDefined = true; - return this; - } - - /** - * The HTTP error code. - * - * @return errorCode - */ - @JsonProperty(JSON_PROPERTY_ERROR_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getErrorCode() { - return errorCode; - } - - @JsonIgnore - public boolean getErrorCodeDefined() { - return errorCodeDefined; - } - - @JsonProperty(JSON_PROPERTY_ERROR_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - this.errorCodeDefined = true; - } - - public ErrorDto message(String message) { - this.message = message; - this.messageDefined = true; - return this; - } - - /** - * A simple description of the cause of the error. - * - * @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; - } - - public ErrorDto reference(String reference) { - this.reference = reference; - this.referenceDefined = true; - return this; - } - - /** - * If applicable, a reference ID for support to use with diagnosing the error. - * - * @return reference - */ - @JsonProperty(JSON_PROPERTY_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getReference() { - return reference; - } - - @JsonIgnore - public boolean getReferenceDefined() { - return referenceDefined; - } - - @JsonProperty(JSON_PROPERTY_REFERENCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReference(String reference) { - this.reference = reference; - this.referenceDefined = true; - } - - /** Return true if this Error object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorDto error = (ErrorDto) o; - return Objects.equals(this.status, error.status) - && Objects.equals(this.errorCode, error.errorCode) - && Objects.equals(this.message, error.message) - && Objects.equals(this.reference, error.reference); - } - - @Override - public int hashCode() { - return Objects.hash(status, errorCode, message, reference); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorDto {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" reference: ").append(toIndentedString(reference)).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/voice/models/dto/v1/GetCallResponseObjDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetCallResponseObjDto.java deleted file mode 100644 index bd4a057b8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetCallResponseObjDto.java +++ /dev/null @@ -1,621 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** GetCallResponseObjDto */ -@JsonPropertyOrder({ - GetCallResponseObjDto.JSON_PROPERTY_FROM, - GetCallResponseObjDto.JSON_PROPERTY_TO, - GetCallResponseObjDto.JSON_PROPERTY_DOMAIN, - GetCallResponseObjDto.JSON_PROPERTY_CALL_ID, - GetCallResponseObjDto.JSON_PROPERTY_DURATION, - GetCallResponseObjDto.JSON_PROPERTY_STATUS, - GetCallResponseObjDto.JSON_PROPERTY_RESULT, - GetCallResponseObjDto.JSON_PROPERTY_REASON, - GetCallResponseObjDto.JSON_PROPERTY_TIMESTAMP, - GetCallResponseObjDto.JSON_PROPERTY_CUSTOM, - GetCallResponseObjDto.JSON_PROPERTY_USER_RATE, - GetCallResponseObjDto.JSON_PROPERTY_DEBIT -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetCallResponseObjDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_FROM = "from"; - private DestinationDto from; - private boolean fromDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private DestinationDto to; - private boolean toDefined = false; - - /** Must be `pstn` for PSTN. */ - public enum DomainEnum { - PSTN("pstn"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - DomainEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static DomainEnum fromValue(String value) { - for (DomainEnum b : DomainEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_DOMAIN = "domain"; - private String domain; - private boolean domainDefined = false; - - public static final String JSON_PROPERTY_CALL_ID = "callId"; - private String callId; - private boolean callIdDefined = false; - - public static final String JSON_PROPERTY_DURATION = "duration"; - private Integer duration; - private boolean durationDefined = false; - - /** The status of the call. Either `ONGOING` or `FINAL` */ - public enum StatusEnum { - ONGOING("ONGOING"), - - FINAL("FINAL"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_STATUS = "status"; - private String status; - private boolean statusDefined = false; - - public static final String JSON_PROPERTY_RESULT = "result"; - private CallResultDto result; - private boolean resultDefined = false; - - /** Contains the reason why a call ended. */ - public enum ReasonEnum { - N_A("N/A"), - - TIMEOUT("TIMEOUT"), - - CALLERHANGUP("CALLERHANGUP"), - - CALLEEHANGUP("CALLEEHANGUP"), - - BLOCKED("BLOCKED"), - - NOCREDITPARTNER("NOCREDITPARTNER"), - - MANAGERHANGUP("MANAGERHANGUP"), - - CANCEL("CANCEL"), - - GENERALERROR("GENERALERROR"), - - INVALIDSVAMLACTION("INVALIDSVAMLACTION"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - ReasonEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static ReasonEnum fromValue(String value) { - for (ReasonEnum b : ReasonEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_REASON = "reason"; - private String reason; - private boolean reasonDefined = false; - - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_USER_RATE = "userRate"; - private PriceDto userRate; - private boolean userRateDefined = false; - - public static final String JSON_PROPERTY_DEBIT = "debit"; - private PriceDto debit; - private boolean debitDefined = false; - - public GetCallResponseObjDto() {} - - public GetCallResponseObjDto from(DestinationDto from) { - this.from = from; - this.fromDefined = true; - return this; - } - - /** - * Get from - * - * @return from - */ - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getFrom() { - return from; - } - - @JsonIgnore - public boolean getFromDefined() { - return fromDefined; - } - - @JsonProperty(JSON_PROPERTY_FROM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFrom(DestinationDto from) { - this.from = from; - this.fromDefined = true; - } - - public GetCallResponseObjDto to(DestinationDto to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Get to - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(DestinationDto to) { - this.to = to; - this.toDefined = true; - } - - public GetCallResponseObjDto domain(String domain) { - this.domain = domain; - this.domainDefined = true; - return this; - } - - /** - * Must be `pstn` for PSTN. - * - * @return domain - */ - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDomain() { - return domain; - } - - @JsonIgnore - public boolean getDomainDefined() { - return domainDefined; - } - - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDomain(String domain) { - this.domain = domain; - this.domainDefined = true; - } - - public GetCallResponseObjDto callId(String callId) { - this.callId = callId; - this.callIdDefined = true; - return this; - } - - /** - * The unique identifier of the call. - * - * @return callId - */ - @JsonProperty(JSON_PROPERTY_CALL_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallId() { - return callId; - } - - @JsonIgnore - public boolean getCallIdDefined() { - return callIdDefined; - } - - @JsonProperty(JSON_PROPERTY_CALL_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallId(String callId) { - this.callId = callId; - this.callIdDefined = true; - } - - public GetCallResponseObjDto duration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - return this; - } - - /** - * The duration of the call in seconds. - * - * @return duration - */ - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDuration() { - return duration; - } - - @JsonIgnore - public boolean getDurationDefined() { - return durationDefined; - } - - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDuration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - } - - public GetCallResponseObjDto status(String status) { - this.status = status; - this.statusDefined = true; - return this; - } - - /** - * The status of the call. Either `ONGOING` or `FINAL` - * - * @return status - */ - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getStatus() { - return status; - } - - @JsonIgnore - public boolean getStatusDefined() { - return statusDefined; - } - - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setStatus(String status) { - this.status = status; - this.statusDefined = true; - } - - public GetCallResponseObjDto result(CallResultDto result) { - this.result = result; - this.resultDefined = true; - return this; - } - - /** - * Get result - * - * @return result - */ - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public CallResultDto getResult() { - return result; - } - - @JsonIgnore - public boolean getResultDefined() { - return resultDefined; - } - - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setResult(CallResultDto result) { - this.result = result; - this.resultDefined = true; - } - - public GetCallResponseObjDto reason(String reason) { - this.reason = reason; - this.reasonDefined = true; - return this; - } - - /** - * Contains the reason why a call ended. - * - * @return reason - */ - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getReason() { - return reason; - } - - @JsonIgnore - public boolean getReasonDefined() { - return reasonDefined; - } - - @JsonProperty(JSON_PROPERTY_REASON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReason(String reason) { - this.reason = reason; - this.reasonDefined = true; - } - - public GetCallResponseObjDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The date and time of the call. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public GetCallResponseObjDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * An object that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public GetCallResponseObjDto userRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - return this; - } - - /** - * Get userRate - * - * @return userRate - */ - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getUserRate() { - return userRate; - } - - @JsonIgnore - public boolean getUserRateDefined() { - return userRateDefined; - } - - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUserRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - } - - public GetCallResponseObjDto debit(PriceDto debit) { - this.debit = debit; - this.debitDefined = true; - return this; - } - - /** - * Get debit - * - * @return debit - */ - @JsonProperty(JSON_PROPERTY_DEBIT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getDebit() { - return debit; - } - - @JsonIgnore - public boolean getDebitDefined() { - return debitDefined; - } - - @JsonProperty(JSON_PROPERTY_DEBIT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDebit(PriceDto debit) { - this.debit = debit; - this.debitDefined = true; - } - - /** Return true if this getCallResponseObj object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetCallResponseObjDto getCallResponseObj = (GetCallResponseObjDto) o; - return Objects.equals(this.from, getCallResponseObj.from) - && Objects.equals(this.to, getCallResponseObj.to) - && Objects.equals(this.domain, getCallResponseObj.domain) - && Objects.equals(this.callId, getCallResponseObj.callId) - && Objects.equals(this.duration, getCallResponseObj.duration) - && Objects.equals(this.status, getCallResponseObj.status) - && Objects.equals(this.result, getCallResponseObj.result) - && Objects.equals(this.reason, getCallResponseObj.reason) - && Objects.equals(this.timestamp, getCallResponseObj.timestamp) - && Objects.equals(this.custom, getCallResponseObj.custom) - && Objects.equals(this.userRate, getCallResponseObj.userRate) - && Objects.equals(this.debit, getCallResponseObj.debit); - } - - @Override - public int hashCode() { - return Objects.hash( - from, to, domain, callId, duration, status, result, reason, timestamp, custom, userRate, - debit); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetCallResponseObjDto {\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); - sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\n"); - sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); - sb.append(" debit: ").append(toIndentedString(debit)).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/voice/models/dto/v1/GetConferenceInfoResponseDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetConferenceInfoResponseDto.java deleted file mode 100644 index df68afc05..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetConferenceInfoResponseDto.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** The response returns information about the participants in the conference. */ -@JsonPropertyOrder({GetConferenceInfoResponseDto.JSON_PROPERTY_PARTICIPANTS}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetConferenceInfoResponseDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_PARTICIPANTS = "participants"; - private List participants; - private boolean participantsDefined = false; - - public GetConferenceInfoResponseDto() {} - - public GetConferenceInfoResponseDto participants( - List participants) { - this.participants = participants; - this.participantsDefined = true; - return this; - } - - public GetConferenceInfoResponseDto addParticipantsItem( - GetConferenceInfoResponseParticipantsInnerDto participantsItem) { - if (this.participants == null) { - this.participants = new ArrayList<>(); - } - this.participantsDefined = true; - this.participants.add(participantsItem); - return this; - } - - /** - * Get participants - * - * @return participants - */ - @JsonProperty(JSON_PROPERTY_PARTICIPANTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getParticipants() { - return participants; - } - - @JsonIgnore - public boolean getParticipantsDefined() { - return participantsDefined; - } - - @JsonProperty(JSON_PROPERTY_PARTICIPANTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setParticipants(List participants) { - this.participants = participants; - this.participantsDefined = true; - } - - /** Return true if this getConferenceInfoResponse object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetConferenceInfoResponseDto getConferenceInfoResponse = (GetConferenceInfoResponseDto) o; - return Objects.equals(this.participants, getConferenceInfoResponse.participants); - } - - @Override - public int hashCode() { - return Objects.hash(participants); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetConferenceInfoResponseDto {\n"); - sb.append(" participants: ").append(toIndentedString(participants)).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/voice/models/dto/v1/GetConferenceInfoResponseParticipantsInnerDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetConferenceInfoResponseParticipantsInnerDto.java deleted file mode 100644 index ff2e1ac9f..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetConferenceInfoResponseParticipantsInnerDto.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** GetConferenceInfoResponseParticipantsInnerDto */ -@JsonPropertyOrder({ - GetConferenceInfoResponseParticipantsInnerDto.JSON_PROPERTY_CLI, - GetConferenceInfoResponseParticipantsInnerDto.JSON_PROPERTY_ID, - GetConferenceInfoResponseParticipantsInnerDto.JSON_PROPERTY_DURATION, - GetConferenceInfoResponseParticipantsInnerDto.JSON_PROPERTY_MUTED, - GetConferenceInfoResponseParticipantsInnerDto.JSON_PROPERTY_ONHOLD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetConferenceInfoResponseParticipantsInnerDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - private boolean idDefined = false; - - public static final String JSON_PROPERTY_DURATION = "duration"; - private Integer duration; - private boolean durationDefined = false; - - public static final String JSON_PROPERTY_MUTED = "muted"; - private Boolean muted; - private boolean mutedDefined = false; - - public static final String JSON_PROPERTY_ONHOLD = "onhold"; - private Boolean onhold; - private boolean onholdDefined = false; - - public GetConferenceInfoResponseParticipantsInnerDto() {} - - public GetConferenceInfoResponseParticipantsInnerDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * 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 cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public GetConferenceInfoResponseParticipantsInnerDto id(String id) { - this.id = id; - this.idDefined = true; - return this; - } - - /** - * The callId of the call leg that the participant joined the conference. - * - * @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 GetConferenceInfoResponseParticipantsInnerDto duration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - return this; - } - - /** - * The number of seconds that the participant has been connected to the conference. - * - * @return duration - */ - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDuration() { - return duration; - } - - @JsonIgnore - public boolean getDurationDefined() { - return durationDefined; - } - - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDuration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - } - - public GetConferenceInfoResponseParticipantsInnerDto muted(Boolean muted) { - this.muted = muted; - this.mutedDefined = true; - return this; - } - - /** - * Get muted - * - * @return muted - */ - @JsonProperty(JSON_PROPERTY_MUTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getMuted() { - return muted; - } - - @JsonIgnore - public boolean getMutedDefined() { - return mutedDefined; - } - - @JsonProperty(JSON_PROPERTY_MUTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMuted(Boolean muted) { - this.muted = muted; - this.mutedDefined = true; - } - - public GetConferenceInfoResponseParticipantsInnerDto onhold(Boolean onhold) { - this.onhold = onhold; - this.onholdDefined = true; - return this; - } - - /** - * Get onhold - * - * @return onhold - */ - @JsonProperty(JSON_PROPERTY_ONHOLD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getOnhold() { - return onhold; - } - - @JsonIgnore - public boolean getOnholdDefined() { - return onholdDefined; - } - - @JsonProperty(JSON_PROPERTY_ONHOLD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOnhold(Boolean onhold) { - this.onhold = onhold; - this.onholdDefined = true; - } - - /** Return true if this getConferenceInfoResponse_participants_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; - } - GetConferenceInfoResponseParticipantsInnerDto getConferenceInfoResponseParticipantsInner = - (GetConferenceInfoResponseParticipantsInnerDto) o; - return Objects.equals(this.cli, getConferenceInfoResponseParticipantsInner.cli) - && Objects.equals(this.id, getConferenceInfoResponseParticipantsInner.id) - && Objects.equals(this.duration, getConferenceInfoResponseParticipantsInner.duration) - && Objects.equals(this.muted, getConferenceInfoResponseParticipantsInner.muted) - && Objects.equals(this.onhold, getConferenceInfoResponseParticipantsInner.onhold); - } - - @Override - public int hashCode() { - return Objects.hash(cli, id, duration, muted, onhold); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetConferenceInfoResponseParticipantsInnerDto {\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); - sb.append(" muted: ").append(toIndentedString(muted)).append("\n"); - sb.append(" onhold: ").append(toIndentedString(onhold)).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/voice/models/dto/v1/GetNumbersResponseObjDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetNumbersResponseObjDto.java deleted file mode 100644 index 3a31bfe52..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetNumbersResponseObjDto.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** GetNumbersResponseObjDto */ -@JsonPropertyOrder({GetNumbersResponseObjDto.JSON_PROPERTY_NUMBERS}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetNumbersResponseObjDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NUMBERS = "numbers"; - private List numbers; - private boolean numbersDefined = false; - - public GetNumbersResponseObjDto() {} - - public GetNumbersResponseObjDto numbers(List numbers) { - this.numbers = numbers; - this.numbersDefined = true; - return this; - } - - public GetNumbersResponseObjDto addNumbersItem(GetNumbersResponseObjNumbersInnerDto numbersItem) { - if (this.numbers == null) { - this.numbers = new ArrayList<>(); - } - this.numbersDefined = true; - this.numbers.add(numbersItem); - return this; - } - - /** - * The object type. Will always be list of numbers, associated application keys and capabilities - * - * @return numbers - */ - @JsonProperty(JSON_PROPERTY_NUMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getNumbers() { - return numbers; - } - - @JsonIgnore - public boolean getNumbersDefined() { - return numbersDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumbers(List numbers) { - this.numbers = numbers; - this.numbersDefined = true; - } - - /** Return true if this getNumbersResponseObj object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetNumbersResponseObjDto getNumbersResponseObj = (GetNumbersResponseObjDto) o; - return Objects.equals(this.numbers, getNumbersResponseObj.numbers); - } - - @Override - public int hashCode() { - return Objects.hash(numbers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetNumbersResponseObjDto {\n"); - sb.append(" numbers: ").append(toIndentedString(numbers)).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/voice/models/dto/v1/GetNumbersResponseObjNumbersInnerDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetNumbersResponseObjNumbersInnerDto.java deleted file mode 100644 index e8f0a393a..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetNumbersResponseObjNumbersInnerDto.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** GetNumbersResponseObjNumbersInnerDto */ -@JsonPropertyOrder({ - GetNumbersResponseObjNumbersInnerDto.JSON_PROPERTY_NUMBER, - GetNumbersResponseObjNumbersInnerDto.JSON_PROPERTY_APPLICATIONKEY, - GetNumbersResponseObjNumbersInnerDto.JSON_PROPERTY_CAPABILITY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetNumbersResponseObjNumbersInnerDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NUMBER = "number"; - private String number; - private boolean numberDefined = false; - - public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; - private String applicationkey; - private boolean applicationkeyDefined = false; - - /** - * indicates the DID capability that needs to be assigned to the chosen application. Valid values - * are 'voice' and 'sms'. Please note that the DID needs to support the selected - * capability. - */ - public enum CapabilityEnum { - VOICE("voice"), - - SMS("sms"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - CapabilityEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static CapabilityEnum fromValue(String value) { - for (CapabilityEnum b : CapabilityEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_CAPABILITY = "capability"; - private String capability; - private boolean capabilityDefined = false; - - public GetNumbersResponseObjNumbersInnerDto() {} - - public GetNumbersResponseObjNumbersInnerDto number(String number) { - this.number = number; - this.numberDefined = true; - return this; - } - - /** - * Numbers that you own in E.164 format. - * - * @return number - */ - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNumber() { - return number; - } - - @JsonIgnore - public boolean getNumberDefined() { - return numberDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumber(String number) { - this.number = number; - this.numberDefined = true; - } - - public GetNumbersResponseObjNumbersInnerDto applicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - return this; - } - - /** - * Indicates the application where the number(s) will be assigned. If no number is assigned the - * applicationkey will not be returned. - * - * @return applicationkey - */ - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationkey() { - return applicationkey; - } - - @JsonIgnore - public boolean getApplicationkeyDefined() { - return applicationkeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - } - - public GetNumbersResponseObjNumbersInnerDto capability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - return this; - } - - /** - * indicates the DID capability that needs to be assigned to the chosen application. Valid values - * are 'voice' and 'sms'. Please note that the DID needs to support the selected - * capability. - * - * @return capability - */ - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCapability() { - return capability; - } - - @JsonIgnore - public boolean getCapabilityDefined() { - return capabilityDefined; - } - - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCapability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - } - - /** Return true if this getNumbersResponseObj_numbers_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; - } - GetNumbersResponseObjNumbersInnerDto getNumbersResponseObjNumbersInner = - (GetNumbersResponseObjNumbersInnerDto) o; - return Objects.equals(this.number, getNumbersResponseObjNumbersInner.number) - && Objects.equals(this.applicationkey, getNumbersResponseObjNumbersInner.applicationkey) - && Objects.equals(this.capability, getNumbersResponseObjNumbersInner.capability); - } - - @Override - public int hashCode() { - return Objects.hash(number, applicationkey, capability); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetNumbersResponseObjNumbersInnerDto {\n"); - sb.append(" number: ").append(toIndentedString(number)).append("\n"); - sb.append(" applicationkey: ").append(toIndentedString(applicationkey)).append("\n"); - sb.append(" capability: ").append(toIndentedString(capability)).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/voice/models/dto/v1/GetQueryNumberNumberDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetQueryNumberNumberDto.java deleted file mode 100644 index a80ef63b6..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetQueryNumberNumberDto.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** The number item object. */ -@JsonPropertyOrder({ - GetQueryNumberNumberDto.JSON_PROPERTY_COUNTRY_ID, - GetQueryNumberNumberDto.JSON_PROPERTY_NUMBER_TYPE, - GetQueryNumberNumberDto.JSON_PROPERTY_NORMALIZED_NUMBER, - GetQueryNumberNumberDto.JSON_PROPERTY_RESTRICTED, - GetQueryNumberNumberDto.JSON_PROPERTY_RATE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetQueryNumberNumberDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COUNTRY_ID = "countryId"; - private String countryId; - private boolean countryIdDefined = false; - - /** The type of the number. */ - public enum NumberTypeEnum { - UNKNOWN("Unknown"), - - FIXED("Fixed"), - - MOBILE("Mobile"), - - OTHER("Other"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NumberTypeEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NumberTypeEnum fromValue(String value) { - for (NumberTypeEnum b : NumberTypeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NUMBER_TYPE = "numberType"; - private String numberType; - private boolean numberTypeDefined = false; - - public static final String JSON_PROPERTY_NORMALIZED_NUMBER = "normalizedNumber"; - private String normalizedNumber; - private boolean normalizedNumberDefined = false; - - public static final String JSON_PROPERTY_RESTRICTED = "restricted"; - private Boolean restricted; - private boolean restrictedDefined = false; - - public static final String JSON_PROPERTY_RATE = "rate"; - private PriceDto rate; - private boolean rateDefined = false; - - public GetQueryNumberNumberDto() {} - - public GetQueryNumberNumberDto countryId(String countryId) { - this.countryId = countryId; - this.countryIdDefined = true; - return this; - } - - /** - * The ISO 3166-1 formatted country code. - * - * @return countryId - */ - @JsonProperty(JSON_PROPERTY_COUNTRY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCountryId() { - return countryId; - } - - @JsonIgnore - public boolean getCountryIdDefined() { - return countryIdDefined; - } - - @JsonProperty(JSON_PROPERTY_COUNTRY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCountryId(String countryId) { - this.countryId = countryId; - this.countryIdDefined = true; - } - - public GetQueryNumberNumberDto numberType(String numberType) { - this.numberType = numberType; - this.numberTypeDefined = true; - return this; - } - - /** - * The type of the number. - * - * @return numberType - */ - @JsonProperty(JSON_PROPERTY_NUMBER_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNumberType() { - return numberType; - } - - @JsonIgnore - public boolean getNumberTypeDefined() { - return numberTypeDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumberType(String numberType) { - this.numberType = numberType; - this.numberTypeDefined = true; - } - - public GetQueryNumberNumberDto normalizedNumber(String normalizedNumber) { - this.normalizedNumber = normalizedNumber; - this.normalizedNumberDefined = true; - return this; - } - - /** - * The number in E.164 format. - * - * @return normalizedNumber - */ - @JsonProperty(JSON_PROPERTY_NORMALIZED_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNormalizedNumber() { - return normalizedNumber; - } - - @JsonIgnore - public boolean getNormalizedNumberDefined() { - return normalizedNumberDefined; - } - - @JsonProperty(JSON_PROPERTY_NORMALIZED_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNormalizedNumber(String normalizedNumber) { - this.normalizedNumber = normalizedNumber; - this.normalizedNumberDefined = true; - } - - public GetQueryNumberNumberDto restricted(Boolean restricted) { - this.restricted = restricted; - this.restrictedDefined = true; - return this; - } - - /** - * Concerns whether the call is restricted or not. - * - * @return restricted - */ - @JsonProperty(JSON_PROPERTY_RESTRICTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getRestricted() { - return restricted; - } - - @JsonIgnore - public boolean getRestrictedDefined() { - return restrictedDefined; - } - - @JsonProperty(JSON_PROPERTY_RESTRICTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRestricted(Boolean restricted) { - this.restricted = restricted; - this.restrictedDefined = true; - } - - public GetQueryNumberNumberDto rate(PriceDto rate) { - this.rate = rate; - this.rateDefined = true; - return this; - } - - /** - * Get rate - * - * @return rate - */ - @JsonProperty(JSON_PROPERTY_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getRate() { - return rate; - } - - @JsonIgnore - public boolean getRateDefined() { - return rateDefined; - } - - @JsonProperty(JSON_PROPERTY_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRate(PriceDto rate) { - this.rate = rate; - this.rateDefined = true; - } - - /** Return true if this getQueryNumber_number object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetQueryNumberNumberDto getQueryNumberNumber = (GetQueryNumberNumberDto) o; - return Objects.equals(this.countryId, getQueryNumberNumber.countryId) - && Objects.equals(this.numberType, getQueryNumberNumber.numberType) - && Objects.equals(this.normalizedNumber, getQueryNumberNumber.normalizedNumber) - && Objects.equals(this.restricted, getQueryNumberNumber.restricted) - && Objects.equals(this.rate, getQueryNumberNumber.rate); - } - - @Override - public int hashCode() { - return Objects.hash(countryId, numberType, normalizedNumber, restricted, rate); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetQueryNumberNumberDto {\n"); - sb.append(" countryId: ").append(toIndentedString(countryId)).append("\n"); - sb.append(" numberType: ").append(toIndentedString(numberType)).append("\n"); - sb.append(" normalizedNumber: ").append(toIndentedString(normalizedNumber)).append("\n"); - sb.append(" restricted: ").append(toIndentedString(restricted)).append("\n"); - sb.append(" rate: ").append(toIndentedString(rate)).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/voice/models/dto/v1/GetRecordingFileInfoDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetRecordingFileInfoDto.java deleted file mode 100644 index b7cdd776f..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetRecordingFileInfoDto.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** GetRecordingFileInfoDto */ -@JsonPropertyOrder({ - GetRecordingFileInfoDto.JSON_PROPERTY_KEY, - GetRecordingFileInfoDto.JSON_PROPERTY_URL, - GetRecordingFileInfoDto.JSON_PROPERTY_CREATED_ON, - GetRecordingFileInfoDto.JSON_PROPERTY_EXPIRES_ON, - GetRecordingFileInfoDto.JSON_PROPERTY_HEADERS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetRecordingFileInfoDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_KEY = "key"; - private String key; - private boolean keyDefined = false; - - public static final String JSON_PROPERTY_URL = "url"; - private String url; - private boolean urlDefined = false; - - public static final String JSON_PROPERTY_CREATED_ON = "createdOn"; - private String createdOn; - private boolean createdOnDefined = false; - - public static final String JSON_PROPERTY_EXPIRES_ON = "expiresOn"; - private String expiresOn; - private boolean expiresOnDefined = false; - - public static final String JSON_PROPERTY_HEADERS = "headers"; - private Object headers; - private boolean headersDefined = false; - - public GetRecordingFileInfoDto() {} - - public GetRecordingFileInfoDto key(String key) { - this.key = key; - this.keyDefined = true; - return this; - } - - /** - * Get key - * - * @return key - */ - @JsonProperty(JSON_PROPERTY_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getKey() { - return key; - } - - @JsonIgnore - public boolean getKeyDefined() { - return keyDefined; - } - - @JsonProperty(JSON_PROPERTY_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setKey(String key) { - this.key = key; - this.keyDefined = true; - } - - public GetRecordingFileInfoDto url(String url) { - this.url = url; - this.urlDefined = true; - return this; - } - - /** - * Get url - * - * @return url - */ - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getUrl() { - return url; - } - - @JsonIgnore - public boolean getUrlDefined() { - return urlDefined; - } - - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUrl(String url) { - this.url = url; - this.urlDefined = true; - } - - public GetRecordingFileInfoDto createdOn(String createdOn) { - this.createdOn = createdOn; - this.createdOnDefined = true; - return this; - } - - /** - * Get createdOn - * - * @return createdOn - */ - @JsonProperty(JSON_PROPERTY_CREATED_ON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCreatedOn() { - return createdOn; - } - - @JsonIgnore - public boolean getCreatedOnDefined() { - return createdOnDefined; - } - - @JsonProperty(JSON_PROPERTY_CREATED_ON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCreatedOn(String createdOn) { - this.createdOn = createdOn; - this.createdOnDefined = true; - } - - public GetRecordingFileInfoDto expiresOn(String expiresOn) { - this.expiresOn = expiresOn; - this.expiresOnDefined = true; - return this; - } - - /** - * Get expiresOn - * - * @return expiresOn - */ - @JsonProperty(JSON_PROPERTY_EXPIRES_ON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getExpiresOn() { - return expiresOn; - } - - @JsonIgnore - public boolean getExpiresOnDefined() { - return expiresOnDefined; - } - - @JsonProperty(JSON_PROPERTY_EXPIRES_ON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExpiresOn(String expiresOn) { - this.expiresOn = expiresOn; - this.expiresOnDefined = true; - } - - public GetRecordingFileInfoDto headers(Object headers) { - this.headers = headers; - this.headersDefined = true; - return this; - } - - /** - * Get headers - * - * @return headers - */ - @JsonProperty(JSON_PROPERTY_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Object getHeaders() { - return headers; - } - - @JsonIgnore - public boolean getHeadersDefined() { - return headersDefined; - } - - @JsonProperty(JSON_PROPERTY_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setHeaders(Object headers) { - this.headers = headers; - this.headersDefined = true; - } - - /** Return true if this getRecordingFileInfo object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetRecordingFileInfoDto getRecordingFileInfo = (GetRecordingFileInfoDto) o; - return Objects.equals(this.key, getRecordingFileInfo.key) - && Objects.equals(this.url, getRecordingFileInfo.url) - && Objects.equals(this.createdOn, getRecordingFileInfo.createdOn) - && Objects.equals(this.expiresOn, getRecordingFileInfo.expiresOn) - && Objects.equals(this.headers, getRecordingFileInfo.headers); - } - - @Override - public int hashCode() { - return Objects.hash(key, url, createdOn, expiresOn, headers); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetRecordingFileInfoDto {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n"); - sb.append(" expiresOn: ").append(toIndentedString(expiresOn)).append("\n"); - sb.append(" headers: ").append(toIndentedString(headers)).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/voice/models/dto/v1/IceRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/IceRequestDto.java deleted file mode 100644 index 256220d78..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/IceRequestDto.java +++ /dev/null @@ -1,635 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** The request body of an Incoming Call Event. */ -@JsonPropertyOrder({ - IceRequestDto.JSON_PROPERTY_EVENT, - IceRequestDto.JSON_PROPERTY_TIMESTAMP, - IceRequestDto.JSON_PROPERTY_CUSTOM, - IceRequestDto.JSON_PROPERTY_APPLICATION_KEY, - IceRequestDto.JSON_PROPERTY_CALL_RESOURCE_URL, - IceRequestDto.JSON_PROPERTY_USER_RATE, - IceRequestDto.JSON_PROPERTY_CLI, - IceRequestDto.JSON_PROPERTY_TO, - IceRequestDto.JSON_PROPERTY_DOMAIN, - IceRequestDto.JSON_PROPERTY_ORIGINATION_TYPE, - IceRequestDto.JSON_PROPERTY_DURATION, - IceRequestDto.JSON_PROPERTY_RDNIS, - IceRequestDto.JSON_PROPERTY_CALL_HEADERS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -public class IceRequestDto extends WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - - /** Must have the value `ice`. */ - public enum EventEnum { - ICE("ice"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EventEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EventEnum fromValue(String value) { - for (EventEnum b : EventEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; - private String applicationKey; - private boolean applicationKeyDefined = false; - - public static final String JSON_PROPERTY_CALL_RESOURCE_URL = "callResourceUrl"; - private String callResourceUrl; - private boolean callResourceUrlDefined = false; - - public static final String JSON_PROPERTY_USER_RATE = "userRate"; - private PriceDto userRate; - private boolean userRateDefined = false; - - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_TO = "to"; - private DestinationDto to; - private boolean toDefined = false; - - public static final String JSON_PROPERTY_DOMAIN = "domain"; - private DomainDto domain; - private boolean domainDefined = false; - - public static final String JSON_PROPERTY_ORIGINATION_TYPE = "originationType"; - private DomainDto originationType; - private boolean originationTypeDefined = false; - - public static final String JSON_PROPERTY_DURATION = "duration"; - private Integer duration; - private boolean durationDefined = false; - - public static final String JSON_PROPERTY_RDNIS = "rdnis"; - private String rdnis; - private boolean rdnisDefined = false; - - public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; - private List callHeaders; - private boolean callHeadersDefined = false; - - public IceRequestDto() {} - - public IceRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `ice`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public IceRequestDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The timestamp in UTC format. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public IceRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public IceRequestDto applicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - return this; - } - - /** - * The unique application key. You can find it in the Sinch - * [dashboard](https://dashboard.sinch.com/voice/apps). - * - * @return applicationKey - */ - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationKey() { - return applicationKey; - } - - @JsonIgnore - public boolean getApplicationKeyDefined() { - return applicationKeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - } - - public IceRequestDto callResourceUrl(String callResourceUrl) { - this.callResourceUrl = callResourceUrl; - this.callResourceUrlDefined = true; - return this; - } - - /** - * The path of the API resource. - * - * @return callResourceUrl - */ - @JsonProperty(JSON_PROPERTY_CALL_RESOURCE_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallResourceUrl() { - return callResourceUrl; - } - - @JsonIgnore - public boolean getCallResourceUrlDefined() { - return callResourceUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_CALL_RESOURCE_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallResourceUrl(String callResourceUrl) { - this.callResourceUrl = callResourceUrl; - this.callResourceUrlDefined = true; - } - - public IceRequestDto userRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - return this; - } - - /** - * Get userRate - * - * @return userRate - */ - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PriceDto getUserRate() { - return userRate; - } - - @JsonIgnore - public boolean getUserRateDefined() { - return userRateDefined; - } - - @JsonProperty(JSON_PROPERTY_USER_RATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUserRate(PriceDto userRate) { - this.userRate = userRate; - this.userRateDefined = true; - } - - public IceRequestDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * 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 - * `connectPSTN` SVAML response to the Incoming Call Event request. It must be in - * [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public IceRequestDto to(DestinationDto to) { - this.to = to; - this.toDefined = true; - return this; - } - - /** - * Get to - * - * @return to - */ - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getTo() { - return to; - } - - @JsonIgnore - public boolean getToDefined() { - return toDefined; - } - - @JsonProperty(JSON_PROPERTY_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTo(DestinationDto to) { - this.to = to; - this.toDefined = true; - } - - public IceRequestDto domain(DomainDto domain) { - this.domain = domain; - this.domainDefined = true; - return this; - } - - /** - * Get domain - * - * @return domain - */ - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DomainDto getDomain() { - return domain; - } - - @JsonIgnore - public boolean getDomainDefined() { - return domainDefined; - } - - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDomain(DomainDto domain) { - this.domain = domain; - this.domainDefined = true; - } - - public IceRequestDto originationType(DomainDto originationType) { - this.originationType = originationType; - this.originationTypeDefined = true; - return this; - } - - /** - * Get originationType - * - * @return originationType - */ - @JsonProperty(JSON_PROPERTY_ORIGINATION_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DomainDto getOriginationType() { - return originationType; - } - - @JsonIgnore - public boolean getOriginationTypeDefined() { - return originationTypeDefined; - } - - @JsonProperty(JSON_PROPERTY_ORIGINATION_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOriginationType(DomainDto originationType) { - this.originationType = originationType; - this.originationTypeDefined = true; - } - - public IceRequestDto duration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - return this; - } - - /** - * The duration of the call in seconds. - * - * @return duration - */ - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDuration() { - return duration; - } - - @JsonIgnore - public boolean getDurationDefined() { - return durationDefined; - } - - @JsonProperty(JSON_PROPERTY_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDuration(Integer duration) { - this.duration = duration; - this.durationDefined = true; - } - - public IceRequestDto rdnis(String rdnis) { - this.rdnis = rdnis; - this.rdnisDefined = true; - return this; - } - - /** - * The redirected dialled number identification service. - * - * @return rdnis - */ - @JsonProperty(JSON_PROPERTY_RDNIS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getRdnis() { - return rdnis; - } - - @JsonIgnore - public boolean getRdnisDefined() { - return rdnisDefined; - } - - @JsonProperty(JSON_PROPERTY_RDNIS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRdnis(String rdnis) { - this.rdnis = rdnis; - this.rdnisDefined = true; - } - - public IceRequestDto callHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - return this; - } - - public IceRequestDto addCallHeadersItem(CallHeaderDto callHeadersItem) { - if (this.callHeaders == null) { - this.callHeaders = new ArrayList<>(); - } - this.callHeadersDefined = true; - this.callHeaders.add(callHeadersItem); - return this; - } - - /** - * 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](../../../call-headers). - * - * @return callHeaders - */ - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getCallHeaders() { - return callHeaders; - } - - @JsonIgnore - public boolean getCallHeadersDefined() { - return callHeadersDefined; - } - - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - } - - @Override - public IceRequestDto callid(String callid) { - this.setCallid(callid); - return this; - } - - @Override - public IceRequestDto version(Integer version) { - this.setVersion(version); - return this; - } - - /** Return true if this iceRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IceRequestDto iceRequest = (IceRequestDto) o; - return Objects.equals(this.event, iceRequest.event) - && Objects.equals(this.timestamp, iceRequest.timestamp) - && Objects.equals(this.custom, iceRequest.custom) - && Objects.equals(this.applicationKey, iceRequest.applicationKey) - && Objects.equals(this.callResourceUrl, iceRequest.callResourceUrl) - && Objects.equals(this.userRate, iceRequest.userRate) - && Objects.equals(this.cli, iceRequest.cli) - && Objects.equals(this.to, iceRequest.to) - && Objects.equals(this.domain, iceRequest.domain) - && Objects.equals(this.originationType, iceRequest.originationType) - && Objects.equals(this.duration, iceRequest.duration) - && Objects.equals(this.rdnis, iceRequest.rdnis) - && Objects.equals(this.callHeaders, iceRequest.callHeaders) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash( - event, - timestamp, - custom, - applicationKey, - callResourceUrl, - userRate, - cli, - to, - domain, - originationType, - duration, - rdnis, - callHeaders, - super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IceRequestDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); - sb.append(" callResourceUrl: ").append(toIndentedString(callResourceUrl)).append("\n"); - sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" to: ").append(toIndentedString(to)).append("\n"); - sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); - sb.append(" originationType: ").append(toIndentedString(originationType)).append("\n"); - sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); - sb.append(" rdnis: ").append(toIndentedString(rdnis)).append("\n"); - sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).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("iceRequest", IceRequestDto.class); - JSONNavigator.registerDiscriminator(IceRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ManageConferenceParticipantRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ManageConferenceParticipantRequestDto.java deleted file mode 100644 index dc6144191..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/ManageConferenceParticipantRequestDto.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** */ -@JsonPropertyOrder({ - ManageConferenceParticipantRequestDto.JSON_PROPERTY_COMMAND, - ManageConferenceParticipantRequestDto.JSON_PROPERTY_MOH -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ManageConferenceParticipantRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_COMMAND = "command"; - private String command; - private boolean commandDefined = false; - - public static final String JSON_PROPERTY_MOH = "moh"; - private String moh; - private boolean mohDefined = false; - - public ManageConferenceParticipantRequestDto() {} - - public ManageConferenceParticipantRequestDto command(String command) { - this.command = command; - this.commandDefined = true; - return this; - } - - /** - * Action to apply on conference participant. - * - * @return command - */ - @JsonProperty(JSON_PROPERTY_COMMAND) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getCommand() { - return command; - } - - @JsonIgnore - public boolean getCommandDefined() { - return commandDefined; - } - - @JsonProperty(JSON_PROPERTY_COMMAND) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setCommand(String command) { - this.command = command; - this.commandDefined = true; - } - - public ManageConferenceParticipantRequestDto moh(String moh) { - this.moh = moh; - this.mohDefined = true; - return this; - } - - /** - * Means \"music on hold\". 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 `moh` 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 moh - */ - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMoh() { - return moh; - } - - @JsonIgnore - public boolean getMohDefined() { - return mohDefined; - } - - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMoh(String moh) { - this.moh = moh; - this.mohDefined = true; - } - - /** Return true if this manageConferenceParticipantRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ManageConferenceParticipantRequestDto manageConferenceParticipantRequest = - (ManageConferenceParticipantRequestDto) o; - return Objects.equals(this.command, manageConferenceParticipantRequest.command) - && Objects.equals(this.moh, manageConferenceParticipantRequest.moh); - } - - @Override - public int hashCode() { - return Objects.hash(command, moh); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ManageConferenceParticipantRequestDto {\n"); - sb.append(" command: ").append(toIndentedString(command)).append("\n"); - sb.append(" moh: ").append(toIndentedString(moh)).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/voice/models/dto/v1/MenuDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/MenuDto.java deleted file mode 100644 index 137c70a5e..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/MenuDto.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** An IVR menu that contains an audio prompt as well as configured options. */ -@JsonPropertyOrder({ - MenuDto.JSON_PROPERTY_ID, - MenuDto.JSON_PROPERTY_MAIN_PROMPT, - MenuDto.JSON_PROPERTY_REPEAT_PROMPT, - MenuDto.JSON_PROPERTY_REPEATS, - MenuDto.JSON_PROPERTY_MAX_DIGITS, - MenuDto.JSON_PROPERTY_TIMEOUT_MILLS, - MenuDto.JSON_PROPERTY_MAX_TIMEOUT_MILLS, - MenuDto.JSON_PROPERTY_OPTIONS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MenuDto { - 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_MAIN_PROMPT = "mainPrompt"; - private String mainPrompt; - private boolean mainPromptDefined = false; - - public static final String JSON_PROPERTY_REPEAT_PROMPT = "repeatPrompt"; - private String repeatPrompt; - private boolean repeatPromptDefined = false; - - public static final String JSON_PROPERTY_REPEATS = "repeats"; - private Integer repeats; - private boolean repeatsDefined = false; - - public static final String JSON_PROPERTY_MAX_DIGITS = "maxDigits"; - private Integer maxDigits; - private boolean maxDigitsDefined = false; - - public static final String JSON_PROPERTY_TIMEOUT_MILLS = "timeoutMills"; - private Integer timeoutMills; - private boolean timeoutMillsDefined = false; - - public static final String JSON_PROPERTY_MAX_TIMEOUT_MILLS = "maxTimeoutMills"; - private Integer maxTimeoutMills; - private boolean maxTimeoutMillsDefined = false; - - public static final String JSON_PROPERTY_OPTIONS = "options"; - private List options; - private boolean optionsDefined = false; - - public MenuDto() {} - - public MenuDto id(String id) { - this.id = id; - this.idDefined = true; - return this; - } - - /** - * The identifier of a menu. One menu must have the ID value of `main`. - * - * @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 MenuDto mainPrompt(String mainPrompt) { - this.mainPrompt = mainPrompt; - this.mainPromptDefined = true; - return this; - } - - /** - * The main voice prompt that the user hears when the menu starts the first time. You can use - * text-to-speech using the `#tts[]` element, SSML commands using the - * `#ssml[]` element, pre-recorded messages, or URL references to external media - * resources. You can use multiple prompts by separating each prompt with a semi-colon - * (`;`). If multiple prompts are used, they will be played in the order they are - * specified, without any pauses between playback. For external media resources, you can use an - * `#href[...]` or directly specify the full URL. Check the [Supported audio - * formats](/docs/voice/api-reference/supported-audio-formats) section for more information. - * - * @return mainPrompt - */ - @JsonProperty(JSON_PROPERTY_MAIN_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMainPrompt() { - return mainPrompt; - } - - @JsonIgnore - public boolean getMainPromptDefined() { - return mainPromptDefined; - } - - @JsonProperty(JSON_PROPERTY_MAIN_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMainPrompt(String mainPrompt) { - this.mainPrompt = mainPrompt; - this.mainPromptDefined = true; - } - - public MenuDto repeatPrompt(String repeatPrompt) { - this.repeatPrompt = repeatPrompt; - this.repeatPromptDefined = true; - return this; - } - - /** - * The prompt that will be played if valid or expected DTMF digits are not entered. You can use - * text-to-speech using the `#tts[]` element, SSML commands using the - * `#ssml[]` element, pre-recorded messages, or URL references to external media - * resources. You can use multiple prompts by separating each prompt with a semi-colon - * (`;`). If multiple prompts are used, they will be played in the order they are - * specified, without any pauses between playback. For external media resources, you can use an - * `#href[...]` or directly specify the full URL. Check the [Supported audio - * formats](/docs/voice/api-reference/supported-audio-formats) section for more information. - * - * @return repeatPrompt - */ - @JsonProperty(JSON_PROPERTY_REPEAT_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getRepeatPrompt() { - return repeatPrompt; - } - - @JsonIgnore - public boolean getRepeatPromptDefined() { - return repeatPromptDefined; - } - - @JsonProperty(JSON_PROPERTY_REPEAT_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRepeatPrompt(String repeatPrompt) { - this.repeatPrompt = repeatPrompt; - this.repeatPromptDefined = true; - } - - public MenuDto repeats(Integer repeats) { - this.repeats = repeats; - this.repeatsDefined = true; - return this; - } - - /** - * The number of times that the `repeatPrompt` is played. - * - * @return repeats - */ - @JsonProperty(JSON_PROPERTY_REPEATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getRepeats() { - return repeats; - } - - @JsonIgnore - public boolean getRepeatsDefined() { - return repeatsDefined; - } - - @JsonProperty(JSON_PROPERTY_REPEATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setRepeats(Integer repeats) { - this.repeats = repeats; - this.repeatsDefined = true; - } - - public MenuDto maxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - return this; - } - - /** - * The maximum number of digits expected for a user to enter. Once these digits are collected, a - * [Prompt Input Event (PIE)](../../voice/tag/Callbacks/#tag/Callbacks/operation/pie) is triggered - * containing these digits. - * - * @return maxDigits - */ - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDigits() { - return maxDigits; - } - - @JsonIgnore - public boolean getMaxDigitsDefined() { - return maxDigitsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - } - - public MenuDto timeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - return this; - } - - /** - * Determines silence for the purposes of collecting a DTMF or voice response in milliseconds. If - * the timeout is reached, the response is considered completed and will be submitted. - * - * @return timeoutMills - */ - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getTimeoutMills() { - return timeoutMills; - } - - @JsonIgnore - public boolean getTimeoutMillsDefined() { - return timeoutMillsDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - } - - public MenuDto maxTimeoutMills(Integer maxTimeoutMills) { - this.maxTimeoutMills = maxTimeoutMills; - this.maxTimeoutMillsDefined = true; - return this; - } - - /** - * Sets a limit for the maximum amount of time allowed to collect voice input. - * - * @return maxTimeoutMills - */ - @JsonProperty(JSON_PROPERTY_MAX_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxTimeoutMills() { - return maxTimeoutMills; - } - - @JsonIgnore - public boolean getMaxTimeoutMillsDefined() { - return maxTimeoutMillsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxTimeoutMills(Integer maxTimeoutMills) { - this.maxTimeoutMills = maxTimeoutMills; - this.maxTimeoutMillsDefined = true; - } - - public MenuDto options(List options) { - this.options = options; - this.optionsDefined = true; - return this; - } - - public MenuDto addOptionsItem(OptionDto optionsItem) { - if (this.options == null) { - this.options = new ArrayList<>(); - } - this.optionsDefined = true; - this.options.add(optionsItem); - return this; - } - - /** - * The set of options available in the menu. - * - * @return options - */ - @JsonProperty(JSON_PROPERTY_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getOptions() { - return options; - } - - @JsonIgnore - public boolean getOptionsDefined() { - return optionsDefined; - } - - @JsonProperty(JSON_PROPERTY_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(List options) { - this.options = options; - this.optionsDefined = true; - } - - /** Return true if this menu object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MenuDto menu = (MenuDto) o; - return Objects.equals(this.id, menu.id) - && Objects.equals(this.mainPrompt, menu.mainPrompt) - && Objects.equals(this.repeatPrompt, menu.repeatPrompt) - && Objects.equals(this.repeats, menu.repeats) - && Objects.equals(this.maxDigits, menu.maxDigits) - && Objects.equals(this.timeoutMills, menu.timeoutMills) - && Objects.equals(this.maxTimeoutMills, menu.maxTimeoutMills) - && Objects.equals(this.options, menu.options); - } - - @Override - public int hashCode() { - return Objects.hash( - id, mainPrompt, repeatPrompt, repeats, maxDigits, timeoutMills, maxTimeoutMills, options); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MenuDto {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" mainPrompt: ").append(toIndentedString(mainPrompt)).append("\n"); - sb.append(" repeatPrompt: ").append(toIndentedString(repeatPrompt)).append("\n"); - sb.append(" repeats: ").append(toIndentedString(repeats)).append("\n"); - sb.append(" maxDigits: ").append(toIndentedString(maxDigits)).append("\n"); - sb.append(" timeoutMills: ").append(toIndentedString(timeoutMills)).append("\n"); - sb.append(" maxTimeoutMills: ").append(toIndentedString(maxTimeoutMills)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).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/voice/models/dto/v1/NotifyErrorRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/NotifyErrorRequestDto.java deleted file mode 100644 index 4eb42d8eb..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/NotifyErrorRequestDto.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 request body of Notify Event notifying of an error. */ -@JsonPropertyOrder({ - NotifyErrorRequestDto.JSON_PROPERTY_EVENT, - NotifyErrorRequestDto.JSON_PROPERTY_VERSION, - NotifyErrorRequestDto.JSON_PROPERTY_TYPE, - NotifyErrorRequestDto.JSON_PROPERTY_CALLID, - NotifyErrorRequestDto.JSON_PROPERTY_ERROR_CODE, - NotifyErrorRequestDto.JSON_PROPERTY_ERROR_MSG, - NotifyErrorRequestDto.JSON_PROPERTY_USER, - NotifyErrorRequestDto.JSON_PROPERTY_CUSTOM -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class NotifyErrorRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_VERSION = "version"; - private Integer version; - private boolean versionDefined = false; - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CALLID = "callid"; - private String callid; - private boolean callidDefined = false; - - public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; - private Integer errorCode; - private boolean errorCodeDefined = false; - - public static final String JSON_PROPERTY_ERROR_MSG = "errorMsg"; - private String errorMsg; - private boolean errorMsgDefined = false; - - public static final String JSON_PROPERTY_USER = "user"; - private String user; - private boolean userDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public NotifyErrorRequestDto() {} - - public NotifyErrorRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `notify`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public NotifyErrorRequestDto version(Integer version) { - this.version = version; - this.versionDefined = true; - return this; - } - - /** - * The current API version. - * - * @return version - */ - @JsonProperty(JSON_PROPERTY_VERSION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getVersion() { - return version; - } - - @JsonIgnore - public boolean getVersionDefined() { - return versionDefined; - } - - @JsonProperty(JSON_PROPERTY_VERSION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setVersion(Integer version) { - this.version = version; - this.versionDefined = true; - } - - public NotifyErrorRequestDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * The type of information communicated in the notification. Must have the value - * `callingerror`. - * - * @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 NotifyErrorRequestDto callid(String callid) { - this.callid = callid; - this.callidDefined = true; - return this; - } - - /** - * The unique ID assigned to this call. - * - * @return callid - */ - @JsonProperty(JSON_PROPERTY_CALLID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallid() { - return callid; - } - - @JsonIgnore - public boolean getCallidDefined() { - return callidDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallid(String callid) { - this.callid = callid; - this.callidDefined = true; - } - - public NotifyErrorRequestDto errorCode(Integer errorCode) { - this.errorCode = errorCode; - this.errorCodeDefined = true; - return this; - } - - /** - * The error code of the error. - * - * @return errorCode - */ - @JsonProperty(JSON_PROPERTY_ERROR_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getErrorCode() { - return errorCode; - } - - @JsonIgnore - public boolean getErrorCodeDefined() { - return errorCodeDefined; - } - - @JsonProperty(JSON_PROPERTY_ERROR_CODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - this.errorCodeDefined = true; - } - - public NotifyErrorRequestDto errorMsg(String errorMsg) { - this.errorMsg = errorMsg; - this.errorMsgDefined = true; - return this; - } - - /** - * The error message of the error. - * - * @return errorMsg - */ - @JsonProperty(JSON_PROPERTY_ERROR_MSG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getErrorMsg() { - return errorMsg; - } - - @JsonIgnore - public boolean getErrorMsgDefined() { - return errorMsgDefined; - } - - @JsonProperty(JSON_PROPERTY_ERROR_MSG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - this.errorMsgDefined = true; - } - - public NotifyErrorRequestDto user(String user) { - this.user = user; - this.userDefined = true; - return this; - } - - /** - * The user ID that initiated the call. - * - * @return user - */ - @JsonProperty(JSON_PROPERTY_USER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getUser() { - return user; - } - - @JsonIgnore - public boolean getUserDefined() { - return userDefined; - } - - @JsonProperty(JSON_PROPERTY_USER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUser(String user) { - this.user = user; - this.userDefined = true; - } - - public NotifyErrorRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * An optional parameter containing notification-specific information. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - /** Return true if this notifyErrorRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - NotifyErrorRequestDto notifyErrorRequest = (NotifyErrorRequestDto) o; - return Objects.equals(this.event, notifyErrorRequest.event) - && Objects.equals(this.version, notifyErrorRequest.version) - && Objects.equals(this.type, notifyErrorRequest.type) - && Objects.equals(this.callid, notifyErrorRequest.callid) - && Objects.equals(this.errorCode, notifyErrorRequest.errorCode) - && Objects.equals(this.errorMsg, notifyErrorRequest.errorMsg) - && Objects.equals(this.user, notifyErrorRequest.user) - && Objects.equals(this.custom, notifyErrorRequest.custom); - } - - @Override - public int hashCode() { - return Objects.hash(event, version, type, callid, errorCode, errorMsg, user, custom); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class NotifyErrorRequestDto {\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); - sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); - sb.append(" errorMsg: ").append(toIndentedString(errorMsg)).append("\n"); - sb.append(" user: ").append(toIndentedString(user)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).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/voice/models/dto/v1/NotifyRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/NotifyRequestDto.java deleted file mode 100644 index f91e29a14..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/NotifyRequestDto.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** The request body of a Notify Event. */ -@JsonPropertyOrder({ - NotifyRequestDto.JSON_PROPERTY_EVENT, - NotifyRequestDto.JSON_PROPERTY_TYPE, - NotifyRequestDto.JSON_PROPERTY_CUSTOM -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -public class NotifyRequestDto extends WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - - /** Must have the value `notify`. */ - public enum EventEnum { - NOTIFY("notify"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EventEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EventEnum fromValue(String value) { - for (EventEnum b : EventEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_TYPE = "type"; - private String type; - private boolean typeDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public NotifyRequestDto() {} - - public NotifyRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `notify`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public NotifyRequestDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * The type of information communicated in the notification. - * - * @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 NotifyRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * An optional parameter containing notification-specific information. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - @Override - public NotifyRequestDto callid(String callid) { - this.setCallid(callid); - return this; - } - - @Override - public NotifyRequestDto version(Integer version) { - this.setVersion(version); - return this; - } - - /** Return true if this notifyRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - NotifyRequestDto notifyRequest = (NotifyRequestDto) o; - return Objects.equals(this.event, notifyRequest.event) - && Objects.equals(this.type, notifyRequest.type) - && Objects.equals(this.custom, notifyRequest.custom) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(event, type, custom, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class NotifyRequestDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).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("notifyRequest", NotifyRequestDto.class); - JSONNavigator.registerDiscriminator(NotifyRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PieRequestAllOfMenuResultDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PieRequestAllOfMenuResultDto.java deleted file mode 100644 index c2fe826e7..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PieRequestAllOfMenuResultDto.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** An object containing information about the returned menu result. */ -@JsonPropertyOrder({ - PieRequestAllOfMenuResultDto.JSON_PROPERTY_MENU_ID, - PieRequestAllOfMenuResultDto.JSON_PROPERTY_TYPE, - PieRequestAllOfMenuResultDto.JSON_PROPERTY_VALUE, - PieRequestAllOfMenuResultDto.JSON_PROPERTY_INPUT_METHOD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class PieRequestAllOfMenuResultDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_MENU_ID = "menuId"; - private String menuId; - private boolean menuIdDefined = false; - - /** The type of information that's returned. */ - public enum TypeEnum { - ERROR("error"), - - RETURN("return"), - - SEQUENCE("sequence"), - - TIMEOUT("timeout"), - - HANGUP("hangup"), - - INVALIDINPUT("invalidinput"), - - 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_VALUE = "value"; - private String value; - private boolean valueDefined = false; - - public static final String JSON_PROPERTY_INPUT_METHOD = "inputMethod"; - private String inputMethod; - private boolean inputMethodDefined = false; - - public PieRequestAllOfMenuResultDto() {} - - public PieRequestAllOfMenuResultDto menuId(String menuId) { - this.menuId = menuId; - this.menuIdDefined = true; - return this; - } - - /** - * The ID of the menu that triggered the prompt input event. - * - * @return menuId - */ - @JsonProperty(JSON_PROPERTY_MENU_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMenuId() { - return menuId; - } - - @JsonIgnore - public boolean getMenuIdDefined() { - return menuIdDefined; - } - - @JsonProperty(JSON_PROPERTY_MENU_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMenuId(String menuId) { - this.menuId = menuId; - this.menuIdDefined = true; - } - - public PieRequestAllOfMenuResultDto type(String type) { - this.type = type; - this.typeDefined = true; - return this; - } - - /** - * The type of information that's returned. - * - * @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 PieRequestAllOfMenuResultDto value(String value) { - this.value = value; - this.valueDefined = true; - return this; - } - - /** - * The value of the returned information. - * - * @return value - */ - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getValue() { - return value; - } - - @JsonIgnore - public boolean getValueDefined() { - return valueDefined; - } - - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setValue(String value) { - this.value = value; - this.valueDefined = true; - } - - public PieRequestAllOfMenuResultDto inputMethod(String inputMethod) { - this.inputMethod = inputMethod; - this.inputMethodDefined = true; - return this; - } - - /** - * The type of input received. - * - * @return inputMethod - */ - @JsonProperty(JSON_PROPERTY_INPUT_METHOD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getInputMethod() { - return inputMethod; - } - - @JsonIgnore - public boolean getInputMethodDefined() { - return inputMethodDefined; - } - - @JsonProperty(JSON_PROPERTY_INPUT_METHOD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setInputMethod(String inputMethod) { - this.inputMethod = inputMethod; - this.inputMethodDefined = true; - } - - /** Return true if this pieRequest_allOf_menuResult object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PieRequestAllOfMenuResultDto pieRequestAllOfMenuResult = (PieRequestAllOfMenuResultDto) o; - return Objects.equals(this.menuId, pieRequestAllOfMenuResult.menuId) - && Objects.equals(this.type, pieRequestAllOfMenuResult.type) - && Objects.equals(this.value, pieRequestAllOfMenuResult.value) - && Objects.equals(this.inputMethod, pieRequestAllOfMenuResult.inputMethod); - } - - @Override - public int hashCode() { - return Objects.hash(menuId, type, value, inputMethod); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PieRequestAllOfMenuResultDto {\n"); - sb.append(" menuId: ").append(toIndentedString(menuId)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" inputMethod: ").append(toIndentedString(inputMethod)).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/voice/models/dto/v1/PieRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PieRequestDto.java deleted file mode 100644 index ea2a446f0..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PieRequestDto.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** The request body of a Prompt Input Event. */ -@JsonPropertyOrder({ - PieRequestDto.JSON_PROPERTY_EVENT, - PieRequestDto.JSON_PROPERTY_TIMESTAMP, - PieRequestDto.JSON_PROPERTY_MENU_RESULT, - PieRequestDto.JSON_PROPERTY_CUSTOM, - PieRequestDto.JSON_PROPERTY_APPLICATION_KEY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -public class PieRequestDto extends WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - - /** Must have the value `pie`. */ - public enum EventEnum { - PIE("pie"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - EventEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static EventEnum fromValue(String value) { - for (EventEnum b : EventEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_MENU_RESULT = "menuResult"; - private PieRequestAllOfMenuResultDto menuResult; - private boolean menuResultDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; - private String applicationKey; - private boolean applicationKeyDefined = false; - - public PieRequestDto() {} - - public PieRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Must have the value `pie`. - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public PieRequestDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The timestamp in UTC format. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public PieRequestDto menuResult(PieRequestAllOfMenuResultDto menuResult) { - this.menuResult = menuResult; - this.menuResultDefined = true; - return this; - } - - /** - * Get menuResult - * - * @return menuResult - */ - @JsonProperty(JSON_PROPERTY_MENU_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public PieRequestAllOfMenuResultDto getMenuResult() { - return menuResult; - } - - @JsonIgnore - public boolean getMenuResultDefined() { - return menuResultDefined; - } - - @JsonProperty(JSON_PROPERTY_MENU_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMenuResult(PieRequestAllOfMenuResultDto menuResult) { - this.menuResult = menuResult; - this.menuResultDefined = true; - } - - public PieRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public PieRequestDto applicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - return this; - } - - /** - * The unique application key. You can find it in the Sinch - * [dashboard](https://dashboard.sinch.com/voice/apps). - * - * @return applicationKey - */ - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationKey() { - return applicationKey; - } - - @JsonIgnore - public boolean getApplicationKeyDefined() { - return applicationKeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - } - - @Override - public PieRequestDto callid(String callid) { - this.setCallid(callid); - return this; - } - - @Override - public PieRequestDto version(Integer version) { - this.setVersion(version); - return this; - } - - /** Return true if this pieRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PieRequestDto pieRequest = (PieRequestDto) o; - return Objects.equals(this.event, pieRequest.event) - && Objects.equals(this.timestamp, pieRequest.timestamp) - && Objects.equals(this.menuResult, pieRequest.menuResult) - && Objects.equals(this.custom, pieRequest.custom) - && Objects.equals(this.applicationKey, pieRequest.applicationKey) - && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(event, timestamp, menuResult, custom, applicationKey, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PieRequestDto {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" menuResult: ").append(toIndentedString(menuResult)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).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("pieRequest", PieRequestDto.class); - JSONNavigator.registerDiscriminator(PieRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SVAMLRequestBodyDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SVAMLRequestBodyDto.java deleted file mode 100644 index dce7862d1..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SVAMLRequestBodyDto.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * SVAML is a call control markup language. When a server receives a callback event from the Sinch - * platform, it can respond with a SVAML object to control the voice call. The following is an - * example of a SVAML object type and its contents. - */ -@JsonPropertyOrder({ - SVAMLRequestBodyDto.JSON_PROPERTY_INSTRUCTIONS, - SVAMLRequestBodyDto.JSON_PROPERTY_ACTION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SVAMLRequestBodyDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_INSTRUCTIONS = "instructions"; - private List instructions; - private boolean instructionsDefined = false; - - public static final String JSON_PROPERTY_ACTION = "action"; - private SvamlActionDto action; - private boolean actionDefined = false; - - public SVAMLRequestBodyDto() {} - - public SVAMLRequestBodyDto instructions(List instructions) { - this.instructions = instructions; - this.instructionsDefined = true; - return this; - } - - public SVAMLRequestBodyDto addInstructionsItem(SvamlInstructionDto instructionsItem) { - if (this.instructions == null) { - this.instructions = new ArrayList<>(); - } - this.instructionsDefined = true; - this.instructions.add(instructionsItem); - return this; - } - - /** - * The collection of instructions that can perform various tasks during the call. You can include - * as many instructions as necessary. - * - * @return instructions - */ - @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getInstructions() { - return instructions; - } - - @JsonIgnore - public boolean getInstructionsDefined() { - return instructionsDefined; - } - - @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setInstructions(List instructions) { - this.instructions = instructions; - this.instructionsDefined = true; - } - - public SVAMLRequestBodyDto action(SvamlActionDto action) { - this.action = action; - this.actionDefined = true; - return this; - } - - /** - * Get action - * - * @return action - */ - @JsonProperty(JSON_PROPERTY_ACTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public SvamlActionDto getAction() { - return action; - } - - @JsonIgnore - public boolean getActionDefined() { - return actionDefined; - } - - @JsonProperty(JSON_PROPERTY_ACTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAction(SvamlActionDto action) { - this.action = action; - this.actionDefined = true; - } - - /** Return true if this SVAMLRequestBody object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SVAMLRequestBodyDto svAMLRequestBody = (SVAMLRequestBodyDto) o; - return Objects.equals(this.instructions, svAMLRequestBody.instructions) - && Objects.equals(this.action, svAMLRequestBody.action); - } - - @Override - public int hashCode() { - return Objects.hash(instructions, action); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SVAMLRequestBodyDto {\n"); - sb.append(" instructions: ").append(toIndentedString(instructions)).append("\n"); - sb.append(" action: ").append(toIndentedString(action)).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/voice/models/dto/v1/SvamlActionConnectConfConferenceDtmfOptionsDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectConfConferenceDtmfOptionsDto.java deleted file mode 100644 index 8f8cc9114..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectConfConferenceDtmfOptionsDto.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Options to control how DTMF signals are used by the participant in the conference. For - * information on how to use this feature, read more [here](../../conference-dtmf). - */ -@JsonPropertyOrder({ - SvamlActionConnectConfConferenceDtmfOptionsDto.JSON_PROPERTY_MODE, - SvamlActionConnectConfConferenceDtmfOptionsDto.JSON_PROPERTY_MAX_DIGITS, - SvamlActionConnectConfConferenceDtmfOptionsDto.JSON_PROPERTY_TIMEOUT_MILLS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectConfConferenceDtmfOptionsDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_MODE = "mode"; - private String mode; - private boolean modeDefined = false; - - public static final String JSON_PROPERTY_MAX_DIGITS = "maxDigits"; - private Integer maxDigits; - private boolean maxDigitsDefined = false; - - public static final String JSON_PROPERTY_TIMEOUT_MILLS = "timeoutMills"; - private Integer timeoutMills; - private boolean timeoutMillsDefined = false; - - public SvamlActionConnectConfConferenceDtmfOptionsDto() {} - - public SvamlActionConnectConfConferenceDtmfOptionsDto mode(String mode) { - this.mode = mode; - this.modeDefined = true; - return this; - } - - /** - * Determines what DTMF mode the participant will use in the call. - * - * @return mode - */ - @JsonProperty(JSON_PROPERTY_MODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMode() { - return mode; - } - - @JsonIgnore - public boolean getModeDefined() { - return modeDefined; - } - - @JsonProperty(JSON_PROPERTY_MODE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMode(String mode) { - this.mode = mode; - this.modeDefined = true; - } - - public SvamlActionConnectConfConferenceDtmfOptionsDto maxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - 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. - * - * @return maxDigits - */ - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDigits() { - return maxDigits; - } - - @JsonIgnore - public boolean getMaxDigitsDefined() { - return maxDigitsDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DIGITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDigits(Integer maxDigits) { - this.maxDigits = maxDigits; - this.maxDigitsDefined = true; - } - - public SvamlActionConnectConfConferenceDtmfOptionsDto timeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - return this; - } - - /** - * The number of milliseconds that the system will wait between entered digits before triggering - * the PIE callback. The default value is `3000`. - * - * @return timeoutMills - */ - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getTimeoutMills() { - return timeoutMills; - } - - @JsonIgnore - public boolean getTimeoutMillsDefined() { - return timeoutMillsDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimeoutMills(Integer timeoutMills) { - this.timeoutMills = timeoutMills; - this.timeoutMillsDefined = true; - } - - /** Return true if this svaml_action_connectConf_conferenceDtmfOptions object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionConnectConfConferenceDtmfOptionsDto svamlActionConnectConfConferenceDtmfOptions = - (SvamlActionConnectConfConferenceDtmfOptionsDto) o; - return Objects.equals(this.mode, svamlActionConnectConfConferenceDtmfOptions.mode) - && Objects.equals(this.maxDigits, svamlActionConnectConfConferenceDtmfOptions.maxDigits) - && Objects.equals( - this.timeoutMills, svamlActionConnectConfConferenceDtmfOptions.timeoutMills); - } - - @Override - public int hashCode() { - return Objects.hash(mode, maxDigits, timeoutMills); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectConfConferenceDtmfOptionsDto {\n"); - sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); - sb.append(" maxDigits: ").append(toIndentedString(maxDigits)).append("\n"); - sb.append(" timeoutMills: ").append(toIndentedString(timeoutMills)).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/voice/models/dto/v1/SvamlActionConnectConfDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectConfDto.java deleted file mode 100644 index 67bf0caba..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectConfDto.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Connects an incoming call to a conference. Available to use in a response to an [Incoming Call - * Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. - */ -@JsonPropertyOrder({ - SvamlActionConnectConfDto.JSON_PROPERTY_NAME, - SvamlActionConnectConfDto.JSON_PROPERTY_CONFERENCE_ID, - SvamlActionConnectConfDto.JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS, - SvamlActionConnectConfDto.JSON_PROPERTY_MOH -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectConfDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `connectConf`. */ - public enum NameEnum { - CONNECTCONF("connectConf"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_CONFERENCE_ID = "conferenceId"; - private String conferenceId; - private boolean conferenceIdDefined = false; - - public static final String JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS = "conferenceDtmfOptions"; - private SvamlActionConnectConfConferenceDtmfOptionsDto conferenceDtmfOptions; - private boolean conferenceDtmfOptionsDefined = false; - - public static final String JSON_PROPERTY_MOH = "moh"; - private String moh; - private boolean mohDefined = false; - - public SvamlActionConnectConfDto() {} - - public SvamlActionConnectConfDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `connectConf`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionConnectConfDto conferenceId(String conferenceId) { - this.conferenceId = conferenceId; - this.conferenceIdDefined = true; - return this; - } - - /** - * The unique identifier of the conference. Shouldn't exceed 64 characters. - * - * @return conferenceId - */ - @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getConferenceId() { - return conferenceId; - } - - @JsonIgnore - public boolean getConferenceIdDefined() { - return conferenceIdDefined; - } - - @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setConferenceId(String conferenceId) { - this.conferenceId = conferenceId; - this.conferenceIdDefined = true; - } - - public SvamlActionConnectConfDto conferenceDtmfOptions( - SvamlActionConnectConfConferenceDtmfOptionsDto conferenceDtmfOptions) { - this.conferenceDtmfOptions = conferenceDtmfOptions; - this.conferenceDtmfOptionsDefined = true; - return this; - } - - /** - * Get conferenceDtmfOptions - * - * @return conferenceDtmfOptions - */ - @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public SvamlActionConnectConfConferenceDtmfOptionsDto getConferenceDtmfOptions() { - return conferenceDtmfOptions; - } - - @JsonIgnore - public boolean getConferenceDtmfOptionsDefined() { - return conferenceDtmfOptionsDefined; - } - - @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setConferenceDtmfOptions( - SvamlActionConnectConfConferenceDtmfOptionsDto conferenceDtmfOptions) { - this.conferenceDtmfOptions = conferenceDtmfOptions; - this.conferenceDtmfOptionsDefined = true; - } - - public SvamlActionConnectConfDto moh(String moh) { - this.moh = moh; - this.mohDefined = true; - return this; - } - - /** - * Means \"music on hold\". 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 `moh` isn't specified, the user will only hear silence while alone in - * the conference. - * - * @return moh - */ - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMoh() { - return moh; - } - - @JsonIgnore - public boolean getMohDefined() { - return mohDefined; - } - - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMoh(String moh) { - this.moh = moh; - this.mohDefined = true; - } - - /** Return true if this svaml.action.connectConf object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionConnectConfDto svamlActionConnectConf = (SvamlActionConnectConfDto) o; - return Objects.equals(this.name, svamlActionConnectConf.name) - && Objects.equals(this.conferenceId, svamlActionConnectConf.conferenceId) - && Objects.equals(this.conferenceDtmfOptions, svamlActionConnectConf.conferenceDtmfOptions) - && Objects.equals(this.moh, svamlActionConnectConf.moh); - } - - @Override - public int hashCode() { - return Objects.hash(name, conferenceId, conferenceDtmfOptions, moh); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectConfDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); - sb.append(" conferenceDtmfOptions: ") - .append(toIndentedString(conferenceDtmfOptions)) - .append("\n"); - sb.append(" moh: ").append(toIndentedString(moh)).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/voice/models/dto/v1/SvamlActionConnectMxpDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectMxpDto.java deleted file mode 100644 index 29d11c446..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectMxpDto.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Determines how an application-to-application call is connected. Available to use in a response to - * an [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. - */ -@JsonPropertyOrder({ - SvamlActionConnectMxpDto.JSON_PROPERTY_NAME, - SvamlActionConnectMxpDto.JSON_PROPERTY_DESTINATION, - SvamlActionConnectMxpDto.JSON_PROPERTY_CALLHEADERS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectMxpDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `connectMxp`. */ - public enum NameEnum { - CONNECTMXP("connectMxp"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_DESTINATION = "destination"; - private DestinationDto destination; - private boolean destinationDefined = false; - - public static final String JSON_PROPERTY_CALLHEADERS = "callheaders"; - private List callheaders; - private boolean callheadersDefined = false; - - public SvamlActionConnectMxpDto() {} - - public SvamlActionConnectMxpDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `connectMxp`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionConnectMxpDto destination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - return this; - } - - /** - * Get destination - * - * @return destination - */ - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DestinationDto getDestination() { - return destination; - } - - @JsonIgnore - public boolean getDestinationDefined() { - return destinationDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDestination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - } - - public SvamlActionConnectMxpDto callheaders(List callheaders) { - this.callheaders = callheaders; - this.callheadersDefined = true; - return this; - } - - public SvamlActionConnectMxpDto addCallheadersItem(CallHeaderDto callheadersItem) { - if (this.callheaders == null) { - this.callheaders = new ArrayList<>(); - } - this.callheadersDefined = true; - this.callheaders.add(callheadersItem); - return this; - } - - /** - * An optional parameter that allows you to specify or override call headers provided to the - * receiving Sinch SDK client. Read more about call headers [here](../../call-headers/). - * - * @return callheaders - */ - @JsonProperty(JSON_PROPERTY_CALLHEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getCallheaders() { - return callheaders; - } - - @JsonIgnore - public boolean getCallheadersDefined() { - return callheadersDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLHEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallheaders(List callheaders) { - this.callheaders = callheaders; - this.callheadersDefined = true; - } - - /** Return true if this svaml.action.connectMxp object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionConnectMxpDto svamlActionConnectMxp = (SvamlActionConnectMxpDto) o; - return Objects.equals(this.name, svamlActionConnectMxp.name) - && Objects.equals(this.destination, svamlActionConnectMxp.destination) - && Objects.equals(this.callheaders, svamlActionConnectMxp.callheaders); - } - - @Override - public int hashCode() { - return Objects.hash(name, destination, callheaders); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectMxpDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append(" callheaders: ").append(toIndentedString(callheaders)).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/voice/models/dto/v1/SvamlActionConnectPstnDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectPstnDto.java deleted file mode 100644 index 1a15505e1..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectPstnDto.java +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Determines how a PSTN call is connected. Available to use in a response to an [Incoming Call - * Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. - */ -@JsonPropertyOrder({ - SvamlActionConnectPstnDto.JSON_PROPERTY_NAME, - SvamlActionConnectPstnDto.JSON_PROPERTY_NUMBER, - SvamlActionConnectPstnDto.JSON_PROPERTY_LOCALE, - SvamlActionConnectPstnDto.JSON_PROPERTY_MAX_DURATION, - SvamlActionConnectPstnDto.JSON_PROPERTY_DIAL_TIMEOUT, - SvamlActionConnectPstnDto.JSON_PROPERTY_CLI, - SvamlActionConnectPstnDto.JSON_PROPERTY_SUPPRESS_CALLBACKS, - SvamlActionConnectPstnDto.JSON_PROPERTY_DTMF, - SvamlActionConnectPstnDto.JSON_PROPERTY_INDICATIONS, - SvamlActionConnectPstnDto.JSON_PROPERTY_AMD -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectPstnDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `connectPstn`. */ - public enum NameEnum { - CONNECTPSTN("connectPstn"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_NUMBER = "number"; - private String number; - private boolean numberDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; - private Integer maxDuration; - private boolean maxDurationDefined = false; - - public static final String JSON_PROPERTY_DIAL_TIMEOUT = "dialTimeout"; - private Integer dialTimeout; - private boolean dialTimeoutDefined = false; - - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_SUPPRESS_CALLBACKS = "suppressCallbacks"; - private Boolean suppressCallbacks; - private boolean suppressCallbacksDefined = false; - - public static final String JSON_PROPERTY_DTMF = "dtmf"; - private String dtmf; - private boolean dtmfDefined = false; - - public static final String JSON_PROPERTY_INDICATIONS = "indications"; - private String indications; - private boolean indicationsDefined = false; - - public static final String JSON_PROPERTY_AMD = "amd"; - private SvamlActionConnectPstnAmdDto amd; - private boolean amdDefined = false; - - public SvamlActionConnectPstnDto() {} - - public SvamlActionConnectPstnDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `connectPstn`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionConnectPstnDto number(String number) { - this.number = number; - this.numberDefined = true; - return this; - } - - /** - * Used to override where PSTN call is connected. If not specified, the extension the client - * called is used. - * - * @return number - */ - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNumber() { - return number; - } - - @JsonIgnore - public boolean getNumberDefined() { - return numberDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumber(String number) { - this.number = number; - this.numberDefined = true; - } - - public SvamlActionConnectPstnDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * Specifies the locale. Uses the language code according to `ISO 639`, a dash - * (`-`), and a country code according to `ISO 3166-1 alpha-2`. If not - * specified, the default locale of `en-US` is used. - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - public SvamlActionConnectPstnDto maxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - return this; - } - - /** - * 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. - * - * @return maxDuration - */ - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDuration() { - return maxDuration; - } - - @JsonIgnore - public boolean getMaxDurationDefined() { - return maxDurationDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - } - - public SvamlActionConnectPstnDto dialTimeout(Integer dialTimeout) { - this.dialTimeout = dialTimeout; - this.dialTimeoutDefined = true; - return this; - } - - /** - * The max duration the call will wait in ringing unanswered state before terminating with - * ```TIMEOUT/NO ANSWER``` on PSTN leg and - * ```NA/BUSY```on MXP leg. - * - * @return dialTimeout - */ - @JsonProperty(JSON_PROPERTY_DIAL_TIMEOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getDialTimeout() { - return dialTimeout; - } - - @JsonIgnore - public boolean getDialTimeoutDefined() { - return dialTimeoutDefined; - } - - @JsonProperty(JSON_PROPERTY_DIAL_TIMEOUT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDialTimeout(Integer dialTimeout) { - this.dialTimeout = dialTimeout; - this.dialTimeoutDefined = true; - } - - public SvamlActionConnectPstnDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * Used to override the CLI (or caller ID) of the client. The phone number of the person who - * initiated the call is shown as the CLI. To set your own CLI, you may use your verified number - * or your Dashboard virtual number. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public SvamlActionConnectPstnDto suppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = suppressCallbacks; - this.suppressCallbacksDefined = true; - return this; - } - - /** - * If enabled, suppresses [ACE](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) and - * [DICE](../../voice/tag/Callbacks/#tag/Callbacks/operation/dice) callbacks for the call. - * - * @return suppressCallbacks - */ - @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getSuppressCallbacks() { - return suppressCallbacks; - } - - @JsonIgnore - public boolean getSuppressCallbacksDefined() { - return suppressCallbacksDefined; - } - - @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSuppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = suppressCallbacks; - this.suppressCallbacksDefined = true; - } - - public SvamlActionConnectPstnDto dtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - return this; - } - - /** - * A string that determines the DTMF tones to play to the callee when the call is picked up. Valid - * characters are: `0-9`, `#`, and `w`. `w` renders a - * 500ms pause. For example, the string `ww1234#w#`, plays a 1 second pause, the DTMF - * tones for `1`, `2`, `3`, `4`, and `#`, - * followed by a 500ms pause and finally the `#` tone. This is useful if the callout - * destination requires a conference PIN code or an extension. If there is a calling party, it - * will hear progress while the DTMF is sent. - * - * @return dtmf - */ - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDtmf() { - return dtmf; - } - - @JsonIgnore - public boolean getDtmfDefined() { - return dtmfDefined; - } - - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - } - - public SvamlActionConnectPstnDto indications(String indications) { - this.indications = indications; - this.indicationsDefined = true; - return this; - } - - /** - * The locale's tone to play while ringing. - * - * @return indications - */ - @JsonProperty(JSON_PROPERTY_INDICATIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getIndications() { - return indications; - } - - @JsonIgnore - public boolean getIndicationsDefined() { - return indicationsDefined; - } - - @JsonProperty(JSON_PROPERTY_INDICATIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setIndications(String indications) { - this.indications = indications; - this.indicationsDefined = true; - } - - public SvamlActionConnectPstnDto amd(SvamlActionConnectPstnAmdDto amd) { - this.amd = amd; - this.amdDefined = true; - return this; - } - - /** - * Get amd - * - * @return amd - */ - @JsonProperty(JSON_PROPERTY_AMD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public SvamlActionConnectPstnAmdDto getAmd() { - return amd; - } - - @JsonIgnore - public boolean getAmdDefined() { - return amdDefined; - } - - @JsonProperty(JSON_PROPERTY_AMD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAmd(SvamlActionConnectPstnAmdDto amd) { - this.amd = amd; - this.amdDefined = true; - } - - /** Return true if this svaml.action.connectPstn object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionConnectPstnDto svamlActionConnectPstn = (SvamlActionConnectPstnDto) o; - return Objects.equals(this.name, svamlActionConnectPstn.name) - && Objects.equals(this.number, svamlActionConnectPstn.number) - && Objects.equals(this.locale, svamlActionConnectPstn.locale) - && Objects.equals(this.maxDuration, svamlActionConnectPstn.maxDuration) - && Objects.equals(this.dialTimeout, svamlActionConnectPstn.dialTimeout) - && Objects.equals(this.cli, svamlActionConnectPstn.cli) - && Objects.equals(this.suppressCallbacks, svamlActionConnectPstn.suppressCallbacks) - && Objects.equals(this.dtmf, svamlActionConnectPstn.dtmf) - && Objects.equals(this.indications, svamlActionConnectPstn.indications) - && Objects.equals(this.amd, svamlActionConnectPstn.amd); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - number, - locale, - maxDuration, - dialTimeout, - cli, - suppressCallbacks, - dtmf, - indications, - amd); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectPstnDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" number: ").append(toIndentedString(number)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); - sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" suppressCallbacks: ").append(toIndentedString(suppressCallbacks)).append("\n"); - sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); - sb.append(" indications: ").append(toIndentedString(indications)).append("\n"); - sb.append(" amd: ").append(toIndentedString(amd)).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/voice/models/dto/v1/SvamlActionConnectSipDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectSipDto.java deleted file mode 100644 index 5b59ee5a2..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectSipDto.java +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Determines how to route a call to a SIP server. Available to use in a response to an [Incoming - * Call Event](../../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback. - */ -@JsonPropertyOrder({ - SvamlActionConnectSipDto.JSON_PROPERTY_NAME, - SvamlActionConnectSipDto.JSON_PROPERTY_DESTINATION, - SvamlActionConnectSipDto.JSON_PROPERTY_MAX_DURATION, - SvamlActionConnectSipDto.JSON_PROPERTY_CLI, - SvamlActionConnectSipDto.JSON_PROPERTY_TRANSPORT, - SvamlActionConnectSipDto.JSON_PROPERTY_SUPPRESS_CALLBACKS, - SvamlActionConnectSipDto.JSON_PROPERTY_CALL_HEADERS, - SvamlActionConnectSipDto.JSON_PROPERTY_MOH -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectSipDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `connectSip`. */ - public enum NameEnum { - CONNECTSIP("connectSip"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_DESTINATION = "destination"; - private DestinationDto destination; - private boolean destinationDefined = false; - - public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; - private Integer maxDuration; - private boolean maxDurationDefined = false; - - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_TRANSPORT = "transport"; - private String transport; - private boolean transportDefined = false; - - public static final String JSON_PROPERTY_SUPPRESS_CALLBACKS = "suppressCallbacks"; - private Boolean suppressCallbacks; - private boolean suppressCallbacksDefined = false; - - public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; - private List callHeaders; - private boolean callHeadersDefined = false; - - public static final String JSON_PROPERTY_MOH = "moh"; - private String moh; - private boolean mohDefined = false; - - public SvamlActionConnectSipDto() {} - - public SvamlActionConnectSipDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `connectSip`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionConnectSipDto destination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - return this; - } - - /** - * Get destination - * - * @return destination - */ - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public DestinationDto getDestination() { - return destination; - } - - @JsonIgnore - public boolean getDestinationDefined() { - return destinationDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setDestination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - } - - public SvamlActionConnectSipDto maxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - return this; - } - - /** - * 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. - * - * @return maxDuration - */ - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDuration() { - return maxDuration; - } - - @JsonIgnore - public boolean getMaxDurationDefined() { - return maxDurationDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - } - - public SvamlActionConnectSipDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * Used to override the CLI (or caller ID) of the client. The phone number of the person who - * initiated the call is shown as the CLI. To set your own CLI, you may use your verified number - * or your Dashboard virtual number. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public SvamlActionConnectSipDto transport(String transport) { - this.transport = transport; - this.transportDefined = true; - return this; - } - - /** - * An optional parameter to specify the SIP transport protocol. If unspecified, UDP is used. - * - * @return transport - */ - @JsonProperty(JSON_PROPERTY_TRANSPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getTransport() { - return transport; - } - - @JsonIgnore - public boolean getTransportDefined() { - return transportDefined; - } - - @JsonProperty(JSON_PROPERTY_TRANSPORT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTransport(String transport) { - this.transport = transport; - this.transportDefined = true; - } - - public SvamlActionConnectSipDto suppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = suppressCallbacks; - this.suppressCallbacksDefined = true; - return this; - } - - /** - * If enabled, suppresses [ACE](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) and - * [DICE](../../voice/tag/Callbacks/#tag/Callbacks/operation/dice) callbacks for the call. - * - * @return suppressCallbacks - */ - @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getSuppressCallbacks() { - return suppressCallbacks; - } - - @JsonIgnore - public boolean getSuppressCallbacksDefined() { - return suppressCallbacksDefined; - } - - @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setSuppressCallbacks(Boolean suppressCallbacks) { - this.suppressCallbacks = suppressCallbacks; - this.suppressCallbacksDefined = true; - } - - public SvamlActionConnectSipDto callHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - return this; - } - - public SvamlActionConnectSipDto addCallHeadersItem(CallHeaderDto callHeadersItem) { - if (this.callHeaders == null) { - this.callHeaders = new ArrayList<>(); - } - this.callHeadersDefined = true; - this.callHeaders.add(callHeadersItem); - return this; - } - - /** - * [Private SIP - * headers](../../sip-trunking/#receiving-calls-from-sinch-platform-to-your-sip-infrastructure) to - * send with the call. - * - * @return callHeaders - */ - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getCallHeaders() { - return callHeaders; - } - - @JsonIgnore - public boolean getCallHeadersDefined() { - return callHeadersDefined; - } - - @JsonProperty(JSON_PROPERTY_CALL_HEADERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallHeaders(List callHeaders) { - this.callHeaders = callHeaders; - this.callHeadersDefined = true; - } - - public SvamlActionConnectSipDto moh(String moh) { - this.moh = moh; - this.mohDefined = true; - return this; - } - - /** - * Means \"music on hold\". If this optional parameter is included, plays music to the - * connected participant if the SIP call is placed on hold. If `moh` isn't specified - * and the SIP call is placed on hold, the user will only hear silence while during the holding - * period . - * - * @return moh - */ - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMoh() { - return moh; - } - - @JsonIgnore - public boolean getMohDefined() { - return mohDefined; - } - - @JsonProperty(JSON_PROPERTY_MOH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMoh(String moh) { - this.moh = moh; - this.mohDefined = true; - } - - /** Return true if this svaml.action.connectSip object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionConnectSipDto svamlActionConnectSip = (SvamlActionConnectSipDto) o; - return Objects.equals(this.name, svamlActionConnectSip.name) - && Objects.equals(this.destination, svamlActionConnectSip.destination) - && Objects.equals(this.maxDuration, svamlActionConnectSip.maxDuration) - && Objects.equals(this.cli, svamlActionConnectSip.cli) - && Objects.equals(this.transport, svamlActionConnectSip.transport) - && Objects.equals(this.suppressCallbacks, svamlActionConnectSip.suppressCallbacks) - && Objects.equals(this.callHeaders, svamlActionConnectSip.callHeaders) - && Objects.equals(this.moh, svamlActionConnectSip.moh); - } - - @Override - public int hashCode() { - return Objects.hash( - name, destination, maxDuration, cli, transport, suppressCallbacks, callHeaders, moh); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectSipDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" transport: ").append(toIndentedString(transport)).append("\n"); - sb.append(" suppressCallbacks: ").append(toIndentedString(suppressCallbacks)).append("\n"); - sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).append("\n"); - sb.append(" moh: ").append(toIndentedString(moh)).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/voice/models/dto/v1/SvamlActionContinueDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionContinueDto.java deleted file mode 100644 index 04bdfd0d4..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionContinueDto.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Continues to set up a call. Available to use in a response to an [Answered Call - * Event](../../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. - */ -@JsonPropertyOrder({SvamlActionContinueDto.JSON_PROPERTY_NAME}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionContinueDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `continue`. */ - public enum NameEnum { - CONTINUE("continue"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public SvamlActionContinueDto() {} - - public SvamlActionContinueDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `continue`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** Return true if this svaml.action.continue object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionContinueDto svamlActionContinue = (SvamlActionContinueDto) o; - return Objects.equals(this.name, svamlActionContinue.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionContinueDto {\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/voice/models/dto/v1/SvamlActionDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionDto.java deleted file mode 100644 index ce3184d87..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionDto.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -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 = SvamlActionDto.SvamlActionDtoDeserializer.class) -@JsonSerialize(using = SvamlActionDto.SvamlActionDtoSerializer.class) -public final class SvamlActionDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(SvamlActionDto.class.getName()); - - public static final class SvamlActionDtoSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public SvamlActionDtoSerializer(Class t) { - super(t); - } - - public SvamlActionDtoSerializer() { - this(null); - } - - @Override - public void serialize(SvamlActionDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class SvamlActionDtoDeserializer extends StdDeserializer { - private static final long serialVersionUID = 1L; - - public SvamlActionDtoDeserializer() { - this(SvamlActionDto.class); - } - - public SvamlActionDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public SvamlActionDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - - Object deserialized = null; - Class cls = JSONNavigator.getClassForElement(tree, SvamlActionDto.class); - if (cls != null) { - // When the OAS schema includes a discriminator, use the discriminator value to - // discriminate the anyOf schemas. - // Get the discriminator mapping value to get the class. - deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } - // deserialize SvamlActionConnectConfDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectConfDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionConnectMxpDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectMxpDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionConnectPstnDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectPstnDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionConnectSipDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectSipDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionContinueDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionContinueDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionHangupDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionHangupDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionParkDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionParkDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - // deserialize SvamlActionRunMenuDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionRunMenuDto.class); - SvamlActionDto ret = new SvamlActionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlActionDto'", e); - } - - throw new IOException( - String.format("Failed deserialization for SvamlActionDto: no match found")); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public SvamlActionDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "SvamlActionDto cannot be null"); - } - } - - // store a list of schema names defined in anyOf - public static final Map> schemas = new HashMap>(); - - public SvamlActionDto() { - super("anyOf", Boolean.FALSE); - } - - public SvamlActionDto(SvamlActionConnectConfDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionConnectMxpDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionConnectPstnDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionConnectSipDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionContinueDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionHangupDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionParkDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlActionDto(SvamlActionRunMenuDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("SvamlActionConnectConfDto", SvamlActionConnectConfDto.class); - schemas.put("SvamlActionConnectMxpDto", SvamlActionConnectMxpDto.class); - schemas.put("SvamlActionConnectPstnDto", SvamlActionConnectPstnDto.class); - schemas.put("SvamlActionConnectSipDto", SvamlActionConnectSipDto.class); - schemas.put("SvamlActionContinueDto", SvamlActionContinueDto.class); - schemas.put("SvamlActionHangupDto", SvamlActionHangupDto.class); - schemas.put("SvamlActionParkDto", SvamlActionParkDto.class); - schemas.put("SvamlActionRunMenuDto", SvamlActionRunMenuDto.class); - JSONNavigator.registerDescendants(SvamlActionDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("connectConf", SvamlActionConnectConfDto.class); - mappings.put("connectMxp", SvamlActionConnectMxpDto.class); - mappings.put("connectPstn", SvamlActionConnectPstnDto.class); - mappings.put("connectSip", SvamlActionConnectSipDto.class); - mappings.put("continue", SvamlActionContinueDto.class); - mappings.put("hangup", SvamlActionHangupDto.class); - mappings.put("park", SvamlActionParkDto.class); - mappings.put("runMenu", SvamlActionRunMenuDto.class); - mappings.put("svaml.action.connectConf", SvamlActionConnectConfDto.class); - mappings.put("svaml.action.connectMxp", SvamlActionConnectMxpDto.class); - mappings.put("svaml.action.connectPstn", SvamlActionConnectPstnDto.class); - mappings.put("svaml.action.connectSip", SvamlActionConnectSipDto.class); - mappings.put("svaml.action.continue", SvamlActionContinueDto.class); - mappings.put("svaml.action.hangup", SvamlActionHangupDto.class); - mappings.put("svaml.action.park", SvamlActionParkDto.class); - mappings.put("svaml.action.runMenu", SvamlActionRunMenuDto.class); - mappings.put("svaml.action", SvamlActionDto.class); - JSONNavigator.registerDiscriminator(SvamlActionDto.class, "name", mappings); - } - - @Override - public Map> getSchemas() { - return SvamlActionDto.schemas; - } - - /** - * Set the instance that matches the anyOf child schema, check the instance parameter is valid - * against the anyOf child schemas: SvamlActionConnectConfDto, SvamlActionConnectMxpDto, - * SvamlActionConnectPstnDto, SvamlActionConnectSipDto, SvamlActionContinueDto, - * SvamlActionHangupDto, SvamlActionParkDto, SvamlActionRunMenuDto - * - *

It could be an instance of the 'anyOf' schemas. The anyOf child schemas may themselves be a - * composed schema (allOf, anyOf, anyOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf( - SvamlActionConnectConfDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlActionConnectMxpDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlActionConnectPstnDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlActionConnectSipDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlActionContinueDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(SvamlActionHangupDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(SvamlActionParkDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlActionRunMenuDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be SvamlActionConnectConfDto, SvamlActionConnectMxpDto," - + " SvamlActionConnectPstnDto, SvamlActionConnectSipDto, SvamlActionContinueDto," - + " SvamlActionHangupDto, SvamlActionParkDto, SvamlActionRunMenuDto"); - } - - /** - * Get the actual instance, which can be the following: SvamlActionConnectConfDto, - * SvamlActionConnectMxpDto, SvamlActionConnectPstnDto, SvamlActionConnectSipDto, - * SvamlActionContinueDto, SvamlActionHangupDto, SvamlActionParkDto, SvamlActionRunMenuDto - * - * @return The actual instance (SvamlActionConnectConfDto, SvamlActionConnectMxpDto, - * SvamlActionConnectPstnDto, SvamlActionConnectSipDto, SvamlActionContinueDto, - * SvamlActionHangupDto, SvamlActionParkDto, SvamlActionRunMenuDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionConnectConfDto`. If the actual instance is not - * `SvamlActionConnectConfDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionConnectConfDto` - * @throws ClassCastException if the instance is not `SvamlActionConnectConfDto` - */ - public SvamlActionConnectConfDto getSvamlActionConnectConfDto() throws ClassCastException { - return (SvamlActionConnectConfDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionConnectMxpDto`. If the actual instance is not - * `SvamlActionConnectMxpDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionConnectMxpDto` - * @throws ClassCastException if the instance is not `SvamlActionConnectMxpDto` - */ - public SvamlActionConnectMxpDto getSvamlActionConnectMxpDto() throws ClassCastException { - return (SvamlActionConnectMxpDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionConnectPstnDto`. If the actual instance is not - * `SvamlActionConnectPstnDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionConnectPstnDto` - * @throws ClassCastException if the instance is not `SvamlActionConnectPstnDto` - */ - public SvamlActionConnectPstnDto getSvamlActionConnectPstnDto() throws ClassCastException { - return (SvamlActionConnectPstnDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionConnectSipDto`. If the actual instance is not - * `SvamlActionConnectSipDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionConnectSipDto` - * @throws ClassCastException if the instance is not `SvamlActionConnectSipDto` - */ - public SvamlActionConnectSipDto getSvamlActionConnectSipDto() throws ClassCastException { - return (SvamlActionConnectSipDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionContinueDto`. If the actual instance is not - * `SvamlActionContinueDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionContinueDto` - * @throws ClassCastException if the instance is not `SvamlActionContinueDto` - */ - public SvamlActionContinueDto getSvamlActionContinueDto() throws ClassCastException { - return (SvamlActionContinueDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionHangupDto`. If the actual instance is not - * `SvamlActionHangupDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionHangupDto` - * @throws ClassCastException if the instance is not `SvamlActionHangupDto` - */ - public SvamlActionHangupDto getSvamlActionHangupDto() throws ClassCastException { - return (SvamlActionHangupDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionParkDto`. If the actual instance is not - * `SvamlActionParkDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionParkDto` - * @throws ClassCastException if the instance is not `SvamlActionParkDto` - */ - public SvamlActionParkDto getSvamlActionParkDto() throws ClassCastException { - return (SvamlActionParkDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlActionRunMenuDto`. If the actual instance is not - * `SvamlActionRunMenuDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlActionRunMenuDto` - * @throws ClassCastException if the instance is not `SvamlActionRunMenuDto` - */ - public SvamlActionRunMenuDto getSvamlActionRunMenuDto() throws ClassCastException { - return (SvamlActionRunMenuDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionHangupDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionHangupDto.java deleted file mode 100644 index 2f3d052f9..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionHangupDto.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Hangs up a call. Available to use in a response to an [Incoming Call - * Event](../../../docs/voice/api-reference/voice/tag/Callbacks/#tag/Callbacks/operation/ice) - * callback or an [Answered Call - * Event](../../../docs/voice/api-reference/voice/tag/Callbacks/#tag/Callbacks/operation/ace) - * callback. - */ -@JsonPropertyOrder({SvamlActionHangupDto.JSON_PROPERTY_NAME}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionHangupDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `hangup`. */ - public enum NameEnum { - HANGUP("hangup"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public SvamlActionHangupDto() {} - - public SvamlActionHangupDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `hangup`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** Return true if this svaml.action.hangup object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionHangupDto svamlActionHangup = (SvamlActionHangupDto) o; - return Objects.equals(this.name, svamlActionHangup.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionHangupDto {\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/voice/models/dto/v1/SvamlActionParkDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionParkDto.java deleted file mode 100644 index fb9331ef7..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionParkDto.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Parks the call and places the caller on hold. The caller is placed into a loop, listening to an - * IVR prompt (either a pre-recorded audio file or generated by text to speech). If the call is - * unparked, prompts will stop playing immediately. If the max duration is reached, the last prompt - * will be fully played until the call ends. - */ -@JsonPropertyOrder({ - SvamlActionParkDto.JSON_PROPERTY_NAME, - SvamlActionParkDto.JSON_PROPERTY_LOCALE, - SvamlActionParkDto.JSON_PROPERTY_INTRO_PROMPT, - SvamlActionParkDto.JSON_PROPERTY_HOLD_PROMPT, - SvamlActionParkDto.JSON_PROPERTY_MAX_DURATION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionParkDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `park`. */ - public enum NameEnum { - PARK("park"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public static final String JSON_PROPERTY_INTRO_PROMPT = "introPrompt"; - private String introPrompt; - private boolean introPromptDefined = false; - - public static final String JSON_PROPERTY_HOLD_PROMPT = "holdPrompt"; - private String holdPrompt; - private boolean holdPromptDefined = false; - - public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; - private Integer maxDuration; - private boolean maxDurationDefined = false; - - public SvamlActionParkDto() {} - - public SvamlActionParkDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `park`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionParkDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * The voice and language you want to use for the text-to-speech message. This can either be - * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported - * languages and voices are detailed [here](../../voice-locales). - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - public SvamlActionParkDto introPrompt(String introPrompt) { - this.introPrompt = introPrompt; - this.introPromptDefined = true; - return this; - } - - /** - * That prompt that is played when the call is first answered. You can use text-to-speech using - * the `#tts[]` element, SSML commands using the `#ssml[]` element. - * - * @return introPrompt - */ - @JsonProperty(JSON_PROPERTY_INTRO_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getIntroPrompt() { - return introPrompt; - } - - @JsonIgnore - public boolean getIntroPromptDefined() { - return introPromptDefined; - } - - @JsonProperty(JSON_PROPERTY_INTRO_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setIntroPrompt(String introPrompt) { - this.introPrompt = introPrompt; - this.introPromptDefined = true; - } - - public SvamlActionParkDto holdPrompt(String holdPrompt) { - this.holdPrompt = holdPrompt; - this.holdPromptDefined = true; - return this; - } - - /** - * The prompt that is played on repeat until the call is unparked or the until the - * `maxDuration` value is reached. You can use text-to-speech using the - * `#tts[]` element, SSML commands using the `#ssml[]` element. - * - * @return holdPrompt - */ - @JsonProperty(JSON_PROPERTY_HOLD_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getHoldPrompt() { - return holdPrompt; - } - - @JsonIgnore - public boolean getHoldPromptDefined() { - return holdPromptDefined; - } - - @JsonProperty(JSON_PROPERTY_HOLD_PROMPT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setHoldPrompt(String holdPrompt) { - this.holdPrompt = holdPrompt; - this.holdPromptDefined = true; - } - - public SvamlActionParkDto maxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - return this; - } - - /** - * The maximum amount of time in seconds that the `holdPrompt` will be played. - * - * @return maxDuration - */ - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getMaxDuration() { - return maxDuration; - } - - @JsonIgnore - public boolean getMaxDurationDefined() { - return maxDurationDefined; - } - - @JsonProperty(JSON_PROPERTY_MAX_DURATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMaxDuration(Integer maxDuration) { - this.maxDuration = maxDuration; - this.maxDurationDefined = true; - } - - /** Return true if this svaml.action.park object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionParkDto svamlActionPark = (SvamlActionParkDto) o; - return Objects.equals(this.name, svamlActionPark.name) - && Objects.equals(this.locale, svamlActionPark.locale) - && Objects.equals(this.introPrompt, svamlActionPark.introPrompt) - && Objects.equals(this.holdPrompt, svamlActionPark.holdPrompt) - && Objects.equals(this.maxDuration, svamlActionPark.maxDuration); - } - - @Override - public int hashCode() { - return Objects.hash(name, locale, introPrompt, holdPrompt, maxDuration); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionParkDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" introPrompt: ").append(toIndentedString(introPrompt)).append("\n"); - sb.append(" holdPrompt: ").append(toIndentedString(holdPrompt)).append("\n"); - sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).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/voice/models/dto/v1/SvamlActionRunMenuDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionRunMenuDto.java deleted file mode 100644 index 180907f3c..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionRunMenuDto.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Plays an interactive voice response (IVR) menu to the callee. This menu can play pre-recorded - * files or text-to-speech messages, collect DTMF tones, and trigger the [Prompt Input - * Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/pie) (PIE) callback towards your - * backend, notifying you of the actions the callee took. Available to use in a response to an - * [Incoming Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ice) callback or an - * [Answered Call Event](../../voice/tag/Callbacks/#tag/Callbacks/operation/ace) callback. Also be - * used in combination with the - * [Conferences](/docs/voice/api-reference/voice/tag/Conferences/#tag/Conferences) endpoint of the - * Calling API. - */ -@JsonPropertyOrder({ - SvamlActionRunMenuDto.JSON_PROPERTY_NAME, - SvamlActionRunMenuDto.JSON_PROPERTY_BARGE, - SvamlActionRunMenuDto.JSON_PROPERTY_LOCALE, - SvamlActionRunMenuDto.JSON_PROPERTY_MAIN_MENU, - SvamlActionRunMenuDto.JSON_PROPERTY_ENABLE_VOICE, - SvamlActionRunMenuDto.JSON_PROPERTY_MENUS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionRunMenuDto { - private static final long serialVersionUID = 1L; - - /** The name property. Must have the value `runMenu`. */ - public enum NameEnum { - RUNMENU("runMenu"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_BARGE = "barge"; - private Boolean barge; - private boolean bargeDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public static final String JSON_PROPERTY_MAIN_MENU = "mainMenu"; - private String mainMenu; - private boolean mainMenuDefined = false; - - public static final String JSON_PROPERTY_ENABLE_VOICE = "enableVoice"; - private Boolean enableVoice; - private boolean enableVoiceDefined = false; - - public static final String JSON_PROPERTY_MENUS = "menus"; - private List menus; - private boolean menusDefined = false; - - public SvamlActionRunMenuDto() {} - - public SvamlActionRunMenuDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The name property. Must have the value `runMenu`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlActionRunMenuDto barge(Boolean barge) { - this.barge = barge; - this.bargeDefined = true; - return this; - } - - /** - * 'Barging' means that the user can press a DTMF digit before the prompt has finished - * playing. If a valid input is pressed, the message will stop playing and accept the input. If - * `barge` is disabled, the user must listen to the entire prompt before input is - * accepted. By default, barging is enabled. - * - * @return barge - */ - @JsonProperty(JSON_PROPERTY_BARGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getBarge() { - return barge; - } - - @JsonIgnore - public boolean getBargeDefined() { - return bargeDefined; - } - - @JsonProperty(JSON_PROPERTY_BARGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setBarge(Boolean barge) { - this.barge = barge; - this.bargeDefined = true; - } - - public SvamlActionRunMenuDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * The voice and language you want to use for the text-to-speech message. This can either be - * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported - * languages and voices are detailed [here](../../voice-locales). If using the - * `enableVoice` to enable voice detection, the `locale` property is required - * in order to select the input language. - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - public SvamlActionRunMenuDto mainMenu(String mainMenu) { - this.mainMenu = mainMenu; - this.mainMenuDefined = true; - return this; - } - - /** - * Selects the menu item from the `menus` array to play first. - * - * @return mainMenu - */ - @JsonProperty(JSON_PROPERTY_MAIN_MENU) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getMainMenu() { - return mainMenu; - } - - @JsonIgnore - public boolean getMainMenuDefined() { - return mainMenuDefined; - } - - @JsonProperty(JSON_PROPERTY_MAIN_MENU) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMainMenu(String mainMenu) { - this.mainMenu = mainMenu; - this.mainMenuDefined = true; - } - - public SvamlActionRunMenuDto enableVoice(Boolean enableVoice) { - this.enableVoice = enableVoice; - this.enableVoiceDefined = true; - return this; - } - - /** - * Enables voice detection. If enabled, users can say their answers to prompts in addition to - * entering them using the keypad. - * - * @return enableVoice - */ - @JsonProperty(JSON_PROPERTY_ENABLE_VOICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableVoice() { - return enableVoice; - } - - @JsonIgnore - public boolean getEnableVoiceDefined() { - return enableVoiceDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_VOICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableVoice(Boolean enableVoice) { - this.enableVoice = enableVoice; - this.enableVoiceDefined = true; - } - - public SvamlActionRunMenuDto menus(List menus) { - this.menus = menus; - this.menusDefined = true; - return this; - } - - public SvamlActionRunMenuDto addMenusItem(MenuDto menusItem) { - if (this.menus == null) { - this.menus = new ArrayList<>(); - } - this.menusDefined = true; - this.menus.add(menusItem); - return this; - } - - /** - * The list of menus available. The menu with the `id` value of `main` will - * always play first. If no menu has an `id` value of `main`, an error is - * returned. - * - * @return menus - */ - @JsonProperty(JSON_PROPERTY_MENUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getMenus() { - return menus; - } - - @JsonIgnore - public boolean getMenusDefined() { - return menusDefined; - } - - @JsonProperty(JSON_PROPERTY_MENUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMenus(List menus) { - this.menus = menus; - this.menusDefined = true; - } - - /** Return true if this svaml.action.runMenu object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlActionRunMenuDto svamlActionRunMenu = (SvamlActionRunMenuDto) o; - return Objects.equals(this.name, svamlActionRunMenu.name) - && Objects.equals(this.barge, svamlActionRunMenu.barge) - && Objects.equals(this.locale, svamlActionRunMenu.locale) - && Objects.equals(this.mainMenu, svamlActionRunMenu.mainMenu) - && Objects.equals(this.enableVoice, svamlActionRunMenu.enableVoice) - && Objects.equals(this.menus, svamlActionRunMenu.menus); - } - - @Override - public int hashCode() { - return Objects.hash(name, barge, locale, mainMenu, enableVoice, menus); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionRunMenuDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" barge: ").append(toIndentedString(barge)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" mainMenu: ").append(toIndentedString(mainMenu)).append("\n"); - sb.append(" enableVoice: ").append(toIndentedString(enableVoice)).append("\n"); - sb.append(" menus: ").append(toIndentedString(menus)).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/voice/models/dto/v1/SvamlInstructionAnswerDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionAnswerDto.java deleted file mode 100644 index 09fc11ce3..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionAnswerDto.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** Forces the callee to answer the call. */ -@JsonPropertyOrder({SvamlInstructionAnswerDto.JSON_PROPERTY_NAME}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionAnswerDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `answer`. */ - public enum NameEnum { - ANSWER("answer"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public SvamlInstructionAnswerDto() {} - - public SvamlInstructionAnswerDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `answer`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** Return true if this svaml.instruction.answer object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionAnswerDto svamlInstructionAnswer = (SvamlInstructionAnswerDto) o; - return Objects.equals(this.name, svamlInstructionAnswer.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionAnswerDto {\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/voice/models/dto/v1/SvamlInstructionDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionDto.java deleted file mode 100644 index 291d36b6b..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionDto.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -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 = SvamlInstructionDto.SvamlInstructionDtoDeserializer.class) -@JsonSerialize(using = SvamlInstructionDto.SvamlInstructionDtoSerializer.class) -public final class SvamlInstructionDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(SvamlInstructionDto.class.getName()); - - public static final class SvamlInstructionDtoSerializer - extends StdSerializer { - private static final long serialVersionUID = 1L; - - public SvamlInstructionDtoSerializer(Class t) { - super(t); - } - - public SvamlInstructionDtoSerializer() { - this(null); - } - - @Override - public void serialize( - SvamlInstructionDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class SvamlInstructionDtoDeserializer - extends StdDeserializer { - private static final long serialVersionUID = 1L; - - public SvamlInstructionDtoDeserializer() { - this(SvamlInstructionDto.class); - } - - public SvamlInstructionDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public SvamlInstructionDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - - Object deserialized = null; - Class cls = JSONNavigator.getClassForElement(tree, SvamlInstructionDto.class); - if (cls != null) { - // When the OAS schema includes a discriminator, use the discriminator value to - // discriminate the anyOf schemas. - // Get the discriminator mapping value to get the class. - deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } - // deserialize SvamlInstructionAnswerDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionAnswerDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionPlayFilesDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionPlayFilesDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionSayDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSayDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionSendDtmfDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSendDtmfDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionSetCookieDto - try { - deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSetCookieDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionStartRecordingDto - try { - deserialized = - tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionStartRecordingDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - // deserialize SvamlInstructionStopRecordingDto - try { - deserialized = - tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionStopRecordingDto.class); - SvamlInstructionDto ret = new SvamlInstructionDto(); - ret.setActualInstance(deserialized); - return ret; - } catch (Exception e) { - // deserialization failed, continue, log to help debugging - log.log(Level.FINER, "Input data does not match 'SvamlInstructionDto'", e); - } - - throw new IOException( - String.format("Failed deserialization for SvamlInstructionDto: no match found")); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public SvamlInstructionDto getNullValue(DeserializationContext ctxt) - throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "SvamlInstructionDto cannot be null"); - } - } - - // store a list of schema names defined in anyOf - public static final Map> schemas = new HashMap>(); - - public SvamlInstructionDto() { - super("anyOf", Boolean.FALSE); - } - - public SvamlInstructionDto(SvamlInstructionAnswerDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionPlayFilesDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionSayDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionSendDtmfDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionSetCookieDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionStartRecordingDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - public SvamlInstructionDto(SvamlInstructionStopRecordingDto o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("SvamlInstructionAnswerDto", SvamlInstructionAnswerDto.class); - schemas.put("SvamlInstructionPlayFilesDto", SvamlInstructionPlayFilesDto.class); - schemas.put("SvamlInstructionSayDto", SvamlInstructionSayDto.class); - schemas.put("SvamlInstructionSendDtmfDto", SvamlInstructionSendDtmfDto.class); - schemas.put("SvamlInstructionSetCookieDto", SvamlInstructionSetCookieDto.class); - schemas.put("SvamlInstructionStartRecordingDto", SvamlInstructionStartRecordingDto.class); - schemas.put("SvamlInstructionStopRecordingDto", SvamlInstructionStopRecordingDto.class); - JSONNavigator.registerDescendants( - SvamlInstructionDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("answer", SvamlInstructionAnswerDto.class); - mappings.put("playFiles", SvamlInstructionPlayFilesDto.class); - mappings.put("say", SvamlInstructionSayDto.class); - mappings.put("sendDtmf", SvamlInstructionSendDtmfDto.class); - mappings.put("setCookie", SvamlInstructionSetCookieDto.class); - mappings.put("startRecording", SvamlInstructionStartRecordingDto.class); - mappings.put("stopRecording", SvamlInstructionStopRecordingDto.class); - mappings.put("svaml.instruction.answer", SvamlInstructionAnswerDto.class); - mappings.put("svaml.instruction.playFiles", SvamlInstructionPlayFilesDto.class); - mappings.put("svaml.instruction.say", SvamlInstructionSayDto.class); - mappings.put("svaml.instruction.sendDtmf", SvamlInstructionSendDtmfDto.class); - mappings.put("svaml.instruction.setCookie", SvamlInstructionSetCookieDto.class); - mappings.put("svaml.instruction.startRecording", SvamlInstructionStartRecordingDto.class); - mappings.put("svaml.instruction.stopRecording", SvamlInstructionStopRecordingDto.class); - mappings.put("svaml.instruction", SvamlInstructionDto.class); - JSONNavigator.registerDiscriminator(SvamlInstructionDto.class, "name", mappings); - } - - @Override - public Map> getSchemas() { - return SvamlInstructionDto.schemas; - } - - /** - * Set the instance that matches the anyOf child schema, check the instance parameter is valid - * against the anyOf child schemas: SvamlInstructionAnswerDto, SvamlInstructionPlayFilesDto, - * SvamlInstructionSayDto, SvamlInstructionSendDtmfDto, SvamlInstructionSetCookieDto, - * SvamlInstructionStartRecordingDto, SvamlInstructionStopRecordingDto - * - *

It could be an instance of the 'anyOf' schemas. The anyOf child schemas may themselves be a - * composed schema (allOf, anyOf, anyOf). - */ - @Override - public void setActualInstance(Object instance) { - if (JSONNavigator.isInstanceOf( - SvamlInstructionAnswerDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionPlayFilesDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionSayDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionSendDtmfDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionSetCookieDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionStartRecordingDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf( - SvamlInstructionStopRecordingDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be SvamlInstructionAnswerDto, SvamlInstructionPlayFilesDto," - + " SvamlInstructionSayDto, SvamlInstructionSendDtmfDto, SvamlInstructionSetCookieDto," - + " SvamlInstructionStartRecordingDto, SvamlInstructionStopRecordingDto"); - } - - /** - * Get the actual instance, which can be the following: SvamlInstructionAnswerDto, - * SvamlInstructionPlayFilesDto, SvamlInstructionSayDto, SvamlInstructionSendDtmfDto, - * SvamlInstructionSetCookieDto, SvamlInstructionStartRecordingDto, - * SvamlInstructionStopRecordingDto - * - * @return The actual instance (SvamlInstructionAnswerDto, SvamlInstructionPlayFilesDto, - * SvamlInstructionSayDto, SvamlInstructionSendDtmfDto, SvamlInstructionSetCookieDto, - * SvamlInstructionStartRecordingDto, SvamlInstructionStopRecordingDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionAnswerDto`. If the actual instance is not - * `SvamlInstructionAnswerDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionAnswerDto` - * @throws ClassCastException if the instance is not `SvamlInstructionAnswerDto` - */ - public SvamlInstructionAnswerDto getSvamlInstructionAnswerDto() throws ClassCastException { - return (SvamlInstructionAnswerDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionPlayFilesDto`. If the actual instance is not - * `SvamlInstructionPlayFilesDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionPlayFilesDto` - * @throws ClassCastException if the instance is not `SvamlInstructionPlayFilesDto` - */ - public SvamlInstructionPlayFilesDto getSvamlInstructionPlayFilesDto() throws ClassCastException { - return (SvamlInstructionPlayFilesDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionSayDto`. If the actual instance is not - * `SvamlInstructionSayDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionSayDto` - * @throws ClassCastException if the instance is not `SvamlInstructionSayDto` - */ - public SvamlInstructionSayDto getSvamlInstructionSayDto() throws ClassCastException { - return (SvamlInstructionSayDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionSendDtmfDto`. If the actual instance is not - * `SvamlInstructionSendDtmfDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionSendDtmfDto` - * @throws ClassCastException if the instance is not `SvamlInstructionSendDtmfDto` - */ - public SvamlInstructionSendDtmfDto getSvamlInstructionSendDtmfDto() throws ClassCastException { - return (SvamlInstructionSendDtmfDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionSetCookieDto`. If the actual instance is not - * `SvamlInstructionSetCookieDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionSetCookieDto` - * @throws ClassCastException if the instance is not `SvamlInstructionSetCookieDto` - */ - public SvamlInstructionSetCookieDto getSvamlInstructionSetCookieDto() throws ClassCastException { - return (SvamlInstructionSetCookieDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionStartRecordingDto`. If the actual instance is not - * `SvamlInstructionStartRecordingDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionStartRecordingDto` - * @throws ClassCastException if the instance is not `SvamlInstructionStartRecordingDto` - */ - public SvamlInstructionStartRecordingDto getSvamlInstructionStartRecordingDto() - throws ClassCastException { - return (SvamlInstructionStartRecordingDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `SvamlInstructionStopRecordingDto`. If the actual instance is not - * `SvamlInstructionStopRecordingDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `SvamlInstructionStopRecordingDto` - * @throws ClassCastException if the instance is not `SvamlInstructionStopRecordingDto` - */ - public SvamlInstructionStopRecordingDto getSvamlInstructionStopRecordingDto() - throws ClassCastException { - return (SvamlInstructionStopRecordingDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionPlayFilesDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionPlayFilesDto.java deleted file mode 100644 index 78c143e28..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionPlayFilesDto.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** - * Plays Interactive Voice Response (IVR) files for the supported locale or SSML commands at the - * Sinch backend. An IVR message is played only on the caller's side. - */ -@JsonPropertyOrder({ - SvamlInstructionPlayFilesDto.JSON_PROPERTY_NAME, - SvamlInstructionPlayFilesDto.JSON_PROPERTY_IDS, - SvamlInstructionPlayFilesDto.JSON_PROPERTY_LOCALE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionPlayFilesDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `playFiles`. */ - public enum NameEnum { - PLAYFILES("playFiles"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_IDS = "ids"; - private List ids; - private boolean idsDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public SvamlInstructionPlayFilesDto() {} - - public SvamlInstructionPlayFilesDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `playFiles`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlInstructionPlayFilesDto ids(List ids) { - this.ids = ids; - this.idsDefined = true; - return this; - } - - public SvamlInstructionPlayFilesDto addIdsItem(String idsItem) { - if (this.ids == null) { - this.ids = new ArrayList<>(); - } - this.idsDefined = true; - this.ids.add(idsItem); - return this; - } - - /** - * The IDs of the files which will be played. These can be a URL to a file, SSML commands using - * the `#ssml[]` element, or text using the `#tts[]` element. - * - * @return ids - */ - @JsonProperty(JSON_PROPERTY_IDS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getIds() { - return ids; - } - - @JsonIgnore - public boolean getIdsDefined() { - return idsDefined; - } - - @JsonProperty(JSON_PROPERTY_IDS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setIds(List ids) { - this.ids = ids; - this.idsDefined = true; - } - - public SvamlInstructionPlayFilesDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * If using SSML or TTS, this is a required field. The voice and language you want to use for the - * text-to-speech message. This can either be defined by the ISO 639 locale and language code or - * by specifying a particular voice. Supported languages and voices are detailed - * [here](../../voice-locales). - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - /** Return true if this svaml.instruction.playFiles object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionPlayFilesDto svamlInstructionPlayFiles = (SvamlInstructionPlayFilesDto) o; - return Objects.equals(this.name, svamlInstructionPlayFiles.name) - && Objects.equals(this.ids, svamlInstructionPlayFiles.ids) - && Objects.equals(this.locale, svamlInstructionPlayFiles.locale); - } - - @Override - public int hashCode() { - return Objects.hash(name, ids, locale); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionPlayFilesDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).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/voice/models/dto/v1/SvamlInstructionSayDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSayDto.java deleted file mode 100644 index 4b22bcfba..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSayDto.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** - * Plays a synthesized text-to-speech message to the end user. The message is provided in the text - * field. - */ -@JsonPropertyOrder({ - SvamlInstructionSayDto.JSON_PROPERTY_NAME, - SvamlInstructionSayDto.JSON_PROPERTY_TEXT, - SvamlInstructionSayDto.JSON_PROPERTY_LOCALE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionSayDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `say`. */ - public enum NameEnum { - SAY("say"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_TEXT = "text"; - private String text; - private boolean textDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public SvamlInstructionSayDto() {} - - public SvamlInstructionSayDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `say`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlInstructionSayDto text(String text) { - this.text = text; - this.textDefined = true; - return this; - } - - /** - * Contains the message that will be spoken. Default maximum length is 600 characters. To change - * this limit, please contact support. - * - * @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; - } - - public SvamlInstructionSayDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * The voice and language you want to use for the text-to-speech message. This can either be - * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported - * languages and voices are detailed [here](../../voice-locales). - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - /** Return true if this svaml.instruction.say object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionSayDto svamlInstructionSay = (SvamlInstructionSayDto) o; - return Objects.equals(this.name, svamlInstructionSay.name) - && Objects.equals(this.text, svamlInstructionSay.text) - && Objects.equals(this.locale, svamlInstructionSay.locale); - } - - @Override - public int hashCode() { - return Objects.hash(name, text, locale); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionSayDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).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/voice/models/dto/v1/SvamlInstructionSendDtmfDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSendDtmfDto.java deleted file mode 100644 index e231db5f3..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSendDtmfDto.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** Plays DTMF tones in the call. */ -@JsonPropertyOrder({ - SvamlInstructionSendDtmfDto.JSON_PROPERTY_NAME, - SvamlInstructionSendDtmfDto.JSON_PROPERTY_VALUE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionSendDtmfDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `sendDtmf`. */ - public enum NameEnum { - SENDDTMF("sendDtmf"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_VALUE = "value"; - private String value; - private boolean valueDefined = false; - - public SvamlInstructionSendDtmfDto() {} - - public SvamlInstructionSendDtmfDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `sendDtmf`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlInstructionSendDtmfDto value(String value) { - this.value = value; - this.valueDefined = true; - return this; - } - - /** - * A string that determines the DTMF tones to play to the callee when the call is picked up. Valid - * characters are: `0-9`, `#`, and `w`. `w` renders a - * 500ms pause. For example, the string `ww1234#w#`, plays a 1 second pause, the DTMF - * tones for `1`, `2`, `3`, `4`, and `#`, - * followed by a 500ms pause and finally the `#` tone. This is useful if the callout - * destination requires a conference PIN code or an extension. If there is a calling party, it - * will hear progress while the DTMF is sent. - * - * @return value - */ - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getValue() { - return value; - } - - @JsonIgnore - public boolean getValueDefined() { - return valueDefined; - } - - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setValue(String value) { - this.value = value; - this.valueDefined = true; - } - - /** Return true if this svaml.instruction.sendDtmf object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionSendDtmfDto svamlInstructionSendDtmf = (SvamlInstructionSendDtmfDto) o; - return Objects.equals(this.name, svamlInstructionSendDtmf.name) - && Objects.equals(this.value, svamlInstructionSendDtmf.value); - } - - @Override - public int hashCode() { - return Objects.hash(name, value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionSendDtmfDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).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/voice/models/dto/v1/SvamlInstructionSetCookieDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSetCookieDto.java deleted file mode 100644 index 7765f5f47..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionSetCookieDto.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** Creates a cookie for the duration of the call. */ -@JsonPropertyOrder({ - SvamlInstructionSetCookieDto.JSON_PROPERTY_NAME, - SvamlInstructionSetCookieDto.JSON_PROPERTY_KEY, - SvamlInstructionSetCookieDto.JSON_PROPERTY_VALUE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionSetCookieDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `setCookie`. */ - public enum NameEnum { - SETCOOKIE("setCookie"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_KEY = "key"; - private String key; - private boolean keyDefined = false; - - public static final String JSON_PROPERTY_VALUE = "value"; - private String value; - private boolean valueDefined = false; - - public SvamlInstructionSetCookieDto() {} - - public SvamlInstructionSetCookieDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `setCookie`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlInstructionSetCookieDto key(String key) { - this.key = key; - this.keyDefined = true; - return this; - } - - /** - * The name of the cookie you want to set. - * - * @return key - */ - @JsonProperty(JSON_PROPERTY_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getKey() { - return key; - } - - @JsonIgnore - public boolean getKeyDefined() { - return keyDefined; - } - - @JsonProperty(JSON_PROPERTY_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setKey(String key) { - this.key = key; - this.keyDefined = true; - } - - public SvamlInstructionSetCookieDto value(String value) { - this.value = value; - this.valueDefined = true; - return this; - } - - /** - * The value of the cookie you want to set. - * - * @return value - */ - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getValue() { - return value; - } - - @JsonIgnore - public boolean getValueDefined() { - return valueDefined; - } - - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setValue(String value) { - this.value = value; - this.valueDefined = true; - } - - /** Return true if this svaml.instruction.setCookie object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionSetCookieDto svamlInstructionSetCookie = (SvamlInstructionSetCookieDto) o; - return Objects.equals(this.name, svamlInstructionSetCookie.name) - && Objects.equals(this.key, svamlInstructionSetCookie.key) - && Objects.equals(this.value, svamlInstructionSetCookie.value); - } - - @Override - public int hashCode() { - return Objects.hash(name, key, value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionSetCookieDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).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/voice/models/dto/v1/SvamlInstructionStartRecordingDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingDto.java deleted file mode 100644 index 57147b13d..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingDto.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** Starts a recording of the call. */ -@JsonPropertyOrder({ - SvamlInstructionStartRecordingDto.JSON_PROPERTY_NAME, - SvamlInstructionStartRecordingDto.JSON_PROPERTY_OPTIONS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionStartRecordingDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `startRecording`. */ - public enum NameEnum { - STARTRECORDING("startRecording"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public static final String JSON_PROPERTY_OPTIONS = "options"; - private SvamlInstructionStartRecordingOptionsDto options; - private boolean optionsDefined = false; - - public SvamlInstructionStartRecordingDto() {} - - public SvamlInstructionStartRecordingDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `startRecording`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - public SvamlInstructionStartRecordingDto options( - SvamlInstructionStartRecordingOptionsDto options) { - this.options = options; - this.optionsDefined = true; - return this; - } - - /** - * Get options - * - * @return options - */ - @JsonProperty(JSON_PROPERTY_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public SvamlInstructionStartRecordingOptionsDto getOptions() { - return options; - } - - @JsonIgnore - public boolean getOptionsDefined() { - return optionsDefined; - } - - @JsonProperty(JSON_PROPERTY_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(SvamlInstructionStartRecordingOptionsDto options) { - this.options = options; - this.optionsDefined = true; - } - - /** Return true if this svaml.instruction.startRecording object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionStartRecordingDto svamlInstructionStartRecording = - (SvamlInstructionStartRecordingDto) o; - return Objects.equals(this.name, svamlInstructionStartRecording.name) - && Objects.equals(this.options, svamlInstructionStartRecording.options); - } - - @Override - public int hashCode() { - return Objects.hash(name, options); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionStartRecordingDto {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" options: ").append(toIndentedString(options)).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/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsDto.java deleted file mode 100644 index 0d115a678..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsDto.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** SvamlInstructionStartRecordingOptionsDto */ -@JsonPropertyOrder({ - SvamlInstructionStartRecordingOptionsDto.JSON_PROPERTY_DESTINATION_URL, - SvamlInstructionStartRecordingOptionsDto.JSON_PROPERTY_CREDENTIALS, - SvamlInstructionStartRecordingOptionsDto.JSON_PROPERTY_FORMAT, - SvamlInstructionStartRecordingOptionsDto.JSON_PROPERTY_NOTIFICATION_EVENTS, - SvamlInstructionStartRecordingOptionsDto.JSON_PROPERTY_TRANSCRIPTION_OPTIONS -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionStartRecordingOptionsDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_DESTINATION_URL = "destinationUrl"; - private String destinationUrl; - private boolean destinationUrlDefined = false; - - public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; - private String credentials; - private boolean credentialsDefined = false; - - public static final String JSON_PROPERTY_FORMAT = "format"; - private String format; - private boolean formatDefined = false; - - public static final String JSON_PROPERTY_NOTIFICATION_EVENTS = "notificationEvents"; - private Boolean notificationEvents; - private boolean notificationEventsDefined = false; - - public static final String JSON_PROPERTY_TRANSCRIPTION_OPTIONS = "transcriptionOptions"; - private SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto transcriptionOptions; - private boolean transcriptionOptionsDefined = false; - - public SvamlInstructionStartRecordingOptionsDto() {} - - public SvamlInstructionStartRecordingOptionsDto destinationUrl(String destinationUrl) { - this.destinationUrl = destinationUrl; - this.destinationUrlDefined = true; - return this; - } - - /** - * Get destinationUrl - * - * @return destinationUrl - */ - @JsonProperty(JSON_PROPERTY_DESTINATION_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDestinationUrl() { - return destinationUrl; - } - - @JsonIgnore - public boolean getDestinationUrlDefined() { - return destinationUrlDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDestinationUrl(String destinationUrl) { - this.destinationUrl = destinationUrl; - this.destinationUrlDefined = true; - } - - public SvamlInstructionStartRecordingOptionsDto credentials(String credentials) { - this.credentials = credentials; - this.credentialsDefined = true; - return this; - } - - /** - * Get credentials - * - * @return credentials - */ - @JsonProperty(JSON_PROPERTY_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCredentials() { - return credentials; - } - - @JsonIgnore - public boolean getCredentialsDefined() { - return credentialsDefined; - } - - @JsonProperty(JSON_PROPERTY_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCredentials(String credentials) { - this.credentials = credentials; - this.credentialsDefined = true; - } - - public SvamlInstructionStartRecordingOptionsDto format(String format) { - this.format = format; - this.formatDefined = true; - return this; - } - - /** - * Get format - * - * @return format - */ - @JsonProperty(JSON_PROPERTY_FORMAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFormat() { - return format; - } - - @JsonIgnore - public boolean getFormatDefined() { - return formatDefined; - } - - @JsonProperty(JSON_PROPERTY_FORMAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFormat(String format) { - this.format = format; - this.formatDefined = true; - } - - public SvamlInstructionStartRecordingOptionsDto notificationEvents(Boolean notificationEvents) { - this.notificationEvents = notificationEvents; - this.notificationEventsDefined = true; - return this; - } - - /** - * Get notificationEvents - * - * @return notificationEvents - */ - @JsonProperty(JSON_PROPERTY_NOTIFICATION_EVENTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getNotificationEvents() { - return notificationEvents; - } - - @JsonIgnore - public boolean getNotificationEventsDefined() { - return notificationEventsDefined; - } - - @JsonProperty(JSON_PROPERTY_NOTIFICATION_EVENTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNotificationEvents(Boolean notificationEvents) { - this.notificationEvents = notificationEvents; - this.notificationEventsDefined = true; - } - - public SvamlInstructionStartRecordingOptionsDto transcriptionOptions( - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto transcriptionOptions) { - this.transcriptionOptions = transcriptionOptions; - this.transcriptionOptionsDefined = true; - return this; - } - - /** - * Get transcriptionOptions - * - * @return transcriptionOptions - */ - @JsonProperty(JSON_PROPERTY_TRANSCRIPTION_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto getTranscriptionOptions() { - return transcriptionOptions; - } - - @JsonIgnore - public boolean getTranscriptionOptionsDefined() { - return transcriptionOptionsDefined; - } - - @JsonProperty(JSON_PROPERTY_TRANSCRIPTION_OPTIONS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTranscriptionOptions( - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto transcriptionOptions) { - this.transcriptionOptions = transcriptionOptions; - this.transcriptionOptionsDefined = true; - } - - /** Return true if this svaml.instruction.startRecordingOptions object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionStartRecordingOptionsDto svamlInstructionStartRecordingOptions = - (SvamlInstructionStartRecordingOptionsDto) o; - return Objects.equals(this.destinationUrl, svamlInstructionStartRecordingOptions.destinationUrl) - && Objects.equals(this.credentials, svamlInstructionStartRecordingOptions.credentials) - && Objects.equals(this.format, svamlInstructionStartRecordingOptions.format) - && Objects.equals( - this.notificationEvents, svamlInstructionStartRecordingOptions.notificationEvents) - && Objects.equals( - this.transcriptionOptions, svamlInstructionStartRecordingOptions.transcriptionOptions); - } - - @Override - public int hashCode() { - return Objects.hash( - destinationUrl, credentials, format, notificationEvents, transcriptionOptions); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionStartRecordingOptionsDto {\n"); - sb.append(" destinationUrl: ").append(toIndentedString(destinationUrl)).append("\n"); - sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); - sb.append(" format: ").append(toIndentedString(format)).append("\n"); - sb.append(" notificationEvents: ").append(toIndentedString(notificationEvents)).append("\n"); - sb.append(" transcriptionOptions: ") - .append(toIndentedString(transcriptionOptions)) - .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/voice/models/dto/v1/SvamlInstructionStopRecordingDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStopRecordingDto.java deleted file mode 100644 index 1c050c39d..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStopRecordingDto.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** Stops the recording of the call. */ -@JsonPropertyOrder({SvamlInstructionStopRecordingDto.JSON_PROPERTY_NAME}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionStopRecordingDto { - private static final long serialVersionUID = 1L; - - /** The `name` property. Must have the value `stopRecording`. */ - public enum NameEnum { - STOPRECORDING("stopRecording"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - NameEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static NameEnum fromValue(String value) { - for (NameEnum b : NameEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - private boolean nameDefined = false; - - public SvamlInstructionStopRecordingDto() {} - - public SvamlInstructionStopRecordingDto name(String name) { - this.name = name; - this.nameDefined = true; - return this; - } - - /** - * The `name` property. Must have the value `stopRecording`. - * - * @return name - */ - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getName() { - return name; - } - - @JsonIgnore - public boolean getNameDefined() { - return nameDefined; - } - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setName(String name) { - this.name = name; - this.nameDefined = true; - } - - /** Return true if this svaml.instruction.stopRecording object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SvamlInstructionStopRecordingDto svamlInstructionStopRecording = - (SvamlInstructionStopRecordingDto) o; - return Objects.equals(this.name, svamlInstructionStopRecording.name); - } - - @Override - public int hashCode() { - return Objects.hash(name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionStopRecordingDto {\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/voice/models/dto/v1/TtsCalloutRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/TtsCalloutRequestDto.java deleted file mode 100644 index fa43eba7f..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/TtsCalloutRequestDto.java +++ /dev/null @@ -1,511 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 text-to-speech callout calls a phone number and plays a synthesized text messages or - * pre-recorded sound files. - */ -@JsonPropertyOrder({ - TtsCalloutRequestDto.JSON_PROPERTY_DESTINATION, - TtsCalloutRequestDto.JSON_PROPERTY_CLI, - TtsCalloutRequestDto.JSON_PROPERTY_DTMF, - TtsCalloutRequestDto.JSON_PROPERTY_DOMAIN, - TtsCalloutRequestDto.JSON_PROPERTY_CUSTOM, - TtsCalloutRequestDto.JSON_PROPERTY_LOCALE, - TtsCalloutRequestDto.JSON_PROPERTY_TEXT, - TtsCalloutRequestDto.JSON_PROPERTY_PROMPTS, - TtsCalloutRequestDto.JSON_PROPERTY_ENABLE_ACE, - TtsCalloutRequestDto.JSON_PROPERTY_ENABLE_DICE, - TtsCalloutRequestDto.JSON_PROPERTY_ENABLE_PIE -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class TtsCalloutRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_DESTINATION = "destination"; - private DestinationDto destination; - private boolean destinationDefined = false; - - public static final String JSON_PROPERTY_CLI = "cli"; - private String cli; - private boolean cliDefined = false; - - public static final String JSON_PROPERTY_DTMF = "dtmf"; - private String dtmf; - private boolean dtmfDefined = false; - - public static final String JSON_PROPERTY_DOMAIN = "domain"; - private DomainDto domain; - private boolean domainDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - - public static final String JSON_PROPERTY_TEXT = "text"; - private String text; - private boolean textDefined = false; - - public static final String JSON_PROPERTY_PROMPTS = "prompts"; - private String prompts; - private boolean promptsDefined = false; - - public static final String JSON_PROPERTY_ENABLE_ACE = "enableAce"; - private Boolean enableAce; - private boolean enableAceDefined = false; - - public static final String JSON_PROPERTY_ENABLE_DICE = "enableDice"; - private Boolean enableDice; - private boolean enableDiceDefined = false; - - public static final String JSON_PROPERTY_ENABLE_PIE = "enablePie"; - private Boolean enablePie; - private boolean enablePieDefined = false; - - public TtsCalloutRequestDto() {} - - public TtsCalloutRequestDto destination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - return this; - } - - /** - * Get destination - * - * @return destination - */ - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public DestinationDto getDestination() { - return destination; - } - - @JsonIgnore - public boolean getDestinationDefined() { - return destinationDefined; - } - - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setDestination(DestinationDto destination) { - this.destination = destination; - this.destinationDefined = true; - } - - public TtsCalloutRequestDto cli(String cli) { - this.cli = cli; - this.cliDefined = true; - return this; - } - - /** - * 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. The number must be in - * [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. - * - * @return cli - */ - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCli() { - return cli; - } - - @JsonIgnore - public boolean getCliDefined() { - return cliDefined; - } - - @JsonProperty(JSON_PROPERTY_CLI) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCli(String cli) { - this.cli = cli; - this.cliDefined = true; - } - - public TtsCalloutRequestDto dtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - return this; - } - - /** - * When the destination picks up, this DTMF tones will be played to the callee. Valid characters - * in the string are \"0\"-\"9\", \"#\", and \"w\". A - * \"w\" will render a 500 ms pause. For example, \"ww1234#w#\" will render a - * 1s pause, the DTMF tones \"1\", \"2\", \"3\", \"4\" and - * \"#\" followed by a 0.5s pause and finally the DTMF tone for \"#\". This - * can be used if the callout destination for instance require a conference PIN code or an - * extension to be entered. - * - * @return dtmf - */ - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getDtmf() { - return dtmf; - } - - @JsonIgnore - public boolean getDtmfDefined() { - return dtmfDefined; - } - - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - } - - public TtsCalloutRequestDto domain(DomainDto domain) { - this.domain = domain; - this.domainDefined = true; - return this; - } - - /** - * Get domain - * - * @return domain - */ - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DomainDto getDomain() { - return domain; - } - - @JsonIgnore - public boolean getDomainDefined() { - return domainDefined; - } - - @JsonProperty(JSON_PROPERTY_DOMAIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDomain(DomainDto domain) { - this.domain = domain; - this.domainDefined = true; - } - - public TtsCalloutRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * Can be used to input custom data. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public TtsCalloutRequestDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * The voice and language you want to use for the text-to-speech message. This can either be - * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported - * languages and voices are detailed [here](../../../voice-locales/). - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; - } - - @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; - } - - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; - } - - public TtsCalloutRequestDto text(String text) { - this.text = text; - this.textDefined = true; - return this; - } - - /** - * The text that will be spoken in the text-to-speech message. _Every application's default - * maximum characters allowed in text-to-speech is 600 characters. Contact support if you wish - * this limit to be changed._ - * - * @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; - } - - public TtsCalloutRequestDto prompts(String prompts) { - this.prompts = prompts; - this.promptsDefined = true; - return this; - } - - /** - * 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 are - * [here](https://docs.aws.amazon.com/polly/latest/dg/supportedtags.html) __Externally hosted - * media:__ Provide a URL to your own hosted media. Please check - * [here](../../../supported-audio-formats/#limits) 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>]```_ - * - * @return prompts - */ - @JsonProperty(JSON_PROPERTY_PROMPTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPrompts() { - return prompts; - } - - @JsonIgnore - public boolean getPromptsDefined() { - return promptsDefined; - } - - @JsonProperty(JSON_PROPERTY_PROMPTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPrompts(String prompts) { - this.prompts = prompts; - this.promptsDefined = true; - } - - public TtsCalloutRequestDto enableAce(Boolean enableAce) { - this.enableAce = enableAce; - this.enableAceDefined = true; - return this; - } - - /** - * 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. - * - * @return enableAce - */ - @JsonProperty(JSON_PROPERTY_ENABLE_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableAce() { - return enableAce; - } - - @JsonIgnore - public boolean getEnableAceDefined() { - return enableAceDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_ACE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableAce(Boolean enableAce) { - this.enableAce = enableAce; - this.enableAceDefined = true; - } - - public TtsCalloutRequestDto enableDice(Boolean enableDice) { - this.enableDice = enableDice; - this.enableDiceDefined = true; - return this; - } - - /** - * 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. - * - * @return enableDice - */ - @JsonProperty(JSON_PROPERTY_ENABLE_DICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnableDice() { - return enableDice; - } - - @JsonIgnore - public boolean getEnableDiceDefined() { - return enableDiceDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_DICE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnableDice(Boolean enableDice) { - this.enableDice = enableDice; - this.enableDiceDefined = true; - } - - public TtsCalloutRequestDto enablePie(Boolean enablePie) { - this.enablePie = enablePie; - this.enablePieDefined = true; - return this; - } - - /** - * <b>Note:</b> PIE callbacks are not available for DATA Calls; only PSTN and SIP - * calls. If `enablePie` is set to `true` and the application has a callback - * URL specified, you will receive a PIE callback after the `runMenu` action executes - * and after the configured menu timeout has elapsed with no input. If it's set to - * `false`, no PIE events will be sent to your backend. - * - * @return enablePie - */ - @JsonProperty(JSON_PROPERTY_ENABLE_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnablePie() { - return enablePie; - } - - @JsonIgnore - public boolean getEnablePieDefined() { - return enablePieDefined; - } - - @JsonProperty(JSON_PROPERTY_ENABLE_PIE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnablePie(Boolean enablePie) { - this.enablePie = enablePie; - this.enablePieDefined = true; - } - - /** Return true if this ttsCalloutRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TtsCalloutRequestDto ttsCalloutRequest = (TtsCalloutRequestDto) o; - return Objects.equals(this.destination, ttsCalloutRequest.destination) - && Objects.equals(this.cli, ttsCalloutRequest.cli) - && Objects.equals(this.dtmf, ttsCalloutRequest.dtmf) - && Objects.equals(this.domain, ttsCalloutRequest.domain) - && Objects.equals(this.custom, ttsCalloutRequest.custom) - && Objects.equals(this.locale, ttsCalloutRequest.locale) - && Objects.equals(this.text, ttsCalloutRequest.text) - && Objects.equals(this.prompts, ttsCalloutRequest.prompts) - && Objects.equals(this.enableAce, ttsCalloutRequest.enableAce) - && Objects.equals(this.enableDice, ttsCalloutRequest.enableDice) - && Objects.equals(this.enablePie, ttsCalloutRequest.enablePie); - } - - @Override - public int hashCode() { - return Objects.hash( - destination, - cli, - dtmf, - domain, - custom, - locale, - text, - prompts, - enableAce, - enableDice, - enablePie); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TtsCalloutRequestDto {\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); - sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); - sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); - sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" prompts: ").append(toIndentedString(prompts)).append("\n"); - sb.append(" enableAce: ").append(toIndentedString(enableAce)).append("\n"); - sb.append(" enableDice: ").append(toIndentedString(enableDice)).append("\n"); - sb.append(" enablePie: ").append(toIndentedString(enablePie)).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/voice/models/dto/v1/UnassignNumbersDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/UnassignNumbersDto.java deleted file mode 100644 index 3590399e5..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/UnassignNumbersDto.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** UnassignNumbersDto */ -@JsonPropertyOrder({ - UnassignNumbersDto.JSON_PROPERTY_NUMBER, - UnassignNumbersDto.JSON_PROPERTY_APPLICATIONKEY, - UnassignNumbersDto.JSON_PROPERTY_CAPABILITY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UnassignNumbersDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NUMBER = "number"; - private String number; - private boolean numberDefined = false; - - public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; - private String applicationkey; - private boolean applicationkeyDefined = false; - - /** - * (optional) indicates the DID capability that was assigned to the chosen application. Please - * note that the DID needs to support the selected capability. - */ - public enum CapabilityEnum { - VOICE("voice"), - - SMS("sms"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - CapabilityEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static CapabilityEnum fromValue(String value) { - for (CapabilityEnum b : CapabilityEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_CAPABILITY = "capability"; - private String capability; - private boolean capabilityDefined = false; - - public UnassignNumbersDto() {} - - public UnassignNumbersDto number(String number) { - this.number = number; - this.numberDefined = true; - return this; - } - - /** - * The phone number in E.164 format (https://en.wikipedia.org/wiki/E.164) - * - * @return number - */ - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getNumber() { - return number; - } - - @JsonIgnore - public boolean getNumberDefined() { - return numberDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumber(String number) { - this.number = number; - this.numberDefined = true; - } - - public UnassignNumbersDto applicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - return this; - } - - /** - * Indicates the application where the number(s) was assigned. If empty, the application key that - * is used to sign the request will be used. - * - * @return applicationkey - */ - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationkey() { - return applicationkey; - } - - @JsonIgnore - public boolean getApplicationkeyDefined() { - return applicationkeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - } - - public UnassignNumbersDto capability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - return this; - } - - /** - * (optional) indicates the DID capability that was assigned to the chosen application. Please - * note that the DID needs to support the selected capability. - * - * @return capability - */ - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCapability() { - return capability; - } - - @JsonIgnore - public boolean getCapabilityDefined() { - return capabilityDefined; - } - - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCapability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - } - - /** Return true if this unassignNumbers object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UnassignNumbersDto unassignNumbers = (UnassignNumbersDto) o; - return Objects.equals(this.number, unassignNumbers.number) - && Objects.equals(this.applicationkey, unassignNumbers.applicationkey) - && Objects.equals(this.capability, unassignNumbers.capability); - } - - @Override - public int hashCode() { - return Objects.hash(number, applicationkey, capability); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UnassignNumbersDto {\n"); - sb.append(" number: ").append(toIndentedString(number)).append("\n"); - sb.append(" applicationkey: ").append(toIndentedString(applicationkey)).append("\n"); - sb.append(" capability: ").append(toIndentedString(capability)).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/voice/models/dto/v1/UpdateNumbersDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/UpdateNumbersDto.java deleted file mode 100644 index 812b0fd17..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/UpdateNumbersDto.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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; - -/** UpdateNumbersDto */ -@JsonPropertyOrder({ - UpdateNumbersDto.JSON_PROPERTY_NUMBERS, - UpdateNumbersDto.JSON_PROPERTY_APPLICATIONKEY, - UpdateNumbersDto.JSON_PROPERTY_CAPABILITY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class UpdateNumbersDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_NUMBERS = "numbers"; - private List numbers; - private boolean numbersDefined = false; - - public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; - private String applicationkey; - private boolean applicationkeyDefined = false; - - /** - * indicates the DID capability that needs to be assigned to the chosen application. Valid values - * are 'voice' and 'sms'. Please note that the DID needs to support the selected - * capability. - */ - public enum CapabilityEnum { - VOICE("voice"), - - SMS("sms"), - - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - CapabilityEnum(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static CapabilityEnum fromValue(String value) { - for (CapabilityEnum b : CapabilityEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return UNKNOWN_DEFAULT_OPEN_API; - } - } - - public static final String JSON_PROPERTY_CAPABILITY = "capability"; - private String capability; - private boolean capabilityDefined = false; - - public UpdateNumbersDto() {} - - public UpdateNumbersDto numbers(List numbers) { - this.numbers = numbers; - this.numbersDefined = true; - return this; - } - - public UpdateNumbersDto addNumbersItem(String numbersItem) { - if (this.numbers == null) { - this.numbers = new ArrayList<>(); - } - this.numbersDefined = true; - this.numbers.add(numbersItem); - return this; - } - - /** - * The phone number or list of numbers in E.164 format. - * - * @return numbers - */ - @JsonProperty(JSON_PROPERTY_NUMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getNumbers() { - return numbers; - } - - @JsonIgnore - public boolean getNumbersDefined() { - return numbersDefined; - } - - @JsonProperty(JSON_PROPERTY_NUMBERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumbers(List numbers) { - this.numbers = numbers; - this.numbersDefined = true; - } - - public UpdateNumbersDto applicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - return this; - } - - /** - * indicates the application where the number(s) will be assigned. If empty, the application key - * that is used to sign the request will be used. - * - * @return applicationkey - */ - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationkey() { - return applicationkey; - } - - @JsonIgnore - public boolean getApplicationkeyDefined() { - return applicationkeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationkey(String applicationkey) { - this.applicationkey = applicationkey; - this.applicationkeyDefined = true; - } - - public UpdateNumbersDto capability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - return this; - } - - /** - * indicates the DID capability that needs to be assigned to the chosen application. Valid values - * are 'voice' and 'sms'. Please note that the DID needs to support the selected - * capability. - * - * @return capability - */ - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCapability() { - return capability; - } - - @JsonIgnore - public boolean getCapabilityDefined() { - return capabilityDefined; - } - - @JsonProperty(JSON_PROPERTY_CAPABILITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCapability(String capability) { - this.capability = capability; - this.capabilityDefined = true; - } - - /** Return true if this updateNumbers object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateNumbersDto updateNumbers = (UpdateNumbersDto) o; - return Objects.equals(this.numbers, updateNumbers.numbers) - && Objects.equals(this.applicationkey, updateNumbers.applicationkey) - && Objects.equals(this.capability, updateNumbers.capability); - } - - @Override - public int hashCode() { - return Objects.hash(numbers, applicationkey, capability); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateNumbersDto {\n"); - sb.append(" numbers: ").append(toIndentedString(numbers)).append("\n"); - sb.append(" applicationkey: ").append(toIndentedString(applicationkey)).append("\n"); - sb.append(" capability: ").append(toIndentedString(capability)).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/voice/models/dto/v1/WebhooksCallEventRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksCallEventRequestDto.java deleted file mode 100644 index 657a9c7d8..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksCallEventRequestDto.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.Objects; - -/** WebhooksCallEventRequestDto */ -@JsonPropertyOrder({ - WebhooksCallEventRequestDto.JSON_PROPERTY_TIMESTAMP, - WebhooksCallEventRequestDto.JSON_PROPERTY_CUSTOM, - WebhooksCallEventRequestDto.JSON_PROPERTY_APPLICATION_KEY -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class WebhooksCallEventRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; - private OffsetDateTime timestamp; - private boolean timestampDefined = false; - - public static final String JSON_PROPERTY_CUSTOM = "custom"; - private String custom; - private boolean customDefined = false; - - public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; - private String applicationKey; - private boolean applicationKeyDefined = false; - - public WebhooksCallEventRequestDto() {} - - public WebhooksCallEventRequestDto timestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - return this; - } - - /** - * The timestamp in UTC format. - * - * @return timestamp - */ - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonIgnore - public boolean getTimestampDefined() { - return timestampDefined; - } - - @JsonProperty(JSON_PROPERTY_TIMESTAMP) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimestamp(OffsetDateTime timestamp) { - this.timestamp = timestamp; - this.timestampDefined = true; - } - - public WebhooksCallEventRequestDto custom(String custom) { - this.custom = custom; - this.customDefined = true; - return this; - } - - /** - * A string that can be used to pass custom information related to the call. - * - * @return custom - */ - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCustom() { - return custom; - } - - @JsonIgnore - public boolean getCustomDefined() { - return customDefined; - } - - @JsonProperty(JSON_PROPERTY_CUSTOM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCustom(String custom) { - this.custom = custom; - this.customDefined = true; - } - - public WebhooksCallEventRequestDto applicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - return this; - } - - /** - * The unique application key. You can find it in the Sinch - * [dashboard](https://dashboard.sinch.com/voice/apps). - * - * @return applicationKey - */ - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getApplicationKey() { - return applicationKey; - } - - @JsonIgnore - public boolean getApplicationKeyDefined() { - return applicationKeyDefined; - } - - @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setApplicationKey(String applicationKey) { - this.applicationKey = applicationKey; - this.applicationKeyDefined = true; - } - - /** Return true if this webhooksCallEventRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhooksCallEventRequestDto webhooksCallEventRequest = (WebhooksCallEventRequestDto) o; - return Objects.equals(this.timestamp, webhooksCallEventRequest.timestamp) - && Objects.equals(this.custom, webhooksCallEventRequest.custom) - && Objects.equals(this.applicationKey, webhooksCallEventRequest.applicationKey); - } - - @Override - public int hashCode() { - return Objects.hash(timestamp, custom, applicationKey); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhooksCallEventRequestDto {\n"); - sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); - sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); - sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).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/voice/models/dto/v1/WebhooksEventDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventDto.java deleted file mode 100644 index d839ce04b..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventDto.java +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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 = WebhooksEventDto.WebhooksEventDtoDeserializer.class) -@JsonSerialize(using = WebhooksEventDto.WebhooksEventDtoSerializer.class) -public final class WebhooksEventDto extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(WebhooksEventDto.class.getName()); - - public static final class WebhooksEventDtoSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public WebhooksEventDtoSerializer(Class t) { - super(t); - } - - public WebhooksEventDtoSerializer() { - this(null); - } - - @Override - public void serialize(WebhooksEventDto value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(value.getActualInstance()); - } - } - - public static final class WebhooksEventDtoDeserializer extends StdDeserializer { - - private static final long serialVersionUID = 1L; - - public WebhooksEventDtoDeserializer() { - this(WebhooksEventDto.class); - } - - public WebhooksEventDtoDeserializer(Class vc) { - super(vc); - } - - @Override - public WebhooksEventDto deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - JsonNode tree = jp.readValueAsTree(); - Object deserialized = null; - WebhooksEventDto newWebhooksEventDto = new WebhooksEventDto(); - Map result2 = - tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); - String discriminatorValue = (String) result2.get("event"); - switch (discriminatorValue) { - case "ace": - deserialized = tree.traverse(jp.getCodec()).readValueAs(AceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "aceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(AceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "dice": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DiceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "diceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(DiceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "ice": - deserialized = tree.traverse(jp.getCodec()).readValueAs(IceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "iceRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(IceRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "notify": - deserialized = tree.traverse(jp.getCodec()).readValueAs(NotifyRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "notifyRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(NotifyRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "pie": - deserialized = tree.traverse(jp.getCodec()).readValueAs(PieRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - case "pieRequest": - deserialized = tree.traverse(jp.getCodec()).readValueAs(PieRequestDto.class); - newWebhooksEventDto.setActualInstance(deserialized); - return newWebhooksEventDto; - default: - log.log( - Level.WARNING, - String.format( - "Failed to lookup discriminator value `%s` for WebhooksEventDto. Possible values:" - + " ace aceRequest dice diceRequest ice iceRequest notify notifyRequest pie" - + " pieRequest", - discriminatorValue)); - } - - boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); - int match = 0; - JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize AceRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (AceRequestDto.class.equals(Integer.class) - || AceRequestDto.class.equals(Long.class) - || AceRequestDto.class.equals(Float.class) - || AceRequestDto.class.equals(Double.class) - || AceRequestDto.class.equals(Boolean.class) - || AceRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((AceRequestDto.class.equals(Integer.class) - || AceRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((AceRequestDto.class.equals(Float.class) - || AceRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (AceRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (AceRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(AceRequestDto.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 'AceRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'AceRequestDto'", e); - } - - // deserialize DiceRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (DiceRequestDto.class.equals(Integer.class) - || DiceRequestDto.class.equals(Long.class) - || DiceRequestDto.class.equals(Float.class) - || DiceRequestDto.class.equals(Double.class) - || DiceRequestDto.class.equals(Boolean.class) - || DiceRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((DiceRequestDto.class.equals(Integer.class) - || DiceRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((DiceRequestDto.class.equals(Float.class) - || DiceRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (DiceRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (DiceRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(DiceRequestDto.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 'DiceRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'DiceRequestDto'", e); - } - - // deserialize IceRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (IceRequestDto.class.equals(Integer.class) - || IceRequestDto.class.equals(Long.class) - || IceRequestDto.class.equals(Float.class) - || IceRequestDto.class.equals(Double.class) - || IceRequestDto.class.equals(Boolean.class) - || IceRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((IceRequestDto.class.equals(Integer.class) - || IceRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((IceRequestDto.class.equals(Float.class) - || IceRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (IceRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (IceRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(IceRequestDto.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 'IceRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'IceRequestDto'", e); - } - - // deserialize NotifyRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (NotifyRequestDto.class.equals(Integer.class) - || NotifyRequestDto.class.equals(Long.class) - || NotifyRequestDto.class.equals(Float.class) - || NotifyRequestDto.class.equals(Double.class) - || NotifyRequestDto.class.equals(Boolean.class) - || NotifyRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((NotifyRequestDto.class.equals(Integer.class) - || NotifyRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((NotifyRequestDto.class.equals(Float.class) - || NotifyRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (NotifyRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (NotifyRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(NotifyRequestDto.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 'NotifyRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'NotifyRequestDto'", e); - } - - // deserialize PieRequestDto - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (PieRequestDto.class.equals(Integer.class) - || PieRequestDto.class.equals(Long.class) - || PieRequestDto.class.equals(Float.class) - || PieRequestDto.class.equals(Double.class) - || PieRequestDto.class.equals(Boolean.class) - || PieRequestDto.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((PieRequestDto.class.equals(Integer.class) - || PieRequestDto.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((PieRequestDto.class.equals(Float.class) - || PieRequestDto.class.equals(Double.class)) - && token == JsonToken.VALUE_NUMBER_FLOAT); - attemptParsing |= - (PieRequestDto.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (PieRequestDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - deserialized = tree.traverse(jp.getCodec()).readValueAs(PieRequestDto.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 'PieRequestDto'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'PieRequestDto'", e); - } - - if (match == 1) { - WebhooksEventDto ret = new WebhooksEventDto(); - ret.setActualInstance(deserialized); - return ret; - } - throw new IOException( - String.format( - "Failed deserialization for WebhooksEventDto: %d classes match result, expected 1", - match)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public WebhooksEventDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "WebhooksEventDto cannot be null"); - } - } - - // store a list of schema names defined in oneOf - public static final Map> schemas = new HashMap<>(); - - public WebhooksEventDto() { - super("oneOf", Boolean.FALSE); - } - - public WebhooksEventDto(AceRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public WebhooksEventDto(DiceRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public WebhooksEventDto(IceRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public WebhooksEventDto(NotifyRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public WebhooksEventDto(PieRequestDto o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("AceRequestDto", AceRequestDto.class); - schemas.put("DiceRequestDto", DiceRequestDto.class); - schemas.put("IceRequestDto", IceRequestDto.class); - schemas.put("NotifyRequestDto", NotifyRequestDto.class); - schemas.put("PieRequestDto", PieRequestDto.class); - JSONNavigator.registerDescendants(WebhooksEventDto.class, Collections.unmodifiableMap(schemas)); - // Initialize and register the discriminator mappings. - Map> mappings = new HashMap>(); - mappings.put("ace", AceRequestDto.class); - mappings.put("aceRequest", AceRequestDto.class); - mappings.put("dice", DiceRequestDto.class); - mappings.put("diceRequest", DiceRequestDto.class); - mappings.put("ice", IceRequestDto.class); - mappings.put("iceRequest", IceRequestDto.class); - mappings.put("notify", NotifyRequestDto.class); - mappings.put("notifyRequest", NotifyRequestDto.class); - mappings.put("pie", PieRequestDto.class); - mappings.put("pieRequest", PieRequestDto.class); - mappings.put("webhooksEvent", WebhooksEventDto.class); - JSONNavigator.registerDiscriminator(WebhooksEventDto.class, "event", mappings); - } - - @Override - public Map> getSchemas() { - return WebhooksEventDto.schemas; - } - - /** - * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: AceRequestDto, DiceRequestDto, IceRequestDto, - * NotifyRequestDto, PieRequestDto - * - *

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(AceRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(DiceRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(IceRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(NotifyRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - if (JSONNavigator.isInstanceOf(PieRequestDto.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException( - "Invalid instance type. Must be AceRequestDto, DiceRequestDto, IceRequestDto," - + " NotifyRequestDto, PieRequestDto"); - } - - /** - * Get the actual instance, which can be the following: AceRequestDto, DiceRequestDto, - * IceRequestDto, NotifyRequestDto, PieRequestDto - * - * @return The actual instance (AceRequestDto, DiceRequestDto, IceRequestDto, NotifyRequestDto, - * PieRequestDto) - */ - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `AceRequestDto`. If the actual instance is not `AceRequestDto`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `AceRequestDto` - * @throws ClassCastException if the instance is not `AceRequestDto` - */ - public AceRequestDto getAceRequestDto() throws ClassCastException { - return (AceRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `DiceRequestDto`. If the actual instance is not `DiceRequestDto`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `DiceRequestDto` - * @throws ClassCastException if the instance is not `DiceRequestDto` - */ - public DiceRequestDto getDiceRequestDto() throws ClassCastException { - return (DiceRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `IceRequestDto`. If the actual instance is not `IceRequestDto`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `IceRequestDto` - * @throws ClassCastException if the instance is not `IceRequestDto` - */ - public IceRequestDto getIceRequestDto() throws ClassCastException { - return (IceRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `NotifyRequestDto`. If the actual instance is not - * `NotifyRequestDto`, the ClassCastException will be thrown. - * - * @return The actual instance of `NotifyRequestDto` - * @throws ClassCastException if the instance is not `NotifyRequestDto` - */ - public NotifyRequestDto getNotifyRequestDto() throws ClassCastException { - return (NotifyRequestDto) super.getActualInstance(); - } - - /** - * Get the actual instance of `PieRequestDto`. If the actual instance is not `PieRequestDto`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `PieRequestDto` - * @throws ClassCastException if the instance is not `PieRequestDto` - */ - public PieRequestDto getPieRequestDto() throws ClassCastException { - return (PieRequestDto) super.getActualInstance(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventRequestDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventRequestDto.java deleted file mode 100644 index d6594fce4..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventRequestDto.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.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.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.sinch.sdk.core.utils.databind.JSONNavigator; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** WebhooksEventRequestDto */ -@JsonPropertyOrder({ - WebhooksEventRequestDto.JSON_PROPERTY_EVENT, - WebhooksEventRequestDto.JSON_PROPERTY_CALLID, - WebhooksEventRequestDto.JSON_PROPERTY_VERSION -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) - -/*@JsonIgnoreProperties( - value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization - allowSetters = true // allows the event to be set during deserialization -)*/ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NONE, - include = JsonTypeInfo.As.EXISTING_PROPERTY, - property = "event", - visible = true) -@JsonSubTypes({ - @JsonSubTypes.Type(value = AceRequestDto.class, name = "aceRequest"), - @JsonSubTypes.Type(value = DiceRequestDto.class, name = "diceRequest"), - @JsonSubTypes.Type(value = IceRequestDto.class, name = "iceRequest"), - @JsonSubTypes.Type(value = NotifyRequestDto.class, name = "notifyRequest"), - @JsonSubTypes.Type(value = PieRequestDto.class, name = "pieRequest"), -}) -public class WebhooksEventRequestDto { - private static final long serialVersionUID = 1L; - public static final String JSON_PROPERTY_EVENT = "event"; - private String event; - private boolean eventDefined = false; - - public static final String JSON_PROPERTY_CALLID = "callid"; - private String callid; - private boolean callidDefined = false; - - public static final String JSON_PROPERTY_VERSION = "version"; - private Integer version; - private boolean versionDefined = false; - - public WebhooksEventRequestDto() {} - - public WebhooksEventRequestDto event(String event) { - this.event = event; - this.eventDefined = true; - return this; - } - - /** - * Get event - * - * @return event - */ - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getEvent() { - return event; - } - - @JsonIgnore - public boolean getEventDefined() { - return eventDefined; - } - - @JsonProperty(JSON_PROPERTY_EVENT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setEvent(String event) { - this.event = event; - this.eventDefined = true; - } - - public WebhooksEventRequestDto callid(String callid) { - this.callid = callid; - this.callidDefined = true; - return this; - } - - /** - * The unique ID assigned to this call. - * - * @return callid - */ - @JsonProperty(JSON_PROPERTY_CALLID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallid() { - return callid; - } - - @JsonIgnore - public boolean getCallidDefined() { - return callidDefined; - } - - @JsonProperty(JSON_PROPERTY_CALLID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallid(String callid) { - this.callid = callid; - this.callidDefined = true; - } - - public WebhooksEventRequestDto version(Integer version) { - this.version = version; - this.versionDefined = true; - return this; - } - - /** - * The current API version. - * - * @return version - */ - @JsonProperty(JSON_PROPERTY_VERSION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Integer getVersion() { - return version; - } - - @JsonIgnore - public boolean getVersionDefined() { - return versionDefined; - } - - @JsonProperty(JSON_PROPERTY_VERSION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setVersion(Integer version) { - this.version = version; - this.versionDefined = true; - } - - /** Return true if this webhooksEventRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhooksEventRequestDto webhooksEventRequest = (WebhooksEventRequestDto) o; - return Objects.equals(this.event, webhooksEventRequest.event) - && Objects.equals(this.callid, webhooksEventRequest.callid) - && Objects.equals(this.version, webhooksEventRequest.version); - } - - @Override - public int hashCode() { - return Objects.hash(event, callid, version); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhooksEventRequestDto {\n"); - sb.append(" event: ").append(toIndentedString(event)).append("\n"); - sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); - sb.append(" version: ").append(toIndentedString(version)).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("aceRequest", AceRequestDto.class); - mappings.put("diceRequest", DiceRequestDto.class); - mappings.put("iceRequest", IceRequestDto.class); - mappings.put("notifyRequest", NotifyRequestDto.class); - mappings.put("pieRequest", PieRequestDto.class); - mappings.put("webhooksEventRequest", WebhooksEventRequestDto.class); - JSONNavigator.registerDiscriminator(WebhooksEventRequestDto.class, "event", mappings); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Domain.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Domain.java new file mode 100644 index 000000000..092ca92a5 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Domain.java @@ -0,0 +1,44 @@ +package com.sinch.sdk.domains.voice.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; + +/** + * Can be either pstn for PSTN endpoint or mxp for data (app or web) + * clients. + */ +public class Domain extends EnumDynamic { + + /** A call on the Public Switched Telephone Network. */ + public static final Domain PSTN = new Domain("pstn"); + + /** A data call. */ + public static final Domain MXP = new Domain("mxp"); + + /** A call on the Public Switched Telephone Network. */ + public static final Domain PSTN2 = new Domain("PSTN"); + + /** A data call. */ + public static final Domain MXP2 = new Domain("MXP"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(Domain.class, Domain::new, Arrays.asList(PSTN, MXP, PSTN2, MXP2)); + + private Domain(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static Domain from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(Domain e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/MusicOnHold.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/MusicOnHold.java new file mode 100644 index 000000000..b2024a806 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/MusicOnHold.java @@ -0,0 +1,42 @@ +package com.sinch.sdk.domains.voice.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; + +/** Available Music On Hold values */ +public class MusicOnHold extends EnumDynamic { + + /** Plays a progress tone. */ + public static final MusicOnHold RING = new MusicOnHold("ring"); + + /** Plays music choice 1. */ + public static final MusicOnHold MUSIC1 = new MusicOnHold("music1"); + + /** Plays music choice 2. */ + public static final MusicOnHold MUSIC2 = new MusicOnHold("music2"); + + /** Plays music choice 3. */ + public static final MusicOnHold MUSIC3 = new MusicOnHold("music3"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + MusicOnHold.class, MusicOnHold::new, Arrays.asList(RING, MUSIC1, MUSIC2, MUSIC3)); + + private MusicOnHold(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static MusicOnHold from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(MusicOnHold e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Price.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Price.java new file mode 100644 index 000000000..da3f3cbbc --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/Price.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; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** Price */ +@JsonDeserialize(builder = PriceImpl.Builder.class) +public interface Price { + + /** + * Get currencyId + * + * @return currencyId + */ + String getCurrencyId(); + + /** + * Get amount + * + * @return amount + */ + Float getAmount(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new PriceImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param currencyId see getter + * @return Current builder + * @see #getCurrencyId + */ + Builder setCurrencyId(String currencyId); + + /** + * see getter + * + * @param amount see getter + * @return Current builder + * @see #getAmount + */ + Builder setAmount(Float amount); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + Price build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PriceDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/PriceImpl.java similarity index 54% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PriceDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/PriceImpl.java index 01d5791b2..f0cc1e78e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/PriceDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/PriceImpl.java @@ -1,96 +1,55 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.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.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; import java.util.Objects; -/** PriceDto */ -@JsonPropertyOrder({PriceDto.JSON_PROPERTY_CURRENCY_ID, PriceDto.JSON_PROPERTY_AMOUNT}) +@JsonPropertyOrder({PriceImpl.JSON_PROPERTY_CURRENCY_ID, PriceImpl.JSON_PROPERTY_AMOUNT}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class PriceDto { +public class PriceImpl implements Price { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_CURRENCY_ID = "currencyId"; - private String currencyId; - private boolean currencyIdDefined = false; + + private OptionalValue currencyId; public static final String JSON_PROPERTY_AMOUNT = "amount"; - private Float amount; - private boolean amountDefined = false; - public PriceDto() {} + private OptionalValue amount; - public PriceDto currencyId(String currencyId) { - this.currencyId = currencyId; - this.currencyIdDefined = true; - return this; - } + public PriceImpl() {} - /** - * Get currencyId - * - * @return currencyId - */ - @JsonProperty(JSON_PROPERTY_CURRENCY_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCurrencyId() { - return currencyId; + protected PriceImpl(OptionalValue currencyId, OptionalValue amount) { + this.currencyId = currencyId; + this.amount = amount; } @JsonIgnore - public boolean getCurrencyIdDefined() { - return currencyIdDefined; + public String getCurrencyId() { + return currencyId.orElse(null); } @JsonProperty(JSON_PROPERTY_CURRENCY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCurrencyId(String currencyId) { - this.currencyId = currencyId; - this.currencyIdDefined = true; - } - - public PriceDto amount(Float amount) { - this.amount = amount; - this.amountDefined = true; - return this; - } - - /** - * Get amount - * - * @return amount - */ - @JsonProperty(JSON_PROPERTY_AMOUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Float getAmount() { - return amount; + public OptionalValue currencyId() { + return currencyId; } @JsonIgnore - public boolean getAmountDefined() { - return amountDefined; + public Float getAmount() { + return amount.orElse(null); } @JsonProperty(JSON_PROPERTY_AMOUNT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setAmount(Float amount) { - this.amount = amount; - this.amountDefined = true; + public OptionalValue amount() { + return amount; } /** Return true if this price object is equal to o. */ @@ -102,7 +61,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PriceDto price = (PriceDto) o; + PriceImpl price = (PriceImpl) o; return Objects.equals(this.currencyId, price.currencyId) && Objects.equals(this.amount, price.amount); } @@ -115,7 +74,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class PriceDto {\n"); + sb.append("class PriceImpl {\n"); sb.append(" currencyId: ").append(toIndentedString(currencyId)).append("\n"); sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); sb.append("}"); @@ -131,4 +90,26 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements Price.Builder { + OptionalValue currencyId = OptionalValue.empty(); + OptionalValue amount = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CURRENCY_ID) + public Builder setCurrencyId(String currencyId) { + this.currencyId = OptionalValue.of(currencyId); + return this; + } + + @JsonProperty(JSON_PROPERTY_AMOUNT) + public Builder setAmount(Float amount) { + this.amount = OptionalValue.of(amount); + return this; + } + + public Price build() { + return new PriceImpl(currencyId, amount); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Callbacks.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Callbacks.java new file mode 100644 index 000000000..62b8a08fa --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Callbacks.java @@ -0,0 +1,54 @@ +/* + * 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.applications; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** Callbacks */ +@JsonDeserialize(builder = CallbacksImpl.Builder.class) +public interface Callbacks { + + /** + * Get url + * + * @return url + */ + CallbacksUrl getUrl(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CallbacksImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param url see getter + * @return Current builder + * @see #getUrl + */ + Builder setUrl(CallbacksUrl url); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + Callbacks build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksImpl.java similarity index 56% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksImpl.java index 090a6543b..266dfd1ec 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksImpl.java @@ -1,63 +1,39 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.applications; 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; -/** CallbacksDto */ -@JsonPropertyOrder({CallbacksDto.JSON_PROPERTY_URL}) +@JsonPropertyOrder({CallbacksImpl.JSON_PROPERTY_URL}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CallbacksDto { +public class CallbacksImpl implements Callbacks { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_URL = "url"; - private CallbacksUrlDto url; - private boolean urlDefined = false; - public CallbacksDto() {} + private OptionalValue url; - public CallbacksDto url(CallbacksUrlDto url) { - this.url = url; - this.urlDefined = true; - return this; - } + public CallbacksImpl() {} - /** - * Get url - * - * @return url - */ - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public CallbacksUrlDto getUrl() { - return url; + protected CallbacksImpl(OptionalValue url) { + this.url = url; } @JsonIgnore - public boolean getUrlDefined() { - return urlDefined; + public CallbacksUrl getUrl() { + return url.orElse(null); } @JsonProperty(JSON_PROPERTY_URL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setUrl(CallbacksUrlDto url) { - this.url = url; - this.urlDefined = true; + public OptionalValue url() { + return url; } /** Return true if this callbacks object is equal to o. */ @@ -69,7 +45,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CallbacksDto callbacks = (CallbacksDto) o; + CallbacksImpl callbacks = (CallbacksImpl) o; return Objects.equals(this.url, callbacks.url); } @@ -81,7 +57,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CallbacksDto {\n"); + sb.append("class CallbacksImpl {\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append("}"); return sb.toString(); @@ -96,4 +72,19 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements Callbacks.Builder { + OptionalValue url = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_URL) + public Builder setUrl(CallbacksUrl url) { + this.url = OptionalValue.of(url); + return this; + } + + public Callbacks build() { + return new CallbacksImpl(url); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrl.java new file mode 100644 index 000000000..c8299b426 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrl.java @@ -0,0 +1,71 @@ +/* + * 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.applications; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** Contains primary and or fallback callback URLs */ +@JsonDeserialize(builder = CallbacksUrlImpl.Builder.class) +public interface CallbacksUrl { + + /** + * Your primary callback URL + * + * @return primary + */ + String getPrimary(); + + /** + * Your fallback callback URL (returned if configured). It is used only if Sinch platform gets a + * timeout or error from your primary callback URL. + * + * @return fallback + */ + String getFallback(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CallbacksUrlImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param primary see getter + * @return Current builder + * @see #getPrimary + */ + Builder setPrimary(String primary); + + /** + * see getter + * + * @param fallback see getter + * @return Current builder + * @see #getFallback + */ + Builder setFallback(String fallback); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CallbacksUrl build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksUrlDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrlImpl.java similarity index 51% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksUrlDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrlImpl.java index 62ded3c39..d6457bf99 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallbacksUrlDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/CallbacksUrlImpl.java @@ -1,97 +1,58 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.applications; 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; -/** Contains primary and or fallback callback URLs */ -@JsonPropertyOrder({CallbacksUrlDto.JSON_PROPERTY_PRIMARY, CallbacksUrlDto.JSON_PROPERTY_FALLBACK}) +@JsonPropertyOrder({ + CallbacksUrlImpl.JSON_PROPERTY_PRIMARY, + CallbacksUrlImpl.JSON_PROPERTY_FALLBACK +}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CallbacksUrlDto { +public class CallbacksUrlImpl implements CallbacksUrl { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_PRIMARY = "primary"; - private String primary; - private boolean primaryDefined = false; + + private OptionalValue primary; public static final String JSON_PROPERTY_FALLBACK = "fallback"; - private String fallback; - private boolean fallbackDefined = false; - public CallbacksUrlDto() {} + private OptionalValue fallback; - public CallbacksUrlDto primary(String primary) { - this.primary = primary; - this.primaryDefined = true; - return this; - } + public CallbacksUrlImpl() {} - /** - * Your primary callback URL - * - * @return primary - */ - @JsonProperty(JSON_PROPERTY_PRIMARY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getPrimary() { - return primary; + protected CallbacksUrlImpl(OptionalValue primary, OptionalValue fallback) { + this.primary = primary; + this.fallback = fallback; } @JsonIgnore - public boolean getPrimaryDefined() { - return primaryDefined; + public String getPrimary() { + return primary.orElse(null); } @JsonProperty(JSON_PROPERTY_PRIMARY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setPrimary(String primary) { - this.primary = primary; - this.primaryDefined = true; - } - - public CallbacksUrlDto fallback(String fallback) { - this.fallback = fallback; - this.fallbackDefined = true; - return this; - } - - /** - * Your fallback callback URL (returned if configured). It is used only if Sinch platform gets a - * timeout or error from your primary callback URL. - * - * @return fallback - */ - @JsonProperty(JSON_PROPERTY_FALLBACK) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getFallback() { - return fallback; + public OptionalValue primary() { + return primary; } @JsonIgnore - public boolean getFallbackDefined() { - return fallbackDefined; + public String getFallback() { + return fallback.orElse(null); } @JsonProperty(JSON_PROPERTY_FALLBACK) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFallback(String fallback) { - this.fallback = fallback; - this.fallbackDefined = true; + public OptionalValue fallback() { + return fallback; } /** Return true if this callbacks_url object is equal to o. */ @@ -103,7 +64,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CallbacksUrlDto callbacksUrl = (CallbacksUrlDto) o; + CallbacksUrlImpl callbacksUrl = (CallbacksUrlImpl) o; return Objects.equals(this.primary, callbacksUrl.primary) && Objects.equals(this.fallback, callbacksUrl.fallback); } @@ -116,7 +77,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CallbacksUrlDto {\n"); + sb.append("class CallbacksUrlImpl {\n"); sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); sb.append(" fallback: ").append(toIndentedString(fallback)).append("\n"); sb.append("}"); @@ -132,4 +93,26 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements CallbacksUrl.Builder { + OptionalValue primary = OptionalValue.empty(); + OptionalValue fallback = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_PRIMARY) + public Builder setPrimary(String primary) { + this.primary = OptionalValue.of(primary); + return this; + } + + @JsonProperty(JSON_PROPERTY_FALLBACK) + public Builder setFallback(String fallback) { + this.fallback = OptionalValue.of(fallback); + return this; + } + + public CallbacksUrl build() { + return new CallbacksUrlImpl(primary, fallback); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Capability.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Capability.java new file mode 100644 index 000000000..039b128f0 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/Capability.java @@ -0,0 +1,35 @@ +package com.sinch.sdk.domains.voice.models.v1.applications; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Valid values are voice and sms */ +public class Capability extends EnumDynamic { + + /** Able to make Voice calls. */ + public static final Capability VOICE = new Capability("voice"); + + /** Able to send SMS messages. */ + public static final Capability SMS = new Capability("sms"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(Capability.class, Capability::new, Arrays.asList(VOICE, SMS)); + + 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/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequest.java new file mode 100644 index 000000000..6fd0e2c70 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequest.java @@ -0,0 +1,89 @@ +/* + * 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.applications.request; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; + +/** UnAssignNumberRequest */ +@JsonDeserialize(builder = UnAssignNumberRequestImpl.Builder.class) +public interface UnAssignNumberRequest { + + /** + * The phone number in E.164 format (https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) + * + * @return number + */ + String getNumber(); + + /** + * Indicates the application where the number(s) was assigned. If empty, the application key that + * is used to sign the request will be used. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** + * (optional) indicates the DID capability that was assigned to the chosen application. Please + * note that the DID needs to support the selected capability. + * + * @return capability + */ + Capability getCapability(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new UnAssignNumberRequestImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param number see getter + * @return Current builder + * @see #getNumber + */ + Builder setNumber(String number); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param capability see getter + * @return Current builder + * @see #getCapability + */ + Builder setCapability(Capability capability); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + UnAssignNumberRequest build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestImpl.java new file mode 100644 index 000000000..a6320674a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestImpl.java @@ -0,0 +1,148 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.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.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; +import java.util.Objects; + +@JsonPropertyOrder({ + UnAssignNumberRequestImpl.JSON_PROPERTY_NUMBER, + UnAssignNumberRequestImpl.JSON_PROPERTY_APPLICATIONKEY, + UnAssignNumberRequestImpl.JSON_PROPERTY_CAPABILITY +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class UnAssignNumberRequestImpl implements UnAssignNumberRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NUMBER = "number"; + + private OptionalValue number; + + public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_CAPABILITY = "capability"; + + private OptionalValue capability; + + public UnAssignNumberRequestImpl() {} + + protected UnAssignNumberRequestImpl( + OptionalValue number, + OptionalValue applicationKey, + OptionalValue capability) { + this.number = number; + this.applicationKey = applicationKey; + this.capability = capability; + } + + @JsonIgnore + public String getNumber() { + return number.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue number() { + return number; + } + + @JsonIgnore + public String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public Capability getCapability() { + return capability.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue capability() { + return capability; + } + + /** Return true if this unassignNumbers object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnAssignNumberRequestImpl unassignNumbers = (UnAssignNumberRequestImpl) o; + return Objects.equals(this.number, unassignNumbers.number) + && Objects.equals(this.applicationKey, unassignNumbers.applicationKey) + && Objects.equals(this.capability, unassignNumbers.capability); + } + + @Override + public int hashCode() { + return Objects.hash(number, applicationKey, capability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnAssignNumberRequestImpl {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" capability: ").append(toIndentedString(capability)).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 UnAssignNumberRequest.Builder { + OptionalValue number = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue capability = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBER) + public Builder setNumber(String number) { + this.number = OptionalValue.of(number); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + public Builder setCapability(Capability capability) { + this.capability = OptionalValue.of(capability); + return this; + } + + public UnAssignNumberRequest build() { + return new UnAssignNumberRequestImpl(number, applicationKey, capability); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequest.java new file mode 100644 index 000000000..4380ad1b5 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequest.java @@ -0,0 +1,90 @@ +/* + * 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.applications.request; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; +import java.util.List; + +/** UpdateNumbersRequest */ +@JsonDeserialize(builder = UpdateNumbersRequestImpl.Builder.class) +public interface UpdateNumbersRequest { + + /** + * The phone number or list of numbers in E.164 format. + * + * @return numbers + */ + List getNumbers(); + + /** + * indicates the application where the number(s) will be assigned. If empty, the application key + * that is used to sign the request will be used. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** + * indicates the DID capability that needs to be assigned to the chosen application. Please note + * that the DID needs to support the selected capability. + * + * @return capability + */ + Capability getCapability(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new UpdateNumbersRequestImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param numbers see getter + * @return Current builder + * @see #getNumbers + */ + Builder setNumbers(List numbers); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param capability see getter + * @return Current builder + * @see #getCapability + */ + Builder setCapability(Capability capability); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + UpdateNumbersRequest build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestImpl.java new file mode 100644 index 000000000..55854e15b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestImpl.java @@ -0,0 +1,149 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.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.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({ + UpdateNumbersRequestImpl.JSON_PROPERTY_NUMBERS, + UpdateNumbersRequestImpl.JSON_PROPERTY_APPLICATIONKEY, + UpdateNumbersRequestImpl.JSON_PROPERTY_CAPABILITY +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class UpdateNumbersRequestImpl implements UpdateNumbersRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NUMBERS = "numbers"; + + private OptionalValue> numbers; + + public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_CAPABILITY = "capability"; + + private OptionalValue capability; + + public UpdateNumbersRequestImpl() {} + + protected UpdateNumbersRequestImpl( + OptionalValue> numbers, + OptionalValue applicationKey, + OptionalValue capability) { + this.numbers = numbers; + this.applicationKey = applicationKey; + this.capability = capability; + } + + @JsonIgnore + public List getNumbers() { + return numbers.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> numbers() { + return numbers; + } + + @JsonIgnore + public String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public Capability getCapability() { + return capability.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue capability() { + return capability; + } + + /** Return true if this updateNumbers object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateNumbersRequestImpl updateNumbers = (UpdateNumbersRequestImpl) o; + return Objects.equals(this.numbers, updateNumbers.numbers) + && Objects.equals(this.applicationKey, updateNumbers.applicationKey) + && Objects.equals(this.capability, updateNumbers.capability); + } + + @Override + public int hashCode() { + return Objects.hash(numbers, applicationKey, capability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNumbersRequestImpl {\n"); + sb.append(" numbers: ").append(toIndentedString(numbers)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" capability: ").append(toIndentedString(capability)).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 UpdateNumbersRequest.Builder { + OptionalValue> numbers = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue capability = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBERS) + public Builder setNumbers(List numbers) { + this.numbers = OptionalValue.of(numbers); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + public Builder setCapability(Capability capability) { + this.capability = OptionalValue.of(capability); + return this; + } + + public UpdateNumbersRequest build() { + return new UpdateNumbersRequestImpl(numbers, applicationKey, capability); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformation.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformation.java new file mode 100644 index 000000000..77bbfabdd --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformation.java @@ -0,0 +1,88 @@ +/* + * 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.applications.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; + +/** OwnedNumberInformation */ +@JsonDeserialize(builder = OwnedNumberInformationImpl.Builder.class) +public interface OwnedNumberInformation { + + /** + * Numbers that you own in E.164 format. + * + * @return number + */ + String getNumber(); + + /** + * Indicates the application where the number(s) will be assigned. If no number is assigned the + * applicationkey will not be returned. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** + * Get capability + * + * @return capability + */ + Capability getCapability(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new OwnedNumberInformationImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param number see getter + * @return Current builder + * @see #getNumber + */ + Builder setNumber(String number); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param capability see getter + * @return Current builder + * @see #getCapability + */ + Builder setCapability(Capability capability); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + OwnedNumberInformation build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformationImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformationImpl.java new file mode 100644 index 000000000..dcc23e335 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumberInformationImpl.java @@ -0,0 +1,148 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.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.voice.models.v1.applications.Capability; +import java.util.Objects; + +@JsonPropertyOrder({ + OwnedNumberInformationImpl.JSON_PROPERTY_NUMBER, + OwnedNumberInformationImpl.JSON_PROPERTY_APPLICATIONKEY, + OwnedNumberInformationImpl.JSON_PROPERTY_CAPABILITY +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class OwnedNumberInformationImpl implements OwnedNumberInformation { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NUMBER = "number"; + + private OptionalValue number; + + public static final String JSON_PROPERTY_APPLICATIONKEY = "applicationkey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_CAPABILITY = "capability"; + + private OptionalValue capability; + + public OwnedNumberInformationImpl() {} + + protected OwnedNumberInformationImpl( + OptionalValue number, + OptionalValue applicationKey, + OptionalValue capability) { + this.number = number; + this.applicationKey = applicationKey; + this.capability = capability; + } + + @JsonIgnore + public String getNumber() { + return number.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue number() { + return number; + } + + @JsonIgnore + public String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public Capability getCapability() { + return capability.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue capability() { + return capability; + } + + /** Return true if this getNumbersResponseObj_numbers_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; + } + OwnedNumberInformationImpl getNumbersResponseObjNumbersInner = (OwnedNumberInformationImpl) o; + return Objects.equals(this.number, getNumbersResponseObjNumbersInner.number) + && Objects.equals(this.applicationKey, getNumbersResponseObjNumbersInner.applicationKey) + && Objects.equals(this.capability, getNumbersResponseObjNumbersInner.capability); + } + + @Override + public int hashCode() { + return Objects.hash(number, applicationKey, capability); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnedNumberInformationImpl {\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" capability: ").append(toIndentedString(capability)).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 OwnedNumberInformation.Builder { + OptionalValue number = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue capability = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBER) + public Builder setNumber(String number) { + this.number = OptionalValue.of(number); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATIONKEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_CAPABILITY) + public Builder setCapability(Capability capability) { + this.capability = OptionalValue.of(capability); + return this; + } + + public OwnedNumberInformation build() { + return new OwnedNumberInformationImpl(number, applicationKey, capability); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponse.java new file mode 100644 index 000000000..ff4d5340f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponse.java @@ -0,0 +1,55 @@ +/* + * 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.applications.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.List; + +/** OwnedNumbersResponse */ +@JsonDeserialize(builder = OwnedNumbersResponseImpl.Builder.class) +public interface OwnedNumbersResponse { + + /** + * The object type. Will always be list of numbers, associated application keys and capabilities + * + * @return numbers + */ + List getNumbers(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new OwnedNumbersResponseImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param numbers see getter + * @return Current builder + * @see #getNumbers + */ + Builder setNumbers(List numbers); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + OwnedNumbersResponse build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseImpl.java new file mode 100644 index 000000000..c5c16bc94 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseImpl.java @@ -0,0 +1,91 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.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 java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({OwnedNumbersResponseImpl.JSON_PROPERTY_NUMBERS}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class OwnedNumbersResponseImpl implements OwnedNumbersResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NUMBERS = "numbers"; + + private OptionalValue> numbers; + + public OwnedNumbersResponseImpl() {} + + protected OwnedNumbersResponseImpl(OptionalValue> numbers) { + this.numbers = numbers; + } + + @JsonIgnore + public List getNumbers() { + return numbers.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> numbers() { + return numbers; + } + + /** Return true if this getNumbersResponseObj object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OwnedNumbersResponseImpl getNumbersResponseObj = (OwnedNumbersResponseImpl) o; + return Objects.equals(this.numbers, getNumbersResponseObj.numbers); + } + + @Override + public int hashCode() { + return Objects.hash(numbers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OwnedNumbersResponseImpl {\n"); + sb.append(" numbers: ").append(toIndentedString(numbers)).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 OwnedNumbersResponse.Builder { + OptionalValue> numbers = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBERS) + public Builder setNumbers(List numbers) { + this.numbers = OptionalValue.of(numbers); + return this; + } + + public OwnedNumbersResponse build() { + return new OwnedNumbersResponseImpl(numbers); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformation.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformation.java new file mode 100644 index 000000000..be5db3d7f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformation.java @@ -0,0 +1,153 @@ +/* + * 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.applications.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.voice.models.v1.Price; +import java.util.Arrays; +import java.util.stream.Stream; + +/** The number item object. */ +@JsonDeserialize(builder = QueryNumberInformationImpl.Builder.class) +public interface QueryNumberInformation { + + /** + * The ISO 3166-1 formatted country code. + * + * @return countryId + */ + String getCountryId(); + + /** The type of the number. */ + public class NumberTypeEnum extends EnumDynamic { + public static final NumberTypeEnum UNKNOWN = new NumberTypeEnum("Unknown"); + public static final NumberTypeEnum FIXED = new NumberTypeEnum("Fixed"); + public static final NumberTypeEnum MOBILE = new NumberTypeEnum("Mobile"); + public static final NumberTypeEnum OTHER = new NumberTypeEnum("Other"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + NumberTypeEnum.class, + NumberTypeEnum::new, + Arrays.asList(UNKNOWN, FIXED, MOBILE, OTHER)); + + private NumberTypeEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NumberTypeEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NumberTypeEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The type of the number. + * + * @return numberType + */ + NumberTypeEnum getNumberType(); + + /** + * The number in E.164 format. + * + * @return normalizedNumber + */ + String getNormalizedNumber(); + + /** + * Concerns whether the call is restricted or not. + * + * @return restricted + */ + Boolean getRestricted(); + + /** + * Get rate + * + * @return rate + */ + Price getRate(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new QueryNumberInformationImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param countryId see getter + * @return Current builder + * @see #getCountryId + */ + Builder setCountryId(String countryId); + + /** + * see getter + * + * @param numberType see getter + * @return Current builder + * @see #getNumberType + */ + Builder setNumberType(NumberTypeEnum numberType); + + /** + * see getter + * + * @param normalizedNumber see getter + * @return Current builder + * @see #getNormalizedNumber + */ + Builder setNormalizedNumber(String normalizedNumber); + + /** + * see getter + * + * @param restricted see getter + * @return Current builder + * @see #getRestricted + */ + Builder setRestricted(Boolean restricted); + + /** + * see getter + * + * @param rate see getter + * @return Current builder + * @see #getRate + */ + Builder setRate(Price rate); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + QueryNumberInformation build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformationImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformationImpl.java new file mode 100644 index 000000000..0a0573c99 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberInformationImpl.java @@ -0,0 +1,203 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.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.voice.models.v1.Price; +import java.util.Objects; + +@JsonPropertyOrder({ + QueryNumberInformationImpl.JSON_PROPERTY_COUNTRY_ID, + QueryNumberInformationImpl.JSON_PROPERTY_NUMBER_TYPE, + QueryNumberInformationImpl.JSON_PROPERTY_NORMALIZED_NUMBER, + QueryNumberInformationImpl.JSON_PROPERTY_RESTRICTED, + QueryNumberInformationImpl.JSON_PROPERTY_RATE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class QueryNumberInformationImpl implements QueryNumberInformation { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_COUNTRY_ID = "countryId"; + + private OptionalValue countryId; + + public static final String JSON_PROPERTY_NUMBER_TYPE = "numberType"; + + private OptionalValue numberType; + + public static final String JSON_PROPERTY_NORMALIZED_NUMBER = "normalizedNumber"; + + private OptionalValue normalizedNumber; + + public static final String JSON_PROPERTY_RESTRICTED = "restricted"; + + private OptionalValue restricted; + + public static final String JSON_PROPERTY_RATE = "rate"; + + private OptionalValue rate; + + public QueryNumberInformationImpl() {} + + protected QueryNumberInformationImpl( + OptionalValue countryId, + OptionalValue numberType, + OptionalValue normalizedNumber, + OptionalValue restricted, + OptionalValue rate) { + this.countryId = countryId; + this.numberType = numberType; + this.normalizedNumber = normalizedNumber; + this.restricted = restricted; + this.rate = rate; + } + + @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 NumberTypeEnum getNumberType() { + return numberType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue numberType() { + return numberType; + } + + @JsonIgnore + public String getNormalizedNumber() { + return normalizedNumber.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NORMALIZED_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue normalizedNumber() { + return normalizedNumber; + } + + @JsonIgnore + public Boolean getRestricted() { + return restricted.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RESTRICTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue restricted() { + return restricted; + } + + @JsonIgnore + public Price getRate() { + return rate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue rate() { + return rate; + } + + /** Return true if this getQueryNumber_number object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryNumberInformationImpl getQueryNumberNumber = (QueryNumberInformationImpl) o; + return Objects.equals(this.countryId, getQueryNumberNumber.countryId) + && Objects.equals(this.numberType, getQueryNumberNumber.numberType) + && Objects.equals(this.normalizedNumber, getQueryNumberNumber.normalizedNumber) + && Objects.equals(this.restricted, getQueryNumberNumber.restricted) + && Objects.equals(this.rate, getQueryNumberNumber.rate); + } + + @Override + public int hashCode() { + return Objects.hash(countryId, numberType, normalizedNumber, restricted, rate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryNumberInformationImpl {\n"); + sb.append(" countryId: ").append(toIndentedString(countryId)).append("\n"); + sb.append(" numberType: ").append(toIndentedString(numberType)).append("\n"); + sb.append(" normalizedNumber: ").append(toIndentedString(normalizedNumber)).append("\n"); + sb.append(" restricted: ").append(toIndentedString(restricted)).append("\n"); + sb.append(" rate: ").append(toIndentedString(rate)).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 QueryNumberInformation.Builder { + OptionalValue countryId = OptionalValue.empty(); + OptionalValue numberType = OptionalValue.empty(); + OptionalValue normalizedNumber = OptionalValue.empty(); + OptionalValue restricted = OptionalValue.empty(); + OptionalValue rate = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_COUNTRY_ID) + public Builder setCountryId(String countryId) { + this.countryId = OptionalValue.of(countryId); + return this; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_TYPE) + public Builder setNumberType(NumberTypeEnum numberType) { + this.numberType = OptionalValue.of(numberType); + return this; + } + + @JsonProperty(JSON_PROPERTY_NORMALIZED_NUMBER) + public Builder setNormalizedNumber(String normalizedNumber) { + this.normalizedNumber = OptionalValue.of(normalizedNumber); + return this; + } + + @JsonProperty(JSON_PROPERTY_RESTRICTED) + public Builder setRestricted(Boolean restricted) { + this.restricted = OptionalValue.of(restricted); + return this; + } + + @JsonProperty(JSON_PROPERTY_RATE) + public Builder setRate(Price rate) { + this.rate = OptionalValue.of(rate); + return this; + } + + public QueryNumberInformation build() { + return new QueryNumberInformationImpl( + countryId, numberType, normalizedNumber, restricted, rate); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponse.java new file mode 100644 index 000000000..5827b0688 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponse.java @@ -0,0 +1,54 @@ +/* + * 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.applications.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** QueryNumberResponse */ +@JsonDeserialize(builder = QueryNumberResponseImpl.Builder.class) +public interface QueryNumberResponse { + + /** + * Get number + * + * @return number + */ + QueryNumberInformation getNumber(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new QueryNumberResponseImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param number see getter + * @return Current builder + * @see #getNumber + */ + Builder setNumber(QueryNumberInformation number); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + QueryNumberResponse build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetQueryNumberDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseImpl.java similarity index 54% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetQueryNumberDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseImpl.java index 148a7a8ff..9760055cf 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetQueryNumberDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseImpl.java @@ -1,63 +1,39 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.applications.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 java.util.Objects; -/** GetQueryNumberDto */ -@JsonPropertyOrder({GetQueryNumberDto.JSON_PROPERTY_NUMBER}) +@JsonPropertyOrder({QueryNumberResponseImpl.JSON_PROPERTY_NUMBER}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetQueryNumberDto { +public class QueryNumberResponseImpl implements QueryNumberResponse { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_NUMBER = "number"; - private GetQueryNumberNumberDto number; - private boolean numberDefined = false; - public GetQueryNumberDto() {} + private OptionalValue number; - public GetQueryNumberDto number(GetQueryNumberNumberDto number) { - this.number = number; - this.numberDefined = true; - return this; - } + public QueryNumberResponseImpl() {} - /** - * Get number - * - * @return number - */ - @JsonProperty(JSON_PROPERTY_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public GetQueryNumberNumberDto getNumber() { - return number; + protected QueryNumberResponseImpl(OptionalValue number) { + this.number = number; } @JsonIgnore - public boolean getNumberDefined() { - return numberDefined; + public QueryNumberInformation getNumber() { + return number.orElse(null); } @JsonProperty(JSON_PROPERTY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setNumber(GetQueryNumberNumberDto number) { - this.number = number; - this.numberDefined = true; + public OptionalValue number() { + return number; } /** Return true if this getQueryNumber object is equal to o. */ @@ -69,7 +45,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - GetQueryNumberDto getQueryNumber = (GetQueryNumberDto) o; + QueryNumberResponseImpl getQueryNumber = (QueryNumberResponseImpl) o; return Objects.equals(this.number, getQueryNumber.number); } @@ -81,7 +57,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class GetQueryNumberDto {\n"); + sb.append("class QueryNumberResponseImpl {\n"); sb.append(" number: ").append(toIndentedString(number)).append("\n"); sb.append("}"); return sb.toString(); @@ -96,4 +72,19 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements QueryNumberResponse.Builder { + OptionalValue number = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBER) + public Builder setNumber(QueryNumberInformation number) { + this.number = OptionalValue.of(number); + return this; + } + + public QueryNumberResponse build() { + return new QueryNumberResponseImpl(number); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConference.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConference.java new file mode 100644 index 000000000..a736d6fdb --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConference.java @@ -0,0 +1,334 @@ +/* + * 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.callouts.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.voice.models.v1.Domain; +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.DestinationConference; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Arrays; +import java.util.stream.Stream; + +/** CalloutRequestConference */ +@JsonDeserialize(builder = CalloutRequestConferenceImpl.Builder.class) +public interface CalloutRequestConference + extends com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + + /** Gets or Sets method */ + public class MethodEnum extends EnumDynamic { + public static final MethodEnum CONFERENCE_CALLOUT = new MethodEnum("conferenceCallout"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + MethodEnum.class, MethodEnum::new, Arrays.asList(CONFERENCE_CALLOUT)); + + 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 number that will be displayed as the incoming caller. To set your own CLI, you may use your + * verified number or your Dashboard number. The number must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#" and "w". A "w" + * will render a 500 ms pause. Example: "ww1234#w#" will render a 1s pause, the DTMF + * tones "1", "2", "3", "4" and "#" followed by + * a 0.5s pause and finally the DTMF tone for "#". This can be used if the callout + * destination for instance require a conference PIN code or an extension to be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * Get destination + * + * @return destination + */ + DestinationConference getDestination(); + + /** + * 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. + * + * @return conferenceId + */ + String getConferenceId(); + + /** + * Get conferenceDtmfOptions + * + * @return conferenceDtmfOptions + */ + ConferenceDtmfOptions getConferenceDtmfOptions(); + + /** + * Get maxDuration + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * 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. + * + * @return enableAce + */ + Boolean getEnableAce(); + + /** + * 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. + * + * @return enableDice + */ + Boolean getEnableDice(); + + /** + * 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. + * + * @return enablePie + */ + Boolean getEnablePie(); + + /** + * 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. Supported languages and + * voices are detailed here + * + * @return locale + */ + String getLocale(); + + /** + * The text that will be spoken as a greeting. + * + * @return greeting + */ + String getGreeting(); + + /** + * 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. It can take one of these pre-defined values: + * + *

    + *
  • ring (progress tone) + *
  • music1 (music file) + *
  • music2 (music file) + *
  • music3 (music file) + *
+ * + *
+ * If no “music-on-hold” is specified, the user will only hear silence. + * + * @return MusicOnHold + */ + MusicOnHold getMusicOnHold(); + + /** + * can be either “pstn” for PSTN endpoint or “mxp” for data (app or web) clients. + * + * @return domain + */ + Domain getDomain(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CalloutRequestConferenceImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationConference destination); + + /** + * see getter + * + * @param conferenceId see getter + * @return Current builder + * @see #getConferenceId + */ + Builder setConferenceId(String conferenceId); + + /** + * see getter + * + * @param conferenceDtmfOptions see getter + * @return Current builder + * @see #getConferenceDtmfOptions + */ + Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param enableAce see getter + * @return Current builder + * @see #getEnableAce + */ + Builder setEnableAce(Boolean enableAce); + + /** + * see getter + * + * @param enableDice see getter + * @return Current builder + * @see #getEnableDice + */ + Builder setEnableDice(Boolean enableDice); + + /** + * see getter + * + * @param enablePie see getter + * @return Current builder + * @see #getEnablePie + */ + Builder setEnablePie(Boolean enablePie); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param greeting see getter + * @return Current builder + * @see #getGreeting + */ + Builder setGreeting(String greeting); + + /** + * see getter + * + * @param MusicOnHold see getter + * @return Current builder + * @see #getMusicOnHold + */ + Builder setMusicOnHold(MusicOnHold MusicOnHold); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(Domain domain); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CalloutRequestConference build(); + } +} 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 new file mode 100644 index 000000000..002796fa0 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestConferenceImpl.java @@ -0,0 +1,519 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.ConferenceCalloutInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.ConferenceCalloutInternalImpl; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationConference; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + CalloutRequestConferenceImpl.JSON_PROPERTY_METHOD, + CalloutRequestConferenceImpl.JSON_PROPERTY_CONFERENCE_CALLOUT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class CalloutRequestConferenceImpl + implements CalloutRequestConference, + com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_CONFERENCE_CALLOUT = "conferenceCallout"; + + private OptionalValue conferenceCallout; + + public CalloutRequestConferenceImpl() {} + + protected CalloutRequestConferenceImpl( + OptionalValue method, + OptionalValue conferenceCallout) { + this.method = method; + this.conferenceCallout = conferenceCallout; + } + + @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 ConferenceCalloutInternal getConferenceCallout() { + return conferenceCallout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_CALLOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue conferenceCallout() { + return conferenceCallout; + } + + @JsonIgnore + public String getCli() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getCli()) { + return null; + } + return conferenceCallout.get().getCli(); + } + + public OptionalValue cli() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).cli()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getDtmf()) { + return null; + } + return conferenceCallout.get().getDtmf(); + } + + public OptionalValue dtmf() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).dtmf()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getCustom() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getCustom()) { + return null; + } + return conferenceCallout.get().getCustom(); + } + + public OptionalValue custom() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).custom()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DestinationConference getDestination() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getDestination()) { + return null; + } + return conferenceCallout.get().getDestination(); + } + + public OptionalValue destination() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).destination()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getConferenceId() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getConferenceId()) { + return null; + } + return conferenceCallout.get().getConferenceId(); + } + + public OptionalValue conferenceId() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).conferenceId()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public ConferenceDtmfOptions getConferenceDtmfOptions() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getConferenceDtmfOptions()) { + return null; + } + return conferenceCallout.get().getConferenceDtmfOptions(); + } + + public OptionalValue conferenceDtmfOptions() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).conferenceDtmfOptions()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Integer getMaxDuration() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getMaxDuration()) { + return null; + } + return conferenceCallout.get().getMaxDuration(); + } + + public OptionalValue maxDuration() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).maxDuration()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnableAce() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getEnableAce()) { + return null; + } + return conferenceCallout.get().getEnableAce(); + } + + public OptionalValue enableAce() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).enableAce()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnableDice() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getEnableDice()) { + return null; + } + return conferenceCallout.get().getEnableDice(); + } + + public OptionalValue enableDice() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).enableDice()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnablePie() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getEnablePie()) { + return null; + } + return conferenceCallout.get().getEnablePie(); + } + + public OptionalValue enablePie() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).enablePie()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getLocale() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getLocale()) { + return null; + } + return conferenceCallout.get().getLocale(); + } + + public OptionalValue locale() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).locale()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getGreeting() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getGreeting()) { + return null; + } + return conferenceCallout.get().getGreeting(); + } + + public OptionalValue greeting() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).greeting()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public MusicOnHold getMusicOnHold() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getMusicOnHold()) { + return null; + } + return conferenceCallout.get().getMusicOnHold(); + } + + public OptionalValue musicOnHold() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).musicOnHold()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Domain getDomain() { + if (null == conferenceCallout + || !conferenceCallout.isPresent() + || null == conferenceCallout.get().getDomain()) { + return null; + } + return conferenceCallout.get().getDomain(); + } + + public OptionalValue domain() { + return null != conferenceCallout && conferenceCallout.isPresent() + ? conferenceCallout + .map(f -> ((ConferenceCalloutInternalImpl) f).domain()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + /** Return true if this conferenceCalloutRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalloutRequestConferenceImpl conferenceCalloutRequest = (CalloutRequestConferenceImpl) o; + return Objects.equals(this.method, conferenceCalloutRequest.method) + && Objects.equals(this.conferenceCallout, conferenceCalloutRequest.conferenceCallout); + } + + @Override + public int hashCode() { + return Objects.hash(method, conferenceCallout); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalloutRequestConferenceImpl {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" conferenceCallout: ").append(toIndentedString(conferenceCallout)).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 CalloutRequestConference.Builder { + OptionalValue method = + OptionalValue.of(CalloutRequestConference.MethodEnum.CONFERENCE_CALLOUT); + OptionalValue conferenceCallout = OptionalValue.empty(); + + ConferenceCalloutInternal.Builder _delegatedBuilder = null; + + @JsonProperty(JSON_PROPERTY_CONFERENCE_CALLOUT) + public Builder setConferenceCallout(ConferenceCalloutInternal conferenceCallout) { + this.conferenceCallout = OptionalValue.of(conferenceCallout); + return this; + } + + @JsonIgnore + public Builder setCli(String cli) { + getDelegatedBuilder().setCli(cli); + return this; + } + + @JsonIgnore + public Builder setDtmf(DualToneMultiFrequency dtmf) { + getDelegatedBuilder().setDtmf(dtmf); + return this; + } + + @JsonIgnore + public Builder setCustom(String custom) { + getDelegatedBuilder().setCustom(custom); + return this; + } + + @JsonIgnore + public Builder setDestination(DestinationConference destination) { + getDelegatedBuilder().setDestination(destination); + return this; + } + + @JsonIgnore + public Builder setConferenceId(String conferenceId) { + getDelegatedBuilder().setConferenceId(conferenceId); + return this; + } + + @JsonIgnore + public Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions) { + getDelegatedBuilder().setConferenceDtmfOptions(conferenceDtmfOptions); + return this; + } + + @JsonIgnore + public Builder setMaxDuration(Integer maxDuration) { + getDelegatedBuilder().setMaxDuration(maxDuration); + return this; + } + + @JsonIgnore + public Builder setEnableAce(Boolean enableAce) { + getDelegatedBuilder().setEnableAce(enableAce); + return this; + } + + @JsonIgnore + public Builder setEnableDice(Boolean enableDice) { + getDelegatedBuilder().setEnableDice(enableDice); + return this; + } + + @JsonIgnore + public Builder setEnablePie(Boolean enablePie) { + getDelegatedBuilder().setEnablePie(enablePie); + return this; + } + + @JsonIgnore + public Builder setLocale(String locale) { + getDelegatedBuilder().setLocale(locale); + return this; + } + + @JsonIgnore + public Builder setGreeting(String greeting) { + getDelegatedBuilder().setGreeting(greeting); + return this; + } + + @JsonIgnore + public Builder setMusicOnHold(MusicOnHold MusicOnHold) { + getDelegatedBuilder().setMusicOnHold(MusicOnHold); + return this; + } + + @JsonIgnore + public Builder setDomain(Domain domain) { + getDelegatedBuilder().setDomain(domain); + return this; + } + + private ConferenceCalloutInternal.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = ConferenceCalloutInternal.builder(); + } + return this._delegatedBuilder; + } + + public CalloutRequestConference build() { + // delegated builder was used: filling the related source of delegation field + if (null != this._delegatedBuilder) { + this.conferenceCallout = OptionalValue.of(this._delegatedBuilder.build()); + } + return new CalloutRequestConferenceImpl(method, conferenceCallout); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + CalloutRequestConferenceImpl impl = (CalloutRequestConferenceImpl) value.get(); + jgen.writeObject(null != impl ? impl.getConferenceCallout() : null); + } + } + + public static class DelegatedDeSerializer extends JsonDeserializer { + @Override + public CalloutRequestConference deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + CalloutRequestConferenceImpl.Builder builder = new CalloutRequestConferenceImpl.Builder(); + ConferenceCalloutInternalImpl deserialized = + jp.readValueAs(ConferenceCalloutInternalImpl.class); + builder.setConferenceCallout(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter( + ConferenceCalloutInternal internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setConferenceCallout(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustom.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustom.java new file mode 100644 index 000000000..708c3de9c --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustom.java @@ -0,0 +1,221 @@ +/* + * 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.callouts.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.voice.models.v1.destination.DestinationCustom; +import com.sinch.sdk.domains.voice.models.v1.svaml.Control; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Arrays; +import java.util.stream.Stream; + +/** CalloutRequestCustom */ +@JsonDeserialize(builder = CalloutRequestCustomImpl.Builder.class) +public interface CalloutRequestCustom + extends com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + + /** Gets or Sets method */ + public class MethodEnum extends EnumDynamic { + public static final MethodEnum CUSTOM_CALLOUT = new MethodEnum("customCallout"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(MethodEnum.class, MethodEnum::new, Arrays.asList(CUSTOM_CALLOUT)); + + 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 number that will be displayed as the incoming caller, to set your own CLI, you may use your + * verified number or your Dashboard virtual number, it must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * Get destination + * + * @return destination + */ + DestinationCustom getDestination(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#", and "w". A + * "w" will render a 500 ms pause. For example, "ww1234#w#" will render a 1s + * pause, the DTMF tones "1", "2", "3", "4" and + * "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be + * used if the callout destination for instance require a conference PIN code or an extension to + * be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Can be used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * The maximum amount of time in seconds that the call will last. + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * 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\\\":\\\"connectPstn\\\",\\\"number\\\":\\\"46000000001\\\",\\\"maxDuration\\\":90}}\" + * + * + * @return ice + */ + Control getIce(); + + /** + * 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\\\": \\\"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)\\\"}]}]}}\" + * + * + * @return ace + */ + Control getAce(); + + /** + * 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. Example: + * \"https://your-application-server-host/application\" + * + * @return pie + */ + Control getPie(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CalloutRequestCustomImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationCustom destination); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param ice see getter + * @return Current builder + * @see #getIce + */ + Builder setIce(Control ice); + + /** + * see getter + * + * @param ace see getter + * @return Current builder + * @see #getAce + */ + Builder setAce(Control ace); + + /** + * see getter + * + * @param pie see getter + * @return Current builder + * @see #getPie + */ + Builder setPie(Control pie); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CalloutRequestCustom build(); + } +} 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 new file mode 100644 index 000000000..24ed08504 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestCustomImpl.java @@ -0,0 +1,367 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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.voice.models.v1.callouts.request.internal.CustomCalloutInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.CustomCalloutInternalImpl; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationCustom; +import com.sinch.sdk.domains.voice.models.v1.svaml.Control; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + CalloutRequestCustomImpl.JSON_PROPERTY_METHOD, + CalloutRequestCustomImpl.JSON_PROPERTY_CUSTOM_CALLOUT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class CalloutRequestCustomImpl + implements CalloutRequestCustom, + com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_CUSTOM_CALLOUT = "customCallout"; + + private OptionalValue customCallout; + + public CalloutRequestCustomImpl() {} + + protected CalloutRequestCustomImpl( + OptionalValue method, OptionalValue customCallout) { + this.method = method; + this.customCallout = customCallout; + } + + @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 CustomCalloutInternal getCustomCallout() { + return customCallout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CUSTOM_CALLOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue customCallout() { + return customCallout; + } + + @JsonIgnore + public String getCli() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getCli()) { + return null; + } + return customCallout.get().getCli(); + } + + public OptionalValue cli() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).cli()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DestinationCustom getDestination() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getDestination()) { + return null; + } + return customCallout.get().getDestination(); + } + + public OptionalValue destination() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).destination()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getDtmf()) { + return null; + } + return customCallout.get().getDtmf(); + } + + public OptionalValue dtmf() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).dtmf()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getCustom() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getCustom()) { + return null; + } + return customCallout.get().getCustom(); + } + + public OptionalValue custom() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).custom()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Integer getMaxDuration() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getMaxDuration()) { + return null; + } + return customCallout.get().getMaxDuration(); + } + + public OptionalValue maxDuration() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).maxDuration()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Control getIce() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getIce()) { + return null; + } + return customCallout.get().getIce(); + } + + public OptionalValue ice() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).ice()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Control getAce() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getAce()) { + return null; + } + return customCallout.get().getAce(); + } + + public OptionalValue ace() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).ace()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Control getPie() { + if (null == customCallout + || !customCallout.isPresent() + || null == customCallout.get().getPie()) { + return null; + } + return customCallout.get().getPie(); + } + + public OptionalValue pie() { + return null != customCallout && customCallout.isPresent() + ? customCallout + .map(f -> ((CustomCalloutInternalImpl) f).pie()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + /** Return true if this customCalloutRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalloutRequestCustomImpl customCalloutRequest = (CalloutRequestCustomImpl) o; + return Objects.equals(this.method, customCalloutRequest.method) + && Objects.equals(this.customCallout, customCalloutRequest.customCallout); + } + + @Override + public int hashCode() { + return Objects.hash(method, customCallout); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalloutRequestCustomImpl {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" customCallout: ").append(toIndentedString(customCallout)).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 CalloutRequestCustom.Builder { + OptionalValue method = OptionalValue.of(MethodEnum.CUSTOM_CALLOUT); + OptionalValue customCallout = OptionalValue.empty(); + + CustomCalloutInternal.Builder _delegatedBuilder = null; + + @JsonProperty(JSON_PROPERTY_CUSTOM_CALLOUT) + public Builder setCustomCallout(CustomCalloutInternal customCallout) { + this.customCallout = OptionalValue.of(customCallout); + return this; + } + + @JsonIgnore + public Builder setCli(String cli) { + getDelegatedBuilder().setCli(cli); + return this; + } + + @JsonIgnore + public Builder setDestination(DestinationCustom destination) { + getDelegatedBuilder().setDestination(destination); + return this; + } + + @JsonIgnore + public Builder setDtmf(DualToneMultiFrequency dtmf) { + getDelegatedBuilder().setDtmf(dtmf); + return this; + } + + @JsonIgnore + public Builder setCustom(String custom) { + getDelegatedBuilder().setCustom(custom); + return this; + } + + @JsonIgnore + public Builder setMaxDuration(Integer maxDuration) { + getDelegatedBuilder().setMaxDuration(maxDuration); + return this; + } + + @JsonIgnore + public Builder setIce(Control ice) { + getDelegatedBuilder().setIce(ice); + return this; + } + + @JsonIgnore + public Builder setAce(Control ace) { + getDelegatedBuilder().setAce(ace); + return this; + } + + @JsonIgnore + public Builder setPie(Control pie) { + getDelegatedBuilder().setPie(pie); + return this; + } + + private CustomCalloutInternal.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = CustomCalloutInternal.builder(); + } + return this._delegatedBuilder; + } + + public CalloutRequestCustom build() { + // delegated builder was used: filling the related source of delegation field + if (null != this._delegatedBuilder) { + this.customCallout = OptionalValue.of(this._delegatedBuilder.build()); + } + return new CalloutRequestCustomImpl(method, customCallout); + } + } + + public static class DelegatedSerializer + extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + CalloutRequestCustomImpl impl = (CalloutRequestCustomImpl) value.get(); + jgen.writeObject(null != impl ? impl.getCustomCallout() : null); + } + } + + public static class DelegatedDeSerializer extends JsonDeserializer { + @Override + public CalloutRequestCustom deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + CalloutRequestCustomImpl.Builder builder = new CalloutRequestCustomImpl.Builder(); + CustomCalloutInternalImpl deserialized = jp.readValueAs(CustomCalloutInternalImpl.class); + builder.setCustomCallout(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter(CustomCalloutInternal internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setCustomCallout(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTS.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTS.java new file mode 100644 index 000000000..214034084 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTS.java @@ -0,0 +1,285 @@ +/* + * 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.callouts.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.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationTextToSpeech; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Arrays; +import java.util.stream.Stream; + +/** CalloutRequestTTS */ +@JsonDeserialize(builder = CalloutRequestTTSImpl.Builder.class) +public interface CalloutRequestTTS + extends com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + + /** Gets or Sets method */ + public class MethodEnum extends EnumDynamic { + public static final MethodEnum TTS_CALLOUT = new MethodEnum("ttsCallout"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(MethodEnum.class, MethodEnum::new, Arrays.asList(TTS_CALLOUT)); + + 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 number that will be displayed as the incoming caller. To set your own CLI, you may use your + * verified number or your Dashboard number. The number must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * Get destination + * + * @return destination + */ + DestinationTextToSpeech getDestination(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#", and "w". A + * "w" will render a 500 ms pause. For example, "ww1234#w#" will render a 1s + * pause, the DTMF tones "1", "2", "3", "4" and + * "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be + * used if the callout destination for instance require a conference PIN code or an extension to + * be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Get domain + * + * @return domain + */ + Domain getDomain(); + + /** + * Can be used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * The voice and language you want to use for the text-to-speech message. This can either be + * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported + * languages and voices are detailed here. + * + * @return locale + */ + String getLocale(); + + /** + * The text that will be spoken in the text-to-speech message. Every application's default + * maximum characters allowed in text-to-speech is 600 characters. Contact support if you wish + * this limit to be changed. + * + * @return text + */ + String getText(); + + /** + * 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 are here + * Externally hosted media: Provide a URL to your own hosted media. Please check + * 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>] + * + * + * @return prompts + */ + String getPrompts(); + + /** + * 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. + * + * @return enableAce + */ + Boolean getEnableAce(); + + /** + * 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. + * + * @return enableDice + */ + Boolean getEnableDice(); + + /** + * Note: PIE callbacks are not available for DATA Calls; only PSTN and SIP calls. If + * enablePie is set to true and the application has a callback URL specified, + * you will receive a PIE callback after the runMenu action executes and after the + * configured menu timeout has elapsed with no input. If it's set to false, no PIE + * events will be sent to your backend. + * + * @return enablePie + */ + Boolean getEnablePie(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CalloutRequestTTSImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationTextToSpeech destination); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(Domain domain); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param text see getter + * @return Current builder + * @see #getText + */ + Builder setText(String text); + + /** + * see getter + * + * @param prompts see getter + * @return Current builder + * @see #getPrompts + */ + Builder setPrompts(String prompts); + + /** + * see getter + * + * @param enableAce see getter + * @return Current builder + * @see #getEnableAce + */ + Builder setEnableAce(Boolean enableAce); + + /** + * see getter + * + * @param enableDice see getter + * @return Current builder + * @see #getEnableDice + */ + Builder setEnableDice(Boolean enableDice); + + /** + * see getter + * + * @param enablePie see getter + * @return Current builder + * @see #getEnablePie + */ + Builder setEnablePie(Boolean enablePie); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CalloutRequestTTS build(); + } +} 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 new file mode 100644 index 000000000..c2a9ce1ec --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/CalloutRequestTTSImpl.java @@ -0,0 +1,404 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.TtsCalloutInternal; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.internal.TtsCalloutInternalImpl; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationTextToSpeech; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.io.IOException; +import java.util.Objects; +import java.util.Optional; + +@JsonPropertyOrder({ + CalloutRequestTTSImpl.JSON_PROPERTY_METHOD, + CalloutRequestTTSImpl.JSON_PROPERTY_TTS_CALLOUT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class CalloutRequestTTSImpl + implements CalloutRequestTTS, + com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_METHOD = "method"; + + private OptionalValue method; + + public static final String JSON_PROPERTY_TTS_CALLOUT = "ttsCallout"; + + private OptionalValue ttsCallout; + + public CalloutRequestTTSImpl() {} + + protected CalloutRequestTTSImpl( + OptionalValue method, OptionalValue ttsCallout) { + this.method = method; + this.ttsCallout = ttsCallout; + } + + @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 TtsCalloutInternal getTtsCallout() { + return ttsCallout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TTS_CALLOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue ttsCallout() { + return ttsCallout; + } + + @JsonIgnore + public String getCli() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getCli()) { + return null; + } + return ttsCallout.get().getCli(); + } + + public OptionalValue cli() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).cli()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DestinationTextToSpeech getDestination() { + if (null == ttsCallout + || !ttsCallout.isPresent() + || null == ttsCallout.get().getDestination()) { + return null; + } + return ttsCallout.get().getDestination(); + } + + public OptionalValue destination() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout + .map(f -> ((TtsCalloutInternalImpl) f).destination()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getDtmf()) { + return null; + } + return ttsCallout.get().getDtmf(); + } + + public OptionalValue dtmf() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).dtmf()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Domain getDomain() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getDomain()) { + return null; + } + return ttsCallout.get().getDomain(); + } + + public OptionalValue domain() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).domain()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getCustom() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getCustom()) { + return null; + } + return ttsCallout.get().getCustom(); + } + + public OptionalValue custom() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).custom()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getLocale() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getLocale()) { + return null; + } + return ttsCallout.get().getLocale(); + } + + public OptionalValue locale() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).locale()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getText() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getText()) { + return null; + } + return ttsCallout.get().getText(); + } + + public OptionalValue text() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).text()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public String getPrompts() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getPrompts()) { + return null; + } + return ttsCallout.get().getPrompts(); + } + + public OptionalValue prompts() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout.map(f -> ((TtsCalloutInternalImpl) f).prompts()).orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnableAce() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getEnableAce()) { + return null; + } + return ttsCallout.get().getEnableAce(); + } + + public OptionalValue enableAce() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout + .map(f -> ((TtsCalloutInternalImpl) f).enableAce()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnableDice() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getEnableDice()) { + return null; + } + return ttsCallout.get().getEnableDice(); + } + + public OptionalValue enableDice() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout + .map(f -> ((TtsCalloutInternalImpl) f).enableDice()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + @JsonIgnore + public Boolean getEnablePie() { + if (null == ttsCallout || !ttsCallout.isPresent() || null == ttsCallout.get().getEnablePie()) { + return null; + } + return ttsCallout.get().getEnablePie(); + } + + public OptionalValue enablePie() { + return null != ttsCallout && ttsCallout.isPresent() + ? ttsCallout + .map(f -> ((TtsCalloutInternalImpl) f).enablePie()) + .orElse(OptionalValue.empty()) + : OptionalValue.empty(); + } + + /** Return true if this ttsCalloutRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CalloutRequestTTSImpl ttsCalloutRequest = (CalloutRequestTTSImpl) o; + return Objects.equals(this.method, ttsCalloutRequest.method) + && Objects.equals(this.ttsCallout, ttsCalloutRequest.ttsCallout); + } + + @Override + public int hashCode() { + return Objects.hash(method, ttsCallout); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CalloutRequestTTSImpl {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" ttsCallout: ").append(toIndentedString(ttsCallout)).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 CalloutRequestTTS.Builder { + OptionalValue method = OptionalValue.of(MethodEnum.TTS_CALLOUT); + OptionalValue ttsCallout = OptionalValue.empty(); + + TtsCalloutInternal.Builder _delegatedBuilder = null; + + @JsonProperty(JSON_PROPERTY_TTS_CALLOUT) + public Builder setTtsCallout(TtsCalloutInternal ttsCallout) { + this.ttsCallout = OptionalValue.of(ttsCallout); + return this; + } + + @JsonIgnore + public Builder setCli(String cli) { + getDelegatedBuilder().setCli(cli); + return this; + } + + @JsonIgnore + public Builder setDestination(DestinationTextToSpeech destination) { + getDelegatedBuilder().setDestination(destination); + return this; + } + + @JsonIgnore + public Builder setDtmf(DualToneMultiFrequency dtmf) { + getDelegatedBuilder().setDtmf(dtmf); + return this; + } + + @JsonIgnore + public Builder setDomain(Domain domain) { + getDelegatedBuilder().setDomain(domain); + return this; + } + + @JsonIgnore + public Builder setCustom(String custom) { + getDelegatedBuilder().setCustom(custom); + return this; + } + + @JsonIgnore + public Builder setLocale(String locale) { + getDelegatedBuilder().setLocale(locale); + return this; + } + + @JsonIgnore + public Builder setText(String text) { + getDelegatedBuilder().setText(text); + return this; + } + + @JsonIgnore + public Builder setPrompts(String prompts) { + getDelegatedBuilder().setPrompts(prompts); + return this; + } + + @JsonIgnore + public Builder setEnableAce(Boolean enableAce) { + getDelegatedBuilder().setEnableAce(enableAce); + return this; + } + + @JsonIgnore + public Builder setEnableDice(Boolean enableDice) { + getDelegatedBuilder().setEnableDice(enableDice); + return this; + } + + @JsonIgnore + public Builder setEnablePie(Boolean enablePie) { + getDelegatedBuilder().setEnablePie(enablePie); + return this; + } + + private TtsCalloutInternal.Builder getDelegatedBuilder() { + if (null == _delegatedBuilder) { + this._delegatedBuilder = TtsCalloutInternal.builder(); + } + return this._delegatedBuilder; + } + + public CalloutRequestTTS build() { + // delegated builder was used: filling the related source of delegation field + if (null != this._delegatedBuilder) { + this.ttsCallout = OptionalValue.of(this._delegatedBuilder.build()); + } + return new CalloutRequestTTSImpl(method, ttsCallout); + } + } + + public static class DelegatedSerializer extends JsonSerializer> { + @Override + public void serialize( + OptionalValue value, JsonGenerator jgen, SerializerProvider provider) + throws IOException { + + if (!value.isPresent()) { + return; + } + CalloutRequestTTSImpl impl = (CalloutRequestTTSImpl) value.get(); + jgen.writeObject(null != impl ? impl.getTtsCallout() : null); + } + } + + public static class DelegatedDeSerializer extends JsonDeserializer { + @Override + public CalloutRequestTTS deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + + CalloutRequestTTSImpl.Builder builder = new CalloutRequestTTSImpl.Builder(); + TtsCalloutInternalImpl deserialized = jp.readValueAs(TtsCalloutInternalImpl.class); + builder.setTtsCallout(deserialized); + return builder.build(); + } + } + + public static Optional delegatedConverter(TtsCalloutInternal internal) { + if (null == internal) { + return Optional.empty(); + } + return Optional.of(new Builder().setTtsCallout(internal).build()); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternal.java new file mode 100644 index 000000000..f2f82ea79 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternal.java @@ -0,0 +1,16 @@ +/* + * 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.callouts.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = CalloutRequestInternalImpl.CalloutRequestInternalImplDeserializer.class) +public interface CalloutRequestInternal {} 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 new file mode 100644 index 000000000..71cbd0abe --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CalloutRequestInternalImpl.java @@ -0,0 +1,384 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.request.internal; + +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 com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConferenceImpl; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestCustomImpl; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestTTSImpl; +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 = CalloutRequestInternalImpl.CalloutRequestInternalImplDeserializer.class) +@JsonSerialize(using = CalloutRequestInternalImpl.CalloutRequestInternalImplSerializer.class) +public class CalloutRequestInternalImpl extends AbstractOpenApiSchema + implements CalloutRequestInternal { + private static final Logger log = Logger.getLogger(CalloutRequestInternalImpl.class.getName()); + + public static final class CalloutRequestInternalImplSerializer + extends StdSerializer { + private static final long serialVersionUID = 1L; + + public CalloutRequestInternalImplSerializer(Class t) { + super(t); + } + + public CalloutRequestInternalImplSerializer() { + this(null); + } + + @Override + public void serialize( + CalloutRequestInternalImpl value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static final class CalloutRequestInternalImplDeserializer + extends StdDeserializer { + + private static final long serialVersionUID = 1L; + + public CalloutRequestInternalImplDeserializer() { + this(CalloutRequestInternalImpl.class); + } + + public CalloutRequestInternalImplDeserializer(Class vc) { + super(vc); + } + + @Override + public CalloutRequestInternalImpl deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + CalloutRequestInternalImpl newCalloutRequestInternalImpl = new CalloutRequestInternalImpl(); + Map result2 = + tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String) result2.get("method"); + switch (discriminatorValue) { + case "conferenceCallout": + deserialized = + tree.traverse(jp.getCodec()).readValueAs(CalloutRequestConferenceImpl.class); + newCalloutRequestInternalImpl.setActualInstance(deserialized); + return newCalloutRequestInternalImpl; + case "customCallout": + deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestCustomImpl.class); + newCalloutRequestInternalImpl.setActualInstance(deserialized); + return newCalloutRequestInternalImpl; + case "ttsCallout": + 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", + discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize CalloutRequestConferenceImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CalloutRequestConferenceImpl.class.equals(Integer.class) + || CalloutRequestConferenceImpl.class.equals(Long.class) + || CalloutRequestConferenceImpl.class.equals(Float.class) + || CalloutRequestConferenceImpl.class.equals(Double.class) + || CalloutRequestConferenceImpl.class.equals(Boolean.class) + || CalloutRequestConferenceImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CalloutRequestConferenceImpl.class.equals(Integer.class) + || CalloutRequestConferenceImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CalloutRequestConferenceImpl.class.equals(Float.class) + || CalloutRequestConferenceImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (CalloutRequestConferenceImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CalloutRequestConferenceImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(CalloutRequestConferenceImpl.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 'CalloutRequestConferenceImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CalloutRequestConferenceImpl'", e); + } + + // deserialize CalloutRequestCustomImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CalloutRequestCustomImpl.class.equals(Integer.class) + || CalloutRequestCustomImpl.class.equals(Long.class) + || CalloutRequestCustomImpl.class.equals(Float.class) + || CalloutRequestCustomImpl.class.equals(Double.class) + || CalloutRequestCustomImpl.class.equals(Boolean.class) + || CalloutRequestCustomImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CalloutRequestCustomImpl.class.equals(Integer.class) + || CalloutRequestCustomImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CalloutRequestCustomImpl.class.equals(Float.class) + || CalloutRequestCustomImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (CalloutRequestCustomImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CalloutRequestCustomImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestCustomImpl.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 'CalloutRequestCustomImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CalloutRequestCustomImpl'", e); + } + + // deserialize CalloutRequestTTSImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CalloutRequestTTSImpl.class.equals(Integer.class) + || CalloutRequestTTSImpl.class.equals(Long.class) + || CalloutRequestTTSImpl.class.equals(Float.class) + || CalloutRequestTTSImpl.class.equals(Double.class) + || CalloutRequestTTSImpl.class.equals(Boolean.class) + || CalloutRequestTTSImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((CalloutRequestTTSImpl.class.equals(Integer.class) + || CalloutRequestTTSImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((CalloutRequestTTSImpl.class.equals(Float.class) + || CalloutRequestTTSImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (CalloutRequestTTSImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (CalloutRequestTTSImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(CalloutRequestTTSImpl.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 'CalloutRequestTTSImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CalloutRequestTTSImpl'", e); + } + + if (match == 1) { + CalloutRequestInternalImpl ret = new CalloutRequestInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException( + String.format( + "Failed deserialization for CalloutRequestInternalImpl: %d classes match result," + + " expected 1", + match)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public CalloutRequestInternalImpl getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CalloutRequestInternalImpl cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public CalloutRequestInternalImpl() { + super("oneOf", Boolean.FALSE); + } + + public CalloutRequestInternalImpl(CalloutRequestConferenceImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CalloutRequestInternalImpl(CalloutRequestCustomImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CalloutRequestInternalImpl(CalloutRequestTTSImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CalloutRequestConferenceImpl", CalloutRequestConferenceImpl.class); + schemas.put("CalloutRequestCustomImpl", CalloutRequestCustomImpl.class); + schemas.put("CalloutRequestTTSImpl", CalloutRequestTTSImpl.class); + JSONNavigator.registerDescendants( + CalloutRequestInternalImpl.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + 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); + } + + @Override + public Map> getSchemas() { + return CalloutRequestInternalImpl.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CalloutRequestConferenceImpl, CalloutRequestCustomImpl, + * CalloutRequestTTSImpl + * + *

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( + CalloutRequestConferenceImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + CalloutRequestCustomImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + CalloutRequestTTSImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CalloutRequestConferenceImpl, CalloutRequestCustomImpl," + + " CalloutRequestTTSImpl"); + } + + /** + * Get the actual instance, which can be the following: CalloutRequestConferenceImpl, + * CalloutRequestCustomImpl, CalloutRequestTTSImpl + * + * @return The actual instance (CalloutRequestConferenceImpl, CalloutRequestCustomImpl, + * CalloutRequestTTSImpl) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CalloutRequestConferenceImpl`. If the actual instance is not + * `CalloutRequestConferenceImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `CalloutRequestConferenceImpl` + * @throws ClassCastException if the instance is not `CalloutRequestConferenceImpl` + */ + public CalloutRequestConferenceImpl getCalloutRequestConferenceImpl() throws ClassCastException { + return (CalloutRequestConferenceImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `CalloutRequestCustomImpl`. If the actual instance is not + * `CalloutRequestCustomImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `CalloutRequestCustomImpl` + * @throws ClassCastException if the instance is not `CalloutRequestCustomImpl` + */ + public CalloutRequestCustomImpl getCalloutRequestCustomImpl() throws ClassCastException { + return (CalloutRequestCustomImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `CalloutRequestTTSImpl`. If the actual instance is not + * `CalloutRequestTTSImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `CalloutRequestTTSImpl` + * @throws ClassCastException if the instance is not `CalloutRequestTTSImpl` + */ + public CalloutRequestTTSImpl getCalloutRequestTTSImpl() throws ClassCastException { + return (CalloutRequestTTSImpl) super.getActualInstance(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternal.java new file mode 100644 index 000000000..74b1417e9 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternal.java @@ -0,0 +1,307 @@ +/* + * 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.callouts.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +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.conferences.ConferenceDtmfOptions; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationConference; +import com.sinch.sdk.models.DualToneMultiFrequency; + +/** + * The conference callout calls a phone number or a user. When the call is answered, it's connected + * to a conference room. + */ +@JsonDeserialize(builder = ConferenceCalloutInternalImpl.Builder.class) +public interface ConferenceCalloutInternal { + + /** + * 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. The number must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#" and "w". A "w" + * will render a 500 ms pause. Example: "ww1234#w#" will render a 1s pause, the DTMF + * tones "1", "2", "3", "4" and "#" followed by + * a 0.5s pause and finally the DTMF tone for "#". This can be used if the callout + * destination for instance require a conference PIN code or an extension to be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * Get destination + * + * @return destination + */ + DestinationConference getDestination(); + + /** + * 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. + * + * @return conferenceId + */ + String getConferenceId(); + + /** + * Get conferenceDtmfOptions + * + * @return conferenceDtmfOptions + */ + ConferenceDtmfOptions getConferenceDtmfOptions(); + + /** + * Get maxDuration + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * 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. + * + * @return enableAce + */ + Boolean getEnableAce(); + + /** + * 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. + * + * @return enableDice + */ + Boolean getEnableDice(); + + /** + * 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. + * + * @return enablePie + */ + Boolean getEnablePie(); + + /** + * 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. Supported languages and + * voices are detailed here + * + * @return locale + */ + String getLocale(); + + /** + * The text that will be spoken as a greeting. + * + * @return greeting + */ + String getGreeting(); + + /** + * 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. It can take one of these pre-defined values: + * + *

    + *
  • ring (progress tone) + *
  • music1 (music file) + *
  • music2 (music file) + *
  • music3 (music file) + *
+ * + *
+ * If no “music-on-hold” is specified, the user will only hear silence. + * + * @return MusicOnHold + */ + MusicOnHold getMusicOnHold(); + + /** + * can be either “pstn” for PSTN endpoint or “mxp” for data (app or web) clients. + * + * @return domain + */ + Domain getDomain(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ConferenceCalloutInternalImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationConference destination); + + /** + * see getter + * + * @param conferenceId see getter + * @return Current builder + * @see #getConferenceId + */ + Builder setConferenceId(String conferenceId); + + /** + * see getter + * + * @param conferenceDtmfOptions see getter + * @return Current builder + * @see #getConferenceDtmfOptions + */ + Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param enableAce see getter + * @return Current builder + * @see #getEnableAce + */ + Builder setEnableAce(Boolean enableAce); + + /** + * see getter + * + * @param enableDice see getter + * @return Current builder + * @see #getEnableDice + */ + Builder setEnableDice(Boolean enableDice); + + /** + * see getter + * + * @param enablePie see getter + * @return Current builder + * @see #getEnablePie + */ + Builder setEnablePie(Boolean enablePie); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param greeting see getter + * @return Current builder + * @see #getGreeting + */ + Builder setGreeting(String greeting); + + /** + * see getter + * + * @param MusicOnHold see getter + * @return Current builder + * @see #getMusicOnHold + */ + Builder setMusicOnHold(MusicOnHold MusicOnHold); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(Domain domain); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ConferenceCalloutInternal build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternalImpl.java new file mode 100644 index 000000000..4f41fe3f2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/ConferenceCalloutInternalImpl.java @@ -0,0 +1,479 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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 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.conferences.ConferenceDtmfOptions; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationConference; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Objects; + +@JsonPropertyOrder({ + ConferenceCalloutInternalImpl.JSON_PROPERTY_CLI, + ConferenceCalloutInternalImpl.JSON_PROPERTY_DTMF, + ConferenceCalloutInternalImpl.JSON_PROPERTY_CUSTOM, + ConferenceCalloutInternalImpl.JSON_PROPERTY_DESTINATION, + ConferenceCalloutInternalImpl.JSON_PROPERTY_CONFERENCE_ID, + ConferenceCalloutInternalImpl.JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS, + ConferenceCalloutInternalImpl.JSON_PROPERTY_MAX_DURATION, + ConferenceCalloutInternalImpl.JSON_PROPERTY_ENABLE_ACE, + ConferenceCalloutInternalImpl.JSON_PROPERTY_ENABLE_DICE, + ConferenceCalloutInternalImpl.JSON_PROPERTY_ENABLE_PIE, + ConferenceCalloutInternalImpl.JSON_PROPERTY_LOCALE, + ConferenceCalloutInternalImpl.JSON_PROPERTY_GREETING, + ConferenceCalloutInternalImpl.JSON_PROPERTY_MOH_CLASS, + ConferenceCalloutInternalImpl.JSON_PROPERTY_DOMAIN +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class ConferenceCalloutInternalImpl implements ConferenceCalloutInternal { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_DTMF = "dtmf"; + + private OptionalValue dtmf; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + + private OptionalValue destination; + + public static final String JSON_PROPERTY_CONFERENCE_ID = "conferenceId"; + + private OptionalValue conferenceId; + + public static final String JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS = "conferenceDtmfOptions"; + + private OptionalValue conferenceDtmfOptions; + + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; + + private OptionalValue maxDuration; + + public static final String JSON_PROPERTY_ENABLE_ACE = "enableAce"; + + private OptionalValue enableAce; + + public static final String JSON_PROPERTY_ENABLE_DICE = "enableDice"; + + private OptionalValue enableDice; + + public static final String JSON_PROPERTY_ENABLE_PIE = "enablePie"; + + private OptionalValue enablePie; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public static final String JSON_PROPERTY_GREETING = "greeting"; + + private OptionalValue greeting; + + public static final String JSON_PROPERTY_MOH_CLASS = "mohClass"; + + private OptionalValue MusicOnHold; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + + private OptionalValue domain; + + public ConferenceCalloutInternalImpl() {} + + protected ConferenceCalloutInternalImpl( + OptionalValue cli, + OptionalValue dtmf, + OptionalValue custom, + OptionalValue destination, + OptionalValue conferenceId, + OptionalValue conferenceDtmfOptions, + OptionalValue maxDuration, + OptionalValue enableAce, + OptionalValue enableDice, + OptionalValue enablePie, + OptionalValue locale, + OptionalValue greeting, + OptionalValue MusicOnHold, + OptionalValue domain) { + this.cli = cli; + this.dtmf = dtmf; + this.custom = custom; + this.destination = destination; + this.conferenceId = conferenceId; + this.conferenceDtmfOptions = conferenceDtmfOptions; + this.maxDuration = maxDuration; + this.enableAce = enableAce; + this.enableDice = enableDice; + this.enablePie = enablePie; + this.locale = locale; + this.greeting = greeting; + this.MusicOnHold = MusicOnHold; + this.domain = domain; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + return dtmf.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DTMF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue dtmf() { + return dtmf; + } + + @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 DestinationConference getDestination() { + return destination.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue destination() { + return destination; + } + + @JsonIgnore + public String getConferenceId() { + return conferenceId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue conferenceId() { + return conferenceId; + } + + @JsonIgnore + public ConferenceDtmfOptions getConferenceDtmfOptions() { + return conferenceDtmfOptions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue conferenceDtmfOptions() { + return conferenceDtmfOptions; + } + + @JsonIgnore + public Integer getMaxDuration() { + return maxDuration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDuration() { + return maxDuration; + } + + @JsonIgnore + public Boolean getEnableAce() { + return enableAce.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_ACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enableAce() { + return enableAce; + } + + @JsonIgnore + public Boolean getEnableDice() { + return enableDice.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_DICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enableDice() { + return enableDice; + } + + @JsonIgnore + public Boolean getEnablePie() { + return enablePie.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_PIE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enablePie() { + return enablePie; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + @JsonIgnore + public String getGreeting() { + return greeting.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GREETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue greeting() { + return greeting; + } + + @JsonIgnore + public MusicOnHold getMusicOnHold() { + return MusicOnHold.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MOH_CLASS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue musicOnHold() { + return MusicOnHold; + } + + @JsonIgnore + public Domain getDomain() { + return domain.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue domain() { + return domain; + } + + /** Return true if this conferenceCallout object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceCalloutInternalImpl conferenceCallout = (ConferenceCalloutInternalImpl) o; + return Objects.equals(this.cli, conferenceCallout.cli) + && Objects.equals(this.dtmf, conferenceCallout.dtmf) + && Objects.equals(this.custom, conferenceCallout.custom) + && Objects.equals(this.destination, conferenceCallout.destination) + && Objects.equals(this.conferenceId, conferenceCallout.conferenceId) + && Objects.equals(this.conferenceDtmfOptions, conferenceCallout.conferenceDtmfOptions) + && Objects.equals(this.maxDuration, conferenceCallout.maxDuration) + && Objects.equals(this.enableAce, conferenceCallout.enableAce) + && Objects.equals(this.enableDice, conferenceCallout.enableDice) + && Objects.equals(this.enablePie, conferenceCallout.enablePie) + && Objects.equals(this.locale, conferenceCallout.locale) + && Objects.equals(this.greeting, conferenceCallout.greeting) + && Objects.equals(this.MusicOnHold, conferenceCallout.MusicOnHold) + && Objects.equals(this.domain, conferenceCallout.domain); + } + + @Override + public int hashCode() { + return Objects.hash( + cli, + dtmf, + custom, + destination, + conferenceId, + conferenceDtmfOptions, + maxDuration, + enableAce, + enableDice, + enablePie, + locale, + greeting, + MusicOnHold, + domain); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceCalloutInternalImpl {\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" conferenceDtmfOptions: ") + .append(toIndentedString(conferenceDtmfOptions)) + .append("\n"); + sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); + sb.append(" enableAce: ").append(toIndentedString(enableAce)).append("\n"); + sb.append(" enableDice: ").append(toIndentedString(enableDice)).append("\n"); + sb.append(" enablePie: ").append(toIndentedString(enablePie)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); + sb.append(" greeting: ").append(toIndentedString(greeting)).append("\n"); + sb.append(" MusicOnHold: ").append(toIndentedString(MusicOnHold)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).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 ConferenceCalloutInternal.Builder { + OptionalValue cli = OptionalValue.empty(); + OptionalValue dtmf = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue destination = OptionalValue.empty(); + OptionalValue conferenceId = OptionalValue.empty(); + OptionalValue conferenceDtmfOptions = 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(); + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_DTMF) + public Builder setDtmf(DualToneMultiFrequency dtmf) { + this.dtmf = OptionalValue.of(dtmf); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + public Builder setDestination(DestinationConference destination) { + this.destination = OptionalValue.of(destination); + return this; + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) + public Builder setConferenceId(String conferenceId) { + this.conferenceId = OptionalValue.of(conferenceId); + return this; + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) + public Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions) { + this.conferenceDtmfOptions = OptionalValue.of(conferenceDtmfOptions); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + public Builder setMaxDuration(Integer maxDuration) { + this.maxDuration = OptionalValue.of(maxDuration); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_ACE) + public Builder setEnableAce(Boolean enableAce) { + this.enableAce = OptionalValue.of(enableAce); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_DICE) + public Builder setEnableDice(Boolean enableDice) { + this.enableDice = OptionalValue.of(enableDice); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_PIE) + public Builder setEnablePie(Boolean enablePie) { + this.enablePie = OptionalValue.of(enablePie); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + @JsonProperty(JSON_PROPERTY_GREETING) + public Builder setGreeting(String greeting) { + this.greeting = OptionalValue.of(greeting); + return this; + } + + @JsonProperty(JSON_PROPERTY_MOH_CLASS) + public Builder setMusicOnHold(MusicOnHold MusicOnHold) { + this.MusicOnHold = OptionalValue.of(MusicOnHold); + return this; + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + public Builder setDomain(Domain domain) { + this.domain = OptionalValue.of(domain); + return this; + } + + public ConferenceCalloutInternal build() { + return new ConferenceCalloutInternalImpl( + cli, + dtmf, + custom, + destination, + conferenceId, + conferenceDtmfOptions, + maxDuration, + enableAce, + enableDice, + enablePie, + locale, + greeting, + MusicOnHold, + domain); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternal.java new file mode 100644 index 000000000..ca1971299 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternal.java @@ -0,0 +1,195 @@ +/* + * 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.callouts.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationCustom; +import com.sinch.sdk.domains.voice.models.v1.svaml.Control; +import com.sinch.sdk.models.DualToneMultiFrequency; + +/** + * 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. + */ +@JsonDeserialize(builder = CustomCalloutInternalImpl.Builder.class) +public interface CustomCalloutInternal { + + /** + * The number that will be displayed as the incoming caller, to set your own CLI, you may use your + * verified number or your Dashboard virtual number, it must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * Get destination + * + * @return destination + */ + DestinationCustom getDestination(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#", and "w". A + * "w" will render a 500 ms pause. For example, "ww1234#w#" will render a 1s + * pause, the DTMF tones "1", "2", "3", "4" and + * "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be + * used if the callout destination for instance require a conference PIN code or an extension to + * be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Can be used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * The maximum amount of time in seconds that the call will last. + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * 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\\\":\\\"connectPstn\\\",\\\"number\\\":\\\"46000000001\\\",\\\"maxDuration\\\":90}}\" + * + * + * @return ice + */ + Control getIce(); + + /** + * 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\\\": \\\"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)\\\"}]}]}}\" + * + * + * @return ace + */ + Control getAce(); + + /** + * 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. Example: + * \"https://your-application-server-host/application\" + * + * @return pie + */ + Control getPie(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CustomCalloutInternalImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationCustom destination); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param ice see getter + * @return Current builder + * @see #getIce + */ + Builder setIce(Control ice); + + /** + * see getter + * + * @param ace see getter + * @return Current builder + * @see #getAce + */ + Builder setAce(Control ace); + + /** + * see getter + * + * @param pie see getter + * @return Current builder + * @see #getPie + */ + Builder setPie(Control pie); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CustomCalloutInternal build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternalImpl.java new file mode 100644 index 000000000..f7a71af9c --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/CustomCalloutInternalImpl.java @@ -0,0 +1,286 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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 com.sinch.sdk.domains.voice.models.v1.destination.DestinationCustom; +import com.sinch.sdk.domains.voice.models.v1.svaml.Control; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Objects; + +@JsonPropertyOrder({ + CustomCalloutInternalImpl.JSON_PROPERTY_CLI, + CustomCalloutInternalImpl.JSON_PROPERTY_DESTINATION, + CustomCalloutInternalImpl.JSON_PROPERTY_DTMF, + CustomCalloutInternalImpl.JSON_PROPERTY_CUSTOM, + CustomCalloutInternalImpl.JSON_PROPERTY_MAX_DURATION, + CustomCalloutInternalImpl.JSON_PROPERTY_ICE, + CustomCalloutInternalImpl.JSON_PROPERTY_ACE, + CustomCalloutInternalImpl.JSON_PROPERTY_PIE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class CustomCalloutInternalImpl implements CustomCalloutInternal { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + + private OptionalValue destination; + + public static final String JSON_PROPERTY_DTMF = "dtmf"; + + private OptionalValue dtmf; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; + + private OptionalValue maxDuration; + + public static final String JSON_PROPERTY_ICE = "ice"; + + private OptionalValue ice; + + public static final String JSON_PROPERTY_ACE = "ace"; + + private OptionalValue ace; + + public static final String JSON_PROPERTY_PIE = "pie"; + + private OptionalValue pie; + + public CustomCalloutInternalImpl() {} + + protected CustomCalloutInternalImpl( + OptionalValue cli, + OptionalValue destination, + OptionalValue dtmf, + OptionalValue custom, + OptionalValue maxDuration, + OptionalValue ice, + OptionalValue ace, + OptionalValue pie) { + this.cli = cli; + this.destination = destination; + this.dtmf = dtmf; + this.custom = custom; + this.maxDuration = maxDuration; + this.ice = ice; + this.ace = ace; + this.pie = pie; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public DestinationCustom getDestination() { + return destination.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue destination() { + return destination; + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + return dtmf.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DTMF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue dtmf() { + return dtmf; + } + + @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 Integer getMaxDuration() { + return maxDuration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDuration() { + return maxDuration; + } + + @JsonIgnore + public Control getIce() { + return ice.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue ice() { + return ice; + } + + @JsonIgnore + public Control getAce() { + return ace.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue ace() { + return ace; + } + + @JsonIgnore + public Control getPie() { + return pie.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PIE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue pie() { + return pie; + } + + /** Return true if this customCallout object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomCalloutInternalImpl customCallout = (CustomCalloutInternalImpl) o; + return Objects.equals(this.cli, customCallout.cli) + && Objects.equals(this.destination, customCallout.destination) + && Objects.equals(this.dtmf, customCallout.dtmf) + && Objects.equals(this.custom, customCallout.custom) + && Objects.equals(this.maxDuration, customCallout.maxDuration) + && Objects.equals(this.ice, customCallout.ice) + && Objects.equals(this.ace, customCallout.ace) + && Objects.equals(this.pie, customCallout.pie); + } + + @Override + public int hashCode() { + return Objects.hash(cli, destination, dtmf, custom, maxDuration, ice, ace, pie); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomCalloutInternalImpl {\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); + sb.append(" ice: ").append(toIndentedString(ice)).append("\n"); + sb.append(" ace: ").append(toIndentedString(ace)).append("\n"); + sb.append(" pie: ").append(toIndentedString(pie)).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 CustomCalloutInternal.Builder { + OptionalValue cli = OptionalValue.empty(); + OptionalValue destination = OptionalValue.empty(); + OptionalValue dtmf = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue maxDuration = OptionalValue.empty(); + OptionalValue ice = OptionalValue.empty(); + OptionalValue ace = OptionalValue.empty(); + OptionalValue pie = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + public Builder setDestination(DestinationCustom destination) { + this.destination = OptionalValue.of(destination); + return this; + } + + @JsonProperty(JSON_PROPERTY_DTMF) + public Builder setDtmf(DualToneMultiFrequency dtmf) { + this.dtmf = OptionalValue.of(dtmf); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + public Builder setMaxDuration(Integer maxDuration) { + this.maxDuration = OptionalValue.of(maxDuration); + return this; + } + + @JsonProperty(JSON_PROPERTY_ICE) + public Builder setIce(Control ice) { + this.ice = OptionalValue.of(ice); + return this; + } + + @JsonProperty(JSON_PROPERTY_ACE) + public Builder setAce(Control ace) { + this.ace = OptionalValue.of(ace); + return this; + } + + @JsonProperty(JSON_PROPERTY_PIE) + public Builder setPie(Control pie) { + this.pie = OptionalValue.of(pie); + return this; + } + + public CustomCalloutInternal build() { + return new CustomCalloutInternalImpl( + cli, destination, dtmf, custom, maxDuration, ice, ace, pie); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternal.java new file mode 100644 index 000000000..1e479f6e4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternal.java @@ -0,0 +1,259 @@ +/* + * 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.callouts.request.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationTextToSpeech; +import com.sinch.sdk.models.DualToneMultiFrequency; + +/** + * The text-to-speech callout calls a phone number and plays a synthesized text messages or + * pre-recorded sound files. + */ +@JsonDeserialize(builder = TtsCalloutInternalImpl.Builder.class) +public interface TtsCalloutInternal { + + /** + * 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. The number must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * Get destination + * + * @return destination + */ + DestinationTextToSpeech getDestination(); + + /** + * When the destination picks up, this DTMF tones will be played to the callee. Valid characters + * in the string are "0"-"9", "#", and "w". A + * "w" will render a 500 ms pause. For example, "ww1234#w#" will render a 1s + * pause, the DTMF tones "1", "2", "3", "4" and + * "#" followed by a 0.5s pause and finally the DTMF tone for "#". This can be + * used if the callout destination for instance require a conference PIN code or an extension to + * be entered. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Get domain + * + * @return domain + */ + Domain getDomain(); + + /** + * Can be used to input custom data. + * + * @return custom + */ + String getCustom(); + + /** + * The voice and language you want to use for the text-to-speech message. This can either be + * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported + * languages and voices are detailed here. + * + * @return locale + */ + String getLocale(); + + /** + * The text that will be spoken in the text-to-speech message. Every application's default + * maximum characters allowed in text-to-speech is 600 characters. Contact support if you wish + * this limit to be changed. + * + * @return text + */ + String getText(); + + /** + * 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 are here + * Externally hosted media: Provide a URL to your own hosted media. Please check + * 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>] + * + * + * @return prompts + */ + String getPrompts(); + + /** + * 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. + * + * @return enableAce + */ + Boolean getEnableAce(); + + /** + * 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. + * + * @return enableDice + */ + Boolean getEnableDice(); + + /** + * Note: PIE callbacks are not available for DATA Calls; only PSTN and SIP calls. If + * enablePie is set to true and the application has a callback URL specified, + * you will receive a PIE callback after the runMenu action executes and after the + * configured menu timeout has elapsed with no input. If it's set to false, no PIE + * events will be sent to your backend. + * + * @return enablePie + */ + Boolean getEnablePie(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new TtsCalloutInternalImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationTextToSpeech destination); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(Domain domain); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param text see getter + * @return Current builder + * @see #getText + */ + Builder setText(String text); + + /** + * see getter + * + * @param prompts see getter + * @return Current builder + * @see #getPrompts + */ + Builder setPrompts(String prompts); + + /** + * see getter + * + * @param enableAce see getter + * @return Current builder + * @see #getEnableAce + */ + Builder setEnableAce(Boolean enableAce); + + /** + * see getter + * + * @param enableDice see getter + * @return Current builder + * @see #getEnableDice + */ + Builder setEnableDice(Boolean enableDice); + + /** + * see getter + * + * @param enablePie see getter + * @return Current builder + * @see #getEnablePie + */ + Builder setEnablePie(Boolean enablePie); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + TtsCalloutInternal build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternalImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternalImpl.java new file mode 100644 index 000000000..e57ddf833 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/request/internal/TtsCalloutInternalImpl.java @@ -0,0 +1,388 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts.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 com.sinch.sdk.domains.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationTextToSpeech; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Objects; + +@JsonPropertyOrder({ + TtsCalloutInternalImpl.JSON_PROPERTY_CLI, + TtsCalloutInternalImpl.JSON_PROPERTY_DESTINATION, + TtsCalloutInternalImpl.JSON_PROPERTY_DTMF, + TtsCalloutInternalImpl.JSON_PROPERTY_DOMAIN, + TtsCalloutInternalImpl.JSON_PROPERTY_CUSTOM, + TtsCalloutInternalImpl.JSON_PROPERTY_LOCALE, + TtsCalloutInternalImpl.JSON_PROPERTY_TEXT, + TtsCalloutInternalImpl.JSON_PROPERTY_PROMPTS, + TtsCalloutInternalImpl.JSON_PROPERTY_ENABLE_ACE, + TtsCalloutInternalImpl.JSON_PROPERTY_ENABLE_DICE, + TtsCalloutInternalImpl.JSON_PROPERTY_ENABLE_PIE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class TtsCalloutInternalImpl implements TtsCalloutInternal { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + + private OptionalValue destination; + + public static final String JSON_PROPERTY_DTMF = "dtmf"; + + private OptionalValue dtmf; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + + private OptionalValue domain; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public static final String JSON_PROPERTY_TEXT = "text"; + + private OptionalValue text; + + public static final String JSON_PROPERTY_PROMPTS = "prompts"; + + private OptionalValue prompts; + + public static final String JSON_PROPERTY_ENABLE_ACE = "enableAce"; + + private OptionalValue enableAce; + + public static final String JSON_PROPERTY_ENABLE_DICE = "enableDice"; + + private OptionalValue enableDice; + + public static final String JSON_PROPERTY_ENABLE_PIE = "enablePie"; + + private OptionalValue enablePie; + + public TtsCalloutInternalImpl() {} + + protected TtsCalloutInternalImpl( + OptionalValue cli, + OptionalValue destination, + OptionalValue dtmf, + OptionalValue domain, + OptionalValue custom, + OptionalValue locale, + OptionalValue text, + OptionalValue prompts, + OptionalValue enableAce, + OptionalValue enableDice, + OptionalValue enablePie) { + this.cli = cli; + this.destination = destination; + this.dtmf = dtmf; + this.domain = domain; + this.custom = custom; + this.locale = locale; + this.text = text; + this.prompts = prompts; + this.enableAce = enableAce; + this.enableDice = enableDice; + this.enablePie = enablePie; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public DestinationTextToSpeech getDestination() { + return destination.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue destination() { + return destination; + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + return dtmf.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DTMF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue dtmf() { + return dtmf; + } + + @JsonIgnore + public Domain getDomain() { + return domain.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue domain() { + return domain; + } + + @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 String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + @JsonIgnore + public String getText() { + return text.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue text() { + return text; + } + + @JsonIgnore + public String getPrompts() { + return prompts.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PROMPTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue prompts() { + return prompts; + } + + @JsonIgnore + public Boolean getEnableAce() { + return enableAce.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_ACE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enableAce() { + return enableAce; + } + + @JsonIgnore + public Boolean getEnableDice() { + return enableDice.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_DICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enableDice() { + return enableDice; + } + + @JsonIgnore + public Boolean getEnablePie() { + return enablePie.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_PIE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enablePie() { + return enablePie; + } + + /** Return true if this ttsCallout object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TtsCalloutInternalImpl ttsCallout = (TtsCalloutInternalImpl) o; + return Objects.equals(this.cli, ttsCallout.cli) + && Objects.equals(this.destination, ttsCallout.destination) + && Objects.equals(this.dtmf, ttsCallout.dtmf) + && Objects.equals(this.domain, ttsCallout.domain) + && Objects.equals(this.custom, ttsCallout.custom) + && Objects.equals(this.locale, ttsCallout.locale) + && Objects.equals(this.text, ttsCallout.text) + && Objects.equals(this.prompts, ttsCallout.prompts) + && Objects.equals(this.enableAce, ttsCallout.enableAce) + && Objects.equals(this.enableDice, ttsCallout.enableDice) + && Objects.equals(this.enablePie, ttsCallout.enablePie); + } + + @Override + public int hashCode() { + return Objects.hash( + cli, + destination, + dtmf, + domain, + custom, + locale, + text, + prompts, + enableAce, + enableDice, + enablePie); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TtsCalloutInternalImpl {\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" prompts: ").append(toIndentedString(prompts)).append("\n"); + sb.append(" enableAce: ").append(toIndentedString(enableAce)).append("\n"); + sb.append(" enableDice: ").append(toIndentedString(enableDice)).append("\n"); + sb.append(" enablePie: ").append(toIndentedString(enablePie)).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 TtsCalloutInternal.Builder { + OptionalValue cli = OptionalValue.empty(); + OptionalValue destination = OptionalValue.empty(); + OptionalValue dtmf = OptionalValue.empty(); + OptionalValue domain = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue locale = OptionalValue.empty(); + OptionalValue text = OptionalValue.empty(); + OptionalValue prompts = OptionalValue.empty(); + OptionalValue enableAce = OptionalValue.empty(); + OptionalValue enableDice = OptionalValue.empty(); + OptionalValue enablePie = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + public Builder setDestination(DestinationTextToSpeech destination) { + this.destination = OptionalValue.of(destination); + return this; + } + + @JsonProperty(JSON_PROPERTY_DTMF) + public Builder setDtmf(DualToneMultiFrequency dtmf) { + this.dtmf = OptionalValue.of(dtmf); + return this; + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + public Builder setDomain(Domain domain) { + this.domain = OptionalValue.of(domain); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + @JsonProperty(JSON_PROPERTY_TEXT) + public Builder setText(String text) { + this.text = OptionalValue.of(text); + return this; + } + + @JsonProperty(JSON_PROPERTY_PROMPTS) + public Builder setPrompts(String prompts) { + this.prompts = OptionalValue.of(prompts); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_ACE) + public Builder setEnableAce(Boolean enableAce) { + this.enableAce = OptionalValue.of(enableAce); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_DICE) + public Builder setEnableDice(Boolean enableDice) { + this.enableDice = OptionalValue.of(enableDice); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_PIE) + public Builder setEnablePie(Boolean enablePie) { + this.enablePie = OptionalValue.of(enablePie); + return this; + } + + public TtsCalloutInternal build() { + return new TtsCalloutInternalImpl( + cli, + destination, + dtmf, + domain, + custom, + locale, + text, + prompts, + enableAce, + enableDice, + enablePie); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponse.java new file mode 100644 index 000000000..28b0f0cf5 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponse.java @@ -0,0 +1,54 @@ +/* + * 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.callouts.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** The returned call ID. */ +@JsonDeserialize(builder = CalloutResponseImpl.Builder.class) +public interface CalloutResponse { + + /** + * The returned call identifier. + * + * @return callId + */ + String getCallId(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CalloutResponseImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param callId see getter + * @return Current builder + * @see #getCallId + */ + Builder setCallId(String callId); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CalloutResponse build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetCalloutResponseObjDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponseImpl.java similarity index 55% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetCalloutResponseObjDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponseImpl.java index 3bb1dba9c..88bcabded 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/GetCalloutResponseObjDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/callouts/response/CalloutResponseImpl.java @@ -1,63 +1,39 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.callouts.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 java.util.Objects; -/** The returned call ID. */ -@JsonPropertyOrder({GetCalloutResponseObjDto.JSON_PROPERTY_CALL_ID}) +@JsonPropertyOrder({CalloutResponseImpl.JSON_PROPERTY_CALL_ID}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class GetCalloutResponseObjDto { +public class CalloutResponseImpl implements CalloutResponse { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_CALL_ID = "callId"; - private String callId; - private boolean callIdDefined = false; - public GetCalloutResponseObjDto() {} + private OptionalValue callId; - public GetCalloutResponseObjDto callId(String callId) { - this.callId = callId; - this.callIdDefined = true; - return this; - } + public CalloutResponseImpl() {} - /** - * The returned call identifier. - * - * @return callId - */ - @JsonProperty(JSON_PROPERTY_CALL_ID) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getCallId() { - return callId; + protected CalloutResponseImpl(OptionalValue callId) { + this.callId = callId; } @JsonIgnore - public boolean getCallIdDefined() { - return callIdDefined; + public String getCallId() { + return callId.orElse(null); } @JsonProperty(JSON_PROPERTY_CALL_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setCallId(String callId) { - this.callId = callId; - this.callIdDefined = true; + public OptionalValue callId() { + return callId; } /** Return true if this getCalloutResponseObj object is equal to o. */ @@ -69,7 +45,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - GetCalloutResponseObjDto getCalloutResponseObj = (GetCalloutResponseObjDto) o; + CalloutResponseImpl getCalloutResponseObj = (CalloutResponseImpl) o; return Objects.equals(this.callId, getCalloutResponseObj.callId); } @@ -81,7 +57,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class GetCalloutResponseObjDto {\n"); + sb.append("class CalloutResponseImpl {\n"); sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); sb.append("}"); return sb.toString(); @@ -96,4 +72,19 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements CalloutResponse.Builder { + OptionalValue callId = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CALL_ID) + public Builder setCallId(String callId) { + this.callId = OptionalValue.of(callId); + return this; + } + + public CalloutResponse build() { + return new CalloutResponseImpl(callId); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.java new file mode 100644 index 000000000..478aa77ef --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformation.java @@ -0,0 +1,331 @@ +/* + * 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.calls.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.voice.models.v1.Price; +import java.time.Instant; +import java.util.Arrays; +import java.util.stream.Stream; + +/** CallInformation */ +@JsonDeserialize(builder = CallInformationImpl.Builder.class) +public interface CallInformation { + + /** + * Get from + * + * @return from + */ + CallInformationFrom getFrom(); + + /** + * Get to + * + * @return to + */ + CallInformationTo getTo(); + + /** Must be pstn for PSTN. */ + public class DomainEnum extends EnumDynamic { + public static final DomainEnum PSTN = new DomainEnum("pstn"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(DomainEnum.class, DomainEnum::new, Arrays.asList(PSTN)); + + private DomainEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static DomainEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(DomainEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Must be pstn for PSTN. + * + * @return domain + */ + DomainEnum getDomain(); + + /** + * The unique identifier of the call. + * + * @return callId + */ + String getCallId(); + + /** + * The duration of the call in seconds. + * + * @return duration + */ + Integer getDuration(); + + /** The status of the call. Either ONGOING or FINAL */ + public class StatusEnum extends EnumDynamic { + public static final StatusEnum ONGOING = new StatusEnum("ONGOING"); + public static final StatusEnum FINAL = new StatusEnum("FINAL"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(StatusEnum.class, StatusEnum::new, Arrays.asList(ONGOING, FINAL)); + + private StatusEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static StatusEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(StatusEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The status of the call. Either ONGOING or FINAL + * + * @return status + */ + StatusEnum getStatus(); + + /** + * Get result + * + * @return result + */ + CallResult getResult(); + + /** Contains the reason why a call ended. */ + public class ReasonEnum extends EnumDynamic { + public static final ReasonEnum N_A = new ReasonEnum("N/A"); + public static final ReasonEnum TIMEOUT = new ReasonEnum("TIMEOUT"); + public static final ReasonEnum CALLERHANGUP = new ReasonEnum("CALLERHANGUP"); + public static final ReasonEnum CALLEEHANGUP = new ReasonEnum("CALLEEHANGUP"); + public static final ReasonEnum BLOCKED = new ReasonEnum("BLOCKED"); + public static final ReasonEnum NOCREDITPARTNER = new ReasonEnum("NOCREDITPARTNER"); + public static final ReasonEnum MANAGERHANGUP = new ReasonEnum("MANAGERHANGUP"); + public static final ReasonEnum CANCEL = new ReasonEnum("CANCEL"); + public static final ReasonEnum GENERALERROR = new ReasonEnum("GENERALERROR"); + public static final ReasonEnum INVALIDSVAMLACTION = new ReasonEnum("INVALIDSVAMLACTION"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + ReasonEnum.class, + ReasonEnum::new, + Arrays.asList( + N_A, + TIMEOUT, + CALLERHANGUP, + CALLEEHANGUP, + BLOCKED, + NOCREDITPARTNER, + MANAGERHANGUP, + CANCEL, + GENERALERROR, + INVALIDSVAMLACTION)); + + private ReasonEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static ReasonEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(ReasonEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Contains the reason why a call ended. + * + * @return reason + */ + ReasonEnum getReason(); + + /** + * The date and time of the call. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * Get userRate + * + * @return userRate + */ + Price getUserRate(); + + /** + * Get debit + * + * @return debit + */ + Price getDebit(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CallInformationImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param from see getter + * @return Current builder + * @see #getFrom + */ + Builder setFrom(CallInformationFrom from); + + /** + * see getter + * + * @param to see getter + * @return Current builder + * @see #getTo + */ + Builder setTo(CallInformationTo to); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(DomainEnum domain); + + /** + * see getter + * + * @param callId see getter + * @return Current builder + * @see #getCallId + */ + Builder setCallId(String callId); + + /** + * see getter + * + * @param duration see getter + * @return Current builder + * @see #getDuration + */ + Builder setDuration(Integer duration); + + /** + * see getter + * + * @param status see getter + * @return Current builder + * @see #getStatus + */ + Builder setStatus(StatusEnum status); + + /** + * see getter + * + * @param result see getter + * @return Current builder + * @see #getResult + */ + Builder setResult(CallResult result); + + /** + * see getter + * + * @param reason see getter + * @return Current builder + * @see #getReason + */ + Builder setReason(ReasonEnum reason); + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param userRate see getter + * @return Current builder + * @see #getUserRate + */ + Builder setUserRate(Price userRate); + + /** + * see getter + * + * @param debit see getter + * @return Current builder + * @see #getDebit + */ + Builder setDebit(Price debit); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CallInformation build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationImpl.java new file mode 100644 index 000000000..a8eca152e --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallInformationImpl.java @@ -0,0 +1,396 @@ +package com.sinch.sdk.domains.voice.models.v1.calls.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.voice.models.v1.Price; +import java.time.Instant; +import java.util.Objects; + +@JsonPropertyOrder({ + CallInformationImpl.JSON_PROPERTY_FROM, + CallInformationImpl.JSON_PROPERTY_TO, + CallInformationImpl.JSON_PROPERTY_DOMAIN, + CallInformationImpl.JSON_PROPERTY_CALL_ID, + CallInformationImpl.JSON_PROPERTY_DURATION, + CallInformationImpl.JSON_PROPERTY_STATUS, + CallInformationImpl.JSON_PROPERTY_RESULT, + CallInformationImpl.JSON_PROPERTY_REASON, + CallInformationImpl.JSON_PROPERTY_TIMESTAMP, + CallInformationImpl.JSON_PROPERTY_CUSTOM, + CallInformationImpl.JSON_PROPERTY_USER_RATE, + CallInformationImpl.JSON_PROPERTY_DEBIT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class CallInformationImpl implements CallInformation { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_FROM = "from"; + + private OptionalValue from; + + public static final String JSON_PROPERTY_TO = "to"; + + private OptionalValue to; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + + private OptionalValue domain; + + public static final String JSON_PROPERTY_CALL_ID = "callId"; + + private OptionalValue callId; + + public static final String JSON_PROPERTY_DURATION = "duration"; + + private OptionalValue duration; + + public static final String JSON_PROPERTY_STATUS = "status"; + + private OptionalValue status; + + public static final String JSON_PROPERTY_RESULT = "result"; + + private OptionalValue result; + + public static final String JSON_PROPERTY_REASON = "reason"; + + private OptionalValue reason; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + + private OptionalValue timestamp; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_USER_RATE = "userRate"; + + private OptionalValue userRate; + + public static final String JSON_PROPERTY_DEBIT = "debit"; + + private OptionalValue debit; + + public CallInformationImpl() {} + + protected CallInformationImpl( + OptionalValue from, + OptionalValue to, + OptionalValue domain, + OptionalValue callId, + OptionalValue duration, + OptionalValue status, + OptionalValue result, + OptionalValue reason, + OptionalValue timestamp, + OptionalValue custom, + OptionalValue userRate, + OptionalValue 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; + } + + @JsonIgnore + public CallInformationFrom getFrom() { + return from.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue from() { + return from; + } + + @JsonIgnore + public CallInformationTo getTo() { + return to.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue to() { + return to; + } + + @JsonIgnore + public DomainEnum getDomain() { + return domain.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue domain() { + return domain; + } + + @JsonIgnore + public String getCallId() { + return callId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callId() { + return callId; + } + + @JsonIgnore + public Integer getDuration() { + return duration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue duration() { + return duration; + } + + @JsonIgnore + public StatusEnum getStatus() { + return status.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue status() { + return status; + } + + @JsonIgnore + public CallResult getResult() { + return result.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue result() { + return result; + } + + @JsonIgnore + public ReasonEnum getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reason() { + return reason; + } + + @JsonIgnore + public Instant getTimestamp() { + return timestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timestamp() { + return timestamp; + } + + @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 Price getUserRate() { + return userRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue userRate() { + return userRate; + } + + @JsonIgnore + public Price getDebit() { + return debit.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEBIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue debit() { + return debit; + } + + /** Return true if this getCallResponseObj object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CallInformationImpl getCallResponseObj = (CallInformationImpl) o; + return Objects.equals(this.from, getCallResponseObj.from) + && Objects.equals(this.to, getCallResponseObj.to) + && Objects.equals(this.domain, getCallResponseObj.domain) + && Objects.equals(this.callId, getCallResponseObj.callId) + && Objects.equals(this.duration, getCallResponseObj.duration) + && Objects.equals(this.status, getCallResponseObj.status) + && Objects.equals(this.result, getCallResponseObj.result) + && Objects.equals(this.reason, getCallResponseObj.reason) + && Objects.equals(this.timestamp, getCallResponseObj.timestamp) + && Objects.equals(this.custom, getCallResponseObj.custom) + && Objects.equals(this.userRate, getCallResponseObj.userRate) + && Objects.equals(this.debit, getCallResponseObj.debit); + } + + @Override + public int hashCode() { + return Objects.hash( + from, to, domain, callId, duration, status, result, reason, timestamp, custom, userRate, + debit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallInformationImpl {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); + sb.append(" debit: ").append(toIndentedString(debit)).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 CallInformation.Builder { + OptionalValue from = OptionalValue.empty(); + OptionalValue to = OptionalValue.empty(); + OptionalValue domain = OptionalValue.empty(); + OptionalValue callId = OptionalValue.empty(); + OptionalValue duration = OptionalValue.empty(); + OptionalValue status = OptionalValue.empty(); + OptionalValue result = OptionalValue.empty(); + OptionalValue reason = OptionalValue.empty(); + OptionalValue timestamp = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue userRate = OptionalValue.empty(); + OptionalValue debit = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_FROM) + public Builder setFrom(CallInformationFrom from) { + this.from = OptionalValue.of(from); + return this; + } + + @JsonProperty(JSON_PROPERTY_TO) + public Builder setTo(CallInformationTo to) { + this.to = OptionalValue.of(to); + return this; + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + public Builder setDomain(DomainEnum domain) { + this.domain = OptionalValue.of(domain); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALL_ID) + public Builder setCallId(String callId) { + this.callId = OptionalValue.of(callId); + return this; + } + + @JsonProperty(JSON_PROPERTY_DURATION) + public Builder setDuration(Integer duration) { + this.duration = OptionalValue.of(duration); + return this; + } + + @JsonProperty(JSON_PROPERTY_STATUS) + public Builder setStatus(StatusEnum status) { + this.status = OptionalValue.of(status); + return this; + } + + @JsonProperty(JSON_PROPERTY_RESULT) + public Builder setResult(CallResult result) { + this.result = OptionalValue.of(result); + return this; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public Builder setReason(ReasonEnum reason) { + this.reason = OptionalValue.of(reason); + return this; + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + public Builder setTimestamp(Instant timestamp) { + this.timestamp = OptionalValue.of(timestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + public Builder setUserRate(Price userRate) { + this.userRate = OptionalValue.of(userRate); + return this; + } + + @JsonProperty(JSON_PROPERTY_DEBIT) + public Builder setDebit(Price debit) { + this.debit = OptionalValue.of(debit); + return this; + } + + public CallInformation build() { + return new CallInformationImpl( + from, to, domain, callId, duration, status, result, reason, timestamp, custom, userRate, + debit); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallResult.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallResult.java new file mode 100644 index 000000000..a0df2e84f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/calls/response/CallResult.java @@ -0,0 +1,44 @@ +package com.sinch.sdk.domains.voice.models.v1.calls.response; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Contains the result of a call. */ +public class CallResult extends EnumDynamic { + + public static final CallResult N_A = new CallResult("N/A"); + + /** The call was answered. */ + public static final CallResult ANSWERED = new CallResult("ANSWERED"); + + /** The line called was busy. */ + public static final CallResult BUSY = new CallResult("BUSY"); + + /** The line called failed to answer. */ + public static final CallResult NOANSWER = new CallResult("NOANSWER"); + + /** The call failed. */ + public static final CallResult FAILED = new CallResult("FAILED"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + CallResult.class, CallResult::new, Arrays.asList(N_A, ANSWERED, BUSY, NOANSWER, FAILED)); + + private CallResult(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static CallResult from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(CallResult e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptions.java new file mode 100644 index 000000000..ccc04b689 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptions.java @@ -0,0 +1,126 @@ +/* + * 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.conferences; + +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; + +/** + * Options to control how DTMF signals are used by the participant in the conference. For + * information on how to use this feature, read more here. + */ +@JsonDeserialize(builder = ConferenceDtmfOptionsImpl.Builder.class) +public interface ConferenceDtmfOptions { + + /** Determines what DTMF mode the participant will use in the call. */ + public class ModeEnum extends EnumDynamic { + public static final ModeEnum IGNORE = new ModeEnum("ignore"); + public static final ModeEnum FORWARD = new ModeEnum("forward"); + public static final ModeEnum DETECT = new ModeEnum("detect"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + ModeEnum.class, ModeEnum::new, Arrays.asList(IGNORE, FORWARD, DETECT)); + + private ModeEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static ModeEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(ModeEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Determines what DTMF mode the participant will use in the call. + * + * @return mode + */ + ModeEnum getMode(); + + /** + * 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. + * + * @return maxDigits + */ + Integer getMaxDigits(); + + /** + * The number of milliseconds that the system will wait between entered digits before triggering + * the PIE callback. The default value is 3000. + * + * @return timeoutMills + */ + Integer getTimeoutMills(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ConferenceDtmfOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param mode see getter + * @return Current builder + * @see #getMode + */ + Builder setMode(ModeEnum mode); + + /** + * see getter + * + * @param maxDigits see getter + * @return Current builder + * @see #getMaxDigits + */ + Builder setMaxDigits(Integer maxDigits); + + /** + * see getter + * + * @param timeoutMills see getter + * @return Current builder + * @see #getTimeoutMills + */ + Builder setTimeoutMills(Integer timeoutMills); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ConferenceDtmfOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptionsImpl.java new file mode 100644 index 000000000..5b097014f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceDtmfOptionsImpl.java @@ -0,0 +1,147 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences; + +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({ + ConferenceDtmfOptionsImpl.JSON_PROPERTY_MODE, + ConferenceDtmfOptionsImpl.JSON_PROPERTY_MAX_DIGITS, + ConferenceDtmfOptionsImpl.JSON_PROPERTY_TIMEOUT_MILLS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class ConferenceDtmfOptionsImpl implements ConferenceDtmfOptions { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_MODE = "mode"; + + private OptionalValue mode; + + public static final String JSON_PROPERTY_MAX_DIGITS = "maxDigits"; + + private OptionalValue maxDigits; + + public static final String JSON_PROPERTY_TIMEOUT_MILLS = "timeoutMills"; + + private OptionalValue timeoutMills; + + public ConferenceDtmfOptionsImpl() {} + + protected ConferenceDtmfOptionsImpl( + OptionalValue mode, + OptionalValue maxDigits, + OptionalValue timeoutMills) { + this.mode = mode; + this.maxDigits = maxDigits; + this.timeoutMills = timeoutMills; + } + + @JsonIgnore + public ModeEnum getMode() { + return mode.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue mode() { + return mode; + } + + @JsonIgnore + public Integer getMaxDigits() { + return maxDigits.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDigits() { + return maxDigits; + } + + @JsonIgnore + public Integer getTimeoutMills() { + return timeoutMills.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timeoutMills() { + return timeoutMills; + } + + /** Return true if this conferenceDtmfOptions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceDtmfOptionsImpl conferenceDtmfOptions = (ConferenceDtmfOptionsImpl) o; + return Objects.equals(this.mode, conferenceDtmfOptions.mode) + && Objects.equals(this.maxDigits, conferenceDtmfOptions.maxDigits) + && Objects.equals(this.timeoutMills, conferenceDtmfOptions.timeoutMills); + } + + @Override + public int hashCode() { + return Objects.hash(mode, maxDigits, timeoutMills); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceDtmfOptionsImpl {\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" maxDigits: ").append(toIndentedString(maxDigits)).append("\n"); + sb.append(" timeoutMills: ").append(toIndentedString(timeoutMills)).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 ConferenceDtmfOptions.Builder { + OptionalValue mode = OptionalValue.empty(); + OptionalValue maxDigits = OptionalValue.empty(); + OptionalValue timeoutMills = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_MODE) + public Builder setMode(ModeEnum mode) { + this.mode = OptionalValue.of(mode); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DIGITS) + public Builder setMaxDigits(Integer maxDigits) { + this.maxDigits = OptionalValue.of(maxDigits); + return this; + } + + @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) + public Builder setTimeoutMills(Integer timeoutMills) { + this.timeoutMills = OptionalValue.of(timeoutMills); + return this; + } + + public ConferenceDtmfOptions build() { + return new ConferenceDtmfOptionsImpl(mode, maxDigits, timeoutMills); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipant.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipant.java new file mode 100644 index 000000000..9e1117f18 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipant.java @@ -0,0 +1,119 @@ +/* + * 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.conferences; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** ConferenceParticipant */ +@JsonDeserialize(builder = ConferenceParticipantImpl.Builder.class) +public interface ConferenceParticipant { + + /** + * 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 cli + */ + String getCli(); + + /** + * The callId of the call leg that the participant joined the conference. + * + * @return id + */ + String getId(); + + /** + * The number of seconds that the participant has been connected to the conference. + * + * @return duration + */ + Integer getDuration(); + + /** + * Get muted + * + * @return muted + */ + Boolean getMuted(); + + /** + * Get OnHold + * + * @return OnHold + */ + Boolean getOnHold(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ConferenceParticipantImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param duration see getter + * @return Current builder + * @see #getDuration + */ + Builder setDuration(Integer duration); + + /** + * see getter + * + * @param muted see getter + * @return Current builder + * @see #getMuted + */ + Builder setMuted(Boolean muted); + + /** + * see getter + * + * @param OnHold see getter + * @return Current builder + * @see #getOnHold + */ + Builder setOnHold(Boolean OnHold); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ConferenceParticipant build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantImpl.java new file mode 100644 index 000000000..551647978 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantImpl.java @@ -0,0 +1,202 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences; + +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({ + ConferenceParticipantImpl.JSON_PROPERTY_CLI, + ConferenceParticipantImpl.JSON_PROPERTY_ID, + ConferenceParticipantImpl.JSON_PROPERTY_DURATION, + ConferenceParticipantImpl.JSON_PROPERTY_MUTED, + ConferenceParticipantImpl.JSON_PROPERTY_ONHOLD +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class ConferenceParticipantImpl implements ConferenceParticipant { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_DURATION = "duration"; + + private OptionalValue duration; + + public static final String JSON_PROPERTY_MUTED = "muted"; + + private OptionalValue muted; + + public static final String JSON_PROPERTY_ONHOLD = "onhold"; + + private OptionalValue OnHold; + + public ConferenceParticipantImpl() {} + + protected ConferenceParticipantImpl( + OptionalValue cli, + OptionalValue id, + OptionalValue duration, + OptionalValue muted, + OptionalValue OnHold) { + this.cli = cli; + this.id = id; + this.duration = duration; + this.muted = muted; + this.OnHold = OnHold; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @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 Integer getDuration() { + return duration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue duration() { + return duration; + } + + @JsonIgnore + public Boolean getMuted() { + return muted.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MUTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue muted() { + return muted; + } + + @JsonIgnore + public Boolean getOnHold() { + return OnHold.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ONHOLD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue onHold() { + return OnHold; + } + + /** Return true if this getConferenceInfoResponse_participants_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; + } + ConferenceParticipantImpl getConferenceInfoResponseParticipantsInner = + (ConferenceParticipantImpl) o; + return Objects.equals(this.cli, getConferenceInfoResponseParticipantsInner.cli) + && Objects.equals(this.id, getConferenceInfoResponseParticipantsInner.id) + && Objects.equals(this.duration, getConferenceInfoResponseParticipantsInner.duration) + && Objects.equals(this.muted, getConferenceInfoResponseParticipantsInner.muted) + && Objects.equals(this.OnHold, getConferenceInfoResponseParticipantsInner.OnHold); + } + + @Override + public int hashCode() { + return Objects.hash(cli, id, duration, muted, OnHold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceParticipantImpl {\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" muted: ").append(toIndentedString(muted)).append("\n"); + sb.append(" OnHold: ").append(toIndentedString(OnHold)).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 ConferenceParticipant.Builder { + OptionalValue cli = OptionalValue.empty(); + OptionalValue id = OptionalValue.empty(); + OptionalValue duration = OptionalValue.empty(); + OptionalValue muted = OptionalValue.empty(); + OptionalValue OnHold = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_ID) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(JSON_PROPERTY_DURATION) + public Builder setDuration(Integer duration) { + this.duration = OptionalValue.of(duration); + return this; + } + + @JsonProperty(JSON_PROPERTY_MUTED) + public Builder setMuted(Boolean muted) { + this.muted = OptionalValue.of(muted); + return this; + } + + @JsonProperty(JSON_PROPERTY_ONHOLD) + public Builder setOnHold(Boolean OnHold) { + this.OnHold = OptionalValue.of(OnHold); + return this; + } + + public ConferenceParticipant build() { + return new ConferenceParticipantImpl(cli, id, duration, muted, OnHold); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequest.java new file mode 100644 index 000000000..6e2416207 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequest.java @@ -0,0 +1,106 @@ +/* + * 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.conferences.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.voice.models.v1.MusicOnHold; +import java.util.Arrays; +import java.util.stream.Stream; + +/** */ +@JsonDeserialize(builder = ManageConferenceParticipantRequestImpl.Builder.class) +public interface ManageConferenceParticipantRequest { + + /** Action to apply on conference participant. */ + public class CommandEnum extends EnumDynamic { + public static final CommandEnum MUTE = new CommandEnum("mute"); + public static final CommandEnum UNMUTE = new CommandEnum("unmute"); + public static final CommandEnum ONHOLD = new CommandEnum("onhold"); + public static final CommandEnum RESUME = new CommandEnum("resume"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + CommandEnum.class, CommandEnum::new, Arrays.asList(MUTE, UNMUTE, ONHOLD, RESUME)); + + private CommandEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static CommandEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(CommandEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Action to apply on conference participant. + * + * @return command + */ + CommandEnum getCommand(); + + /** + * Means "music on hold". 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 moh 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 MusicOnHold + */ + MusicOnHold getMusicOnHold(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ManageConferenceParticipantRequestImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param command see getter + * @return Current builder + * @see #getCommand + */ + Builder setCommand(CommandEnum command); + + /** + * see getter + * + * @param MusicOnHold see getter + * @return Current builder + * @see #getMusicOnHold + */ + Builder setMusicOnHold(MusicOnHold MusicOnHold); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ManageConferenceParticipantRequest build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequestImpl.java new file mode 100644 index 000000000..3f0c9bf9a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/request/ManageConferenceParticipantRequestImpl.java @@ -0,0 +1,121 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences.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.databind.annotation.JsonPOJOBuilder; +import com.sinch.sdk.core.models.OptionalValue; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import java.util.Objects; + +@JsonPropertyOrder({ + ManageConferenceParticipantRequestImpl.JSON_PROPERTY_COMMAND, + ManageConferenceParticipantRequestImpl.JSON_PROPERTY_MOH +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class ManageConferenceParticipantRequestImpl implements ManageConferenceParticipantRequest { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_COMMAND = "command"; + + private OptionalValue command; + + public static final String JSON_PROPERTY_MOH = "moh"; + + private OptionalValue MusicOnHold; + + public ManageConferenceParticipantRequestImpl() {} + + protected ManageConferenceParticipantRequestImpl( + OptionalValue command, OptionalValue MusicOnHold) { + this.command = command; + this.MusicOnHold = MusicOnHold; + } + + @JsonIgnore + public CommandEnum getCommand() { + return command.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_COMMAND) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue command() { + return command; + } + + @JsonIgnore + public MusicOnHold getMusicOnHold() { + return MusicOnHold.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MOH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue musicOnHold() { + return MusicOnHold; + } + + /** Return true if this manageConferenceParticipantRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ManageConferenceParticipantRequestImpl manageConferenceParticipantRequest = + (ManageConferenceParticipantRequestImpl) o; + return Objects.equals(this.command, manageConferenceParticipantRequest.command) + && Objects.equals(this.MusicOnHold, manageConferenceParticipantRequest.MusicOnHold); + } + + @Override + public int hashCode() { + return Objects.hash(command, MusicOnHold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManageConferenceParticipantRequestImpl {\n"); + sb.append(" command: ").append(toIndentedString(command)).append("\n"); + sb.append(" MusicOnHold: ").append(toIndentedString(MusicOnHold)).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 ManageConferenceParticipantRequest.Builder { + OptionalValue command = OptionalValue.empty(); + OptionalValue MusicOnHold = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_COMMAND) + public Builder setCommand(CommandEnum command) { + this.command = OptionalValue.of(command); + return this; + } + + @JsonProperty(JSON_PROPERTY_MOH) + public Builder setMusicOnHold(MusicOnHold MusicOnHold) { + this.MusicOnHold = OptionalValue.of(MusicOnHold); + return this; + } + + public ManageConferenceParticipantRequest build() { + return new ManageConferenceParticipantRequestImpl(command, MusicOnHold); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponse.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponse.java new file mode 100644 index 000000000..7c1454e5f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponse.java @@ -0,0 +1,56 @@ +/* + * 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.conferences.response; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceParticipant; +import java.util.List; + +/** The response returns information about the participants in the conference. */ +@JsonDeserialize(builder = GetConferenceInfoResponseImpl.Builder.class) +public interface GetConferenceInfoResponse { + + /** + * Get participants + * + * @return participants + */ + List getParticipants(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new GetConferenceInfoResponseImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param participants see getter + * @return Current builder + * @see #getParticipants + */ + Builder setParticipants(List participants); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + GetConferenceInfoResponse build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponseImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponseImpl.java new file mode 100644 index 000000000..9d702990f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/conferences/response/GetConferenceInfoResponseImpl.java @@ -0,0 +1,92 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences.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.voice.models.v1.conferences.ConferenceParticipant; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({GetConferenceInfoResponseImpl.JSON_PROPERTY_PARTICIPANTS}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class GetConferenceInfoResponseImpl implements GetConferenceInfoResponse { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_PARTICIPANTS = "participants"; + + private OptionalValue> participants; + + public GetConferenceInfoResponseImpl() {} + + protected GetConferenceInfoResponseImpl(OptionalValue> participants) { + this.participants = participants; + } + + @JsonIgnore + public List getParticipants() { + return participants.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PARTICIPANTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> participants() { + return participants; + } + + /** Return true if this getConferenceInfoResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetConferenceInfoResponseImpl getConferenceInfoResponse = (GetConferenceInfoResponseImpl) o; + return Objects.equals(this.participants, getConferenceInfoResponse.participants); + } + + @Override + public int hashCode() { + return Objects.hash(participants); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetConferenceInfoResponseImpl {\n"); + sb.append(" participants: ").append(toIndentedString(participants)).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 GetConferenceInfoResponse.Builder { + OptionalValue> participants = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_PARTICIPANTS) + public Builder setParticipants(List participants) { + this.participants = OptionalValue.of(participants); + return this; + } + + public GetConferenceInfoResponse build() { + return new GetConferenceInfoResponseImpl(participants); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDid.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDid.java new file mode 100644 index 000000000..e60b1649b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDid.java @@ -0,0 +1,59 @@ +/* + * 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.destination; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** The type of device and phone number called. */ +@JsonDeserialize(builder = DestinationDidImpl.Builder.class) +public interface DestinationDid extends Destination { + + /** Static builder helper */ + static DestinationDid from(String endPoint) { + return DestinationDid.builder().setEndpoint(endPoint).build(); + } + + /** + * Number that the caller has called + * + * @return endpoint + */ + String getEndpoint(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new DestinationDidImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param endpoint see getter + * @return Current builder + * @see #getEndpoint + */ + Builder setEndpoint(String endpoint); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + DestinationDid build(); + } +} 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 new file mode 100644 index 000000000..4e263590a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationDidImpl.java @@ -0,0 +1,113 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +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.voice.models.v1.destination.internal.DidDestination; +import java.util.Objects; + +@JsonPropertyOrder({ + DestinationDidImpl.JSON_PROPERTY_TYPE, + DestinationDidImpl.JSON_PROPERTY_ENDPOINT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class DestinationDidImpl implements DestinationDid, Destination { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + + private OptionalValue endpoint; + + public DestinationDidImpl() {} + + protected DestinationDidImpl(OptionalValue type, OptionalValue endpoint) { + this.type = type; + this.endpoint = endpoint; + } + + @JsonIgnore + public DidDestination getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue type() { + return type; + } + + @JsonIgnore + public String getEndpoint() { + return endpoint.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue endpoint() { + return endpoint; + } + + /** Return true if this destinationDid object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationDidImpl destinationDid = (DestinationDidImpl) o; + return Objects.equals(this.type, destinationDid.type) + && Objects.equals(this.endpoint, destinationDid.endpoint); + } + + @Override + public int hashCode() { + return Objects.hash(type, endpoint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationDidImpl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).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 DestinationDid.Builder { + OptionalValue type = OptionalValue.of(DidDestination.DID); + OptionalValue endpoint = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + public Builder setEndpoint(String endpoint) { + this.endpoint = OptionalValue.of(endpoint); + return this; + } + + public DestinationDid build() { + return new DestinationDidImpl(type, endpoint); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxp.java new file mode 100644 index 000000000..f946a4bbc --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxp.java @@ -0,0 +1,67 @@ +/* + * 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.destination; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationFrom; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; + +/** The type of device and number or endpoint to call. */ +@JsonDeserialize(builder = DestinationMxpImpl.Builder.class) +public interface DestinationMxp + extends Destination, + DestinationConference, + DestinationCustom, + DestinationTextToSpeech, + CallInformationFrom, + CallInformationTo { + + /** Static builder helper */ + static DestinationMxp from(String endPoint) { + return DestinationMxp.builder().setEndpoint(endPoint).build(); + } + + /** + * For type userName the value is the username for a data endpoint. + * + * @return endpoint + */ + String getEndpoint(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new DestinationMxpImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param endpoint see getter + * @return Current builder + * @see #getEndpoint + */ + Builder setEndpoint(String endpoint); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + DestinationMxp build(); + } +} 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 new file mode 100644 index 000000000..12e4d616d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationMxpImpl.java @@ -0,0 +1,122 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +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.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.internal.MxpDestination; +import java.util.Objects; + +@JsonPropertyOrder({ + DestinationMxpImpl.JSON_PROPERTY_TYPE, + DestinationMxpImpl.JSON_PROPERTY_ENDPOINT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class DestinationMxpImpl + implements DestinationMxp, + Destination, + DestinationConference, + DestinationCustom, + DestinationTextToSpeech, + CallInformationFrom, + CallInformationTo { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + + private OptionalValue endpoint; + + public DestinationMxpImpl() {} + + protected DestinationMxpImpl(OptionalValue type, OptionalValue endpoint) { + this.type = type; + this.endpoint = endpoint; + } + + @JsonIgnore + public MxpDestination getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue type() { + return type; + } + + @JsonIgnore + public String getEndpoint() { + return endpoint.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue endpoint() { + return endpoint; + } + + /** Return true if this destinationMxp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationMxpImpl destinationMxp = (DestinationMxpImpl) o; + return Objects.equals(this.type, destinationMxp.type) + && Objects.equals(this.endpoint, destinationMxp.endpoint); + } + + @Override + public int hashCode() { + return Objects.hash(type, endpoint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationMxpImpl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).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 DestinationMxp.Builder { + OptionalValue type = OptionalValue.of(MxpDestination.USERNAME); + OptionalValue endpoint = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + public Builder setEndpoint(String endpoint) { + this.endpoint = OptionalValue.of(endpoint); + return this; + } + + public DestinationMxp build() { + return new DestinationMxpImpl(type, endpoint); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstn.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstn.java new file mode 100644 index 000000000..75595d6a7 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstn.java @@ -0,0 +1,67 @@ +/* + * 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.destination; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationFrom; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; + +/** The type of device and number or endpoint to call. */ +@JsonDeserialize(builder = DestinationPstnImpl.Builder.class) +public interface DestinationPstn + extends Destination, + DestinationConference, + DestinationCustom, + DestinationTextToSpeech, + CallInformationFrom, + CallInformationTo { + + /** Static builder helper */ + static DestinationPstn from(String endPoint) { + return DestinationPstn.builder().setEndpoint(endPoint).build(); + } + + /** + * If the type is number the value of the endpoint is a phone number. + * + * @return endpoint + */ + String getEndpoint(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new DestinationPstnImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param endpoint see getter + * @return Current builder + * @see #getEndpoint + */ + Builder setEndpoint(String endpoint); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + DestinationPstn build(); + } +} 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 new file mode 100644 index 000000000..55625ab58 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationPstnImpl.java @@ -0,0 +1,123 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +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.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.internal.PstnDestination; +import java.util.Objects; + +@JsonPropertyOrder({ + DestinationPstnImpl.JSON_PROPERTY_TYPE, + DestinationPstnImpl.JSON_PROPERTY_ENDPOINT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class DestinationPstnImpl + implements DestinationPstn, + Destination, + DestinationConference, + DestinationCustom, + DestinationTextToSpeech, + CallInformationFrom, + CallInformationTo { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + + private OptionalValue endpoint; + + public DestinationPstnImpl() {} + + protected DestinationPstnImpl( + OptionalValue type, OptionalValue endpoint) { + this.type = type; + this.endpoint = endpoint; + } + + @JsonIgnore + public PstnDestination getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue type() { + return type; + } + + @JsonIgnore + public String getEndpoint() { + return endpoint.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue endpoint() { + return endpoint; + } + + /** Return true if this destinationPstn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationPstnImpl destinationPstn = (DestinationPstnImpl) o; + return Objects.equals(this.type, destinationPstn.type) + && Objects.equals(this.endpoint, destinationPstn.endpoint); + } + + @Override + public int hashCode() { + return Objects.hash(type, endpoint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationPstnImpl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).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 DestinationPstn.Builder { + OptionalValue type = OptionalValue.of(PstnDestination.NUMBER); + OptionalValue endpoint = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + public Builder setEndpoint(String endpoint) { + this.endpoint = OptionalValue.of(endpoint); + return this; + } + + public DestinationPstn build() { + return new DestinationPstnImpl(type, endpoint); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSip.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSip.java new file mode 100644 index 000000000..a20899d71 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSip.java @@ -0,0 +1,67 @@ +/* + * 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.destination; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationFrom; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformationTo; + +/** The type of device and number or endpoint to call. */ +@JsonDeserialize(builder = DestinationSipImpl.Builder.class) +public interface DestinationSip + extends Destination, + DestinationConference, + DestinationTextToSpeech, + DestinationCustom, + CallInformationFrom, + CallInformationTo { + + /** Static builder helper */ + static DestinationSip from(String endPoint) { + return DestinationSip.builder().setEndpoint(endPoint).build(); + } + + /** + * For type sip the value is the SIP address for a SIP endpoint. + * + * @return endpoint + */ + String getEndpoint(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new DestinationSipImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param endpoint see getter + * @return Current builder + * @see #getEndpoint + */ + Builder setEndpoint(String endpoint); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + DestinationSip build(); + } +} 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 new file mode 100644 index 000000000..8ae7de394 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/DestinationSipImpl.java @@ -0,0 +1,122 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +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.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.internal.SipDestination; +import java.util.Objects; + +@JsonPropertyOrder({ + DestinationSipImpl.JSON_PROPERTY_TYPE, + DestinationSipImpl.JSON_PROPERTY_ENDPOINT +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class DestinationSipImpl + implements DestinationSip, + Destination, + DestinationConference, + DestinationTextToSpeech, + DestinationCustom, + CallInformationFrom, + CallInformationTo { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_ENDPOINT = "endpoint"; + + private OptionalValue endpoint; + + public DestinationSipImpl() {} + + protected DestinationSipImpl(OptionalValue type, OptionalValue endpoint) { + this.type = type; + this.endpoint = endpoint; + } + + @JsonIgnore + public SipDestination getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue type() { + return type; + } + + @JsonIgnore + public String getEndpoint() { + return endpoint.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue endpoint() { + return endpoint; + } + + /** Return true if this destinationSip object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DestinationSipImpl destinationSip = (DestinationSipImpl) o; + return Objects.equals(this.type, destinationSip.type) + && Objects.equals(this.endpoint, destinationSip.endpoint); + } + + @Override + public int hashCode() { + return Objects.hash(type, endpoint); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationSipImpl {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" endpoint: ").append(toIndentedString(endpoint)).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 DestinationSip.Builder { + OptionalValue type = OptionalValue.of(SipDestination.SIP); + OptionalValue endpoint = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENDPOINT) + public Builder setEndpoint(String endpoint) { + this.endpoint = OptionalValue.of(endpoint); + return this; + } + + public DestinationSip build() { + return new DestinationSipImpl(type, endpoint); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternal.java new file mode 100644 index 000000000..3bb652884 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternal.java @@ -0,0 +1,16 @@ +/* + * 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.destination.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = DestinationInternalImpl.DestinationInternalImplDeserializer.class) +public interface DestinationInternal {} 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 new file mode 100644 index 000000000..358df8367 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DestinationInternalImpl.java @@ -0,0 +1,457 @@ +package com.sinch.sdk.domains.voice.models.v1.destination.internal; + +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 com.sinch.sdk.domains.voice.models.v1.destination.DestinationDidImpl; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxpImpl; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstnImpl; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationSipImpl; +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 = DestinationInternalImpl.DestinationInternalImplDeserializer.class) +@JsonSerialize(using = DestinationInternalImpl.DestinationInternalImplSerializer.class) +public class DestinationInternalImpl extends AbstractOpenApiSchema implements DestinationInternal { + private static final Logger log = Logger.getLogger(DestinationInternalImpl.class.getName()); + + public static final class DestinationInternalImplSerializer + extends StdSerializer { + private static final long serialVersionUID = 1L; + + public DestinationInternalImplSerializer(Class t) { + super(t); + } + + public DestinationInternalImplSerializer() { + this(null); + } + + @Override + public void serialize( + DestinationInternalImpl value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static final class DestinationInternalImplDeserializer + extends StdDeserializer { + + private static final long serialVersionUID = 1L; + + public DestinationInternalImplDeserializer() { + this(DestinationInternalImpl.class); + } + + public DestinationInternalImplDeserializer(Class vc) { + super(vc); + } + + @Override + public DestinationInternalImpl deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + DestinationInternalImpl newDestinationInternalImpl = new DestinationInternalImpl(); + Map result2 = + tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String) result2.get("type"); + switch (discriminatorValue) { + case "Number": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationPstnImpl.class); + newDestinationInternalImpl.setActualInstance(deserialized); + return newDestinationInternalImpl; + case "Username": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationMxpImpl.class); + newDestinationInternalImpl.setActualInstance(deserialized); + return newDestinationInternalImpl; + case "did": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationDidImpl.class); + newDestinationInternalImpl.setActualInstance(deserialized); + return newDestinationInternalImpl; + case "number": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationPstnImpl.class); + newDestinationInternalImpl.setActualInstance(deserialized); + return newDestinationInternalImpl; + case "sip": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationSipImpl.class); + newDestinationInternalImpl.setActualInstance(deserialized); + return newDestinationInternalImpl; + case "username": + 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", + discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize DestinationDidImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DestinationDidImpl.class.equals(Integer.class) + || DestinationDidImpl.class.equals(Long.class) + || DestinationDidImpl.class.equals(Float.class) + || DestinationDidImpl.class.equals(Double.class) + || DestinationDidImpl.class.equals(Boolean.class) + || DestinationDidImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DestinationDidImpl.class.equals(Integer.class) + || DestinationDidImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DestinationDidImpl.class.equals(Float.class) + || DestinationDidImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (DestinationDidImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DestinationDidImpl.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationDidImpl.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 'DestinationDidImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DestinationDidImpl'", e); + } + + // deserialize DestinationMxpImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DestinationMxpImpl.class.equals(Integer.class) + || DestinationMxpImpl.class.equals(Long.class) + || DestinationMxpImpl.class.equals(Float.class) + || DestinationMxpImpl.class.equals(Double.class) + || DestinationMxpImpl.class.equals(Boolean.class) + || DestinationMxpImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DestinationMxpImpl.class.equals(Integer.class) + || DestinationMxpImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DestinationMxpImpl.class.equals(Float.class) + || DestinationMxpImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (DestinationMxpImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DestinationMxpImpl.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationMxpImpl.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 'DestinationMxpImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DestinationMxpImpl'", e); + } + + // deserialize DestinationPstnImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DestinationPstnImpl.class.equals(Integer.class) + || DestinationPstnImpl.class.equals(Long.class) + || DestinationPstnImpl.class.equals(Float.class) + || DestinationPstnImpl.class.equals(Double.class) + || DestinationPstnImpl.class.equals(Boolean.class) + || DestinationPstnImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DestinationPstnImpl.class.equals(Integer.class) + || DestinationPstnImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DestinationPstnImpl.class.equals(Float.class) + || DestinationPstnImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (DestinationPstnImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DestinationPstnImpl.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationPstnImpl.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 'DestinationPstnImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DestinationPstnImpl'", e); + } + + // deserialize DestinationSipImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DestinationSipImpl.class.equals(Integer.class) + || DestinationSipImpl.class.equals(Long.class) + || DestinationSipImpl.class.equals(Float.class) + || DestinationSipImpl.class.equals(Double.class) + || DestinationSipImpl.class.equals(Boolean.class) + || DestinationSipImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DestinationSipImpl.class.equals(Integer.class) + || DestinationSipImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DestinationSipImpl.class.equals(Float.class) + || DestinationSipImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (DestinationSipImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DestinationSipImpl.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DestinationSipImpl.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 'DestinationSipImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DestinationSipImpl'", e); + } + + if (match == 1) { + DestinationInternalImpl ret = new DestinationInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException( + String.format( + "Failed deserialization for DestinationInternalImpl: %d classes match result," + + " expected 1", + match)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public DestinationInternalImpl getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "DestinationInternalImpl cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public DestinationInternalImpl() { + super("oneOf", Boolean.FALSE); + } + + public DestinationInternalImpl(DestinationDidImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public DestinationInternalImpl(DestinationMxpImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public DestinationInternalImpl(DestinationPstnImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public DestinationInternalImpl(DestinationSipImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DestinationDidImpl", DestinationDidImpl.class); + schemas.put("DestinationMxpImpl", DestinationMxpImpl.class); + schemas.put("DestinationPstnImpl", DestinationPstnImpl.class); + schemas.put("DestinationSipImpl", DestinationSipImpl.class); + JSONNavigator.registerDescendants( + DestinationInternalImpl.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("Number", DestinationPstnImpl.class); + mappings.put("Username", DestinationMxpImpl.class); + mappings.put("did", DestinationDidImpl.class); + 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); + } + + @Override + public Map> getSchemas() { + return DestinationInternalImpl.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DestinationDidImpl, DestinationMxpImpl, DestinationPstnImpl, + * DestinationSipImpl + * + *

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(DestinationDidImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf(DestinationMxpImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf(DestinationPstnImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf(DestinationSipImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be DestinationDidImpl, DestinationMxpImpl," + + " DestinationPstnImpl, DestinationSipImpl"); + } + + /** + * Get the actual instance, which can be the following: DestinationDidImpl, DestinationMxpImpl, + * DestinationPstnImpl, DestinationSipImpl + * + * @return The actual instance (DestinationDidImpl, DestinationMxpImpl, DestinationPstnImpl, + * DestinationSipImpl) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationDidImpl`. If the actual instance is not + * `DestinationDidImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationDidImpl` + * @throws ClassCastException if the instance is not `DestinationDidImpl` + */ + public DestinationDidImpl getDestinationDidImpl() throws ClassCastException { + return (DestinationDidImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationMxpImpl`. If the actual instance is not + * `DestinationMxpImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationMxpImpl` + * @throws ClassCastException if the instance is not `DestinationMxpImpl` + */ + public DestinationMxpImpl getDestinationMxpImpl() throws ClassCastException { + return (DestinationMxpImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationPstnImpl`. If the actual instance is not + * `DestinationPstnImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationPstnImpl` + * @throws ClassCastException if the instance is not `DestinationPstnImpl` + */ + public DestinationPstnImpl getDestinationPstnImpl() throws ClassCastException { + return (DestinationPstnImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationSipImpl`. If the actual instance is not + * `DestinationSipImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationSipImpl` + * @throws ClassCastException if the instance is not `DestinationSipImpl` + */ + public DestinationSipImpl getDestinationSipImpl() throws ClassCastException { + return (DestinationSipImpl) super.getActualInstance(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DidDestination.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DidDestination.java new file mode 100644 index 000000000..04324838d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/DidDestination.java @@ -0,0 +1,32 @@ +package com.sinch.sdk.domains.voice.models.v1.destination.internal; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Type did for Direct Inward Dialling */ +public class DidDestination extends EnumDynamic { + + /** A DID phone number */ + public static final DidDestination DID = new DidDestination("did"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(DidDestination.class, DidDestination::new, Arrays.asList(DID)); + + private DidDestination(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static DidDestination from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(DidDestination e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/MxpDestination.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/MxpDestination.java new file mode 100644 index 000000000..f8995c53a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/MxpDestination.java @@ -0,0 +1,36 @@ +package com.sinch.sdk.domains.voice.models.v1.destination.internal; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Type userName used for data endpoints. */ +public class MxpDestination extends EnumDynamic { + + /** A username for data endpoints. */ + public static final MxpDestination USERNAME = new MxpDestination("username"); + + /** A username for data endpoints. */ + public static final MxpDestination USERNAME2 = new MxpDestination("Username"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + MxpDestination.class, MxpDestination::new, Arrays.asList(USERNAME, USERNAME2)); + + private MxpDestination(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static MxpDestination from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(MxpDestination e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/PstnDestination.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/PstnDestination.java new file mode 100644 index 000000000..76264768a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/PstnDestination.java @@ -0,0 +1,36 @@ +package com.sinch.sdk.domains.voice.models.v1.destination.internal; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Type number used for PSTN endpoints. */ +public class PstnDestination extends EnumDynamic { + + /** A e.164 formatted number for PSTN endpoints. */ + public static final PstnDestination NUMBER = new PstnDestination("number"); + + /** A e.164 formatted number for PSTN endpoints. */ + public static final PstnDestination NUMBER2 = new PstnDestination("Number"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + PstnDestination.class, PstnDestination::new, Arrays.asList(NUMBER, NUMBER2)); + + private PstnDestination(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static PstnDestination from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(PstnDestination e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/SipDestination.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/SipDestination.java new file mode 100644 index 000000000..43a8552be --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/destination/internal/SipDestination.java @@ -0,0 +1,32 @@ +package com.sinch.sdk.domains.voice.models.v1.destination.internal; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Type sip for SIP infrastructures. */ +public class SipDestination extends EnumDynamic { + + /** A SIP address for SIP infrastructures. */ + public static final SipDestination SIP = new SipDestination("sip"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(SipDestination.class, SipDestination::new, Arrays.asList(SIP)); + + private SipDestination(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static SipDestination from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(SipDestination e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControl.java new file mode 100644 index 000000000..59cc54c4b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControl.java @@ -0,0 +1,78 @@ +/* + * 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; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction; +import java.util.Collection; + +/** + * SVAML is a call control markup language. When a server receives a callback event from the Sinch + * platform, it can respond with a SVAML object to control the voice call. The following is an + * example of a SVAML object type and its contents. + */ +@JsonDeserialize(builder = SvamlControlImpl.Builder.class) +public interface SvamlControl extends com.sinch.sdk.domains.voice.models.v1.svaml.Control { + + /** + * The collection of instructions that can perform various tasks during the call. You can include + * as many instructions as necessary. + * + * @return instructions + */ + Collection getInstructions(); + + /** + * Get action + * + * @return action + */ + SvamlAction getAction(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlControlImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param instructions see getter + * @return Current builder + * @see #getInstructions + */ + Builder setInstructions(Collection instructions); + + /** + * see getter + * + * @param action see getter + * @return Current builder + * @see #getAction + */ + Builder setAction(SvamlAction action); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlControl build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlImpl.java new file mode 100644 index 000000000..8df15a5d0 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlImpl.java @@ -0,0 +1,123 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml; + +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.voice.models.v1.svaml.action.SvamlAction; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction; +import java.util.Collection; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlControlImpl.JSON_PROPERTY_INSTRUCTIONS, + SvamlControlImpl.JSON_PROPERTY_ACTION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlControlImpl + implements SvamlControl, com.sinch.sdk.domains.voice.models.v1.svaml.Control { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_INSTRUCTIONS = "instructions"; + + private OptionalValue> instructions; + + public static final String JSON_PROPERTY_ACTION = "action"; + + private OptionalValue action; + + public SvamlControlImpl() {} + + protected SvamlControlImpl( + OptionalValue> instructions, OptionalValue action) { + this.instructions = instructions; + this.action = action; + } + + @JsonIgnore + public Collection getInstructions() { + return instructions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> instructions() { + return instructions; + } + + @JsonIgnore + public SvamlAction getAction() { + return action.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue action() { + return action; + } + + /** Return true if this SVAMLRequestBody object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlControlImpl svAMLRequestBody = (SvamlControlImpl) o; + return Objects.equals(this.instructions, svAMLRequestBody.instructions) + && Objects.equals(this.action, svAMLRequestBody.action); + } + + @Override + public int hashCode() { + return Objects.hash(instructions, action); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlControlImpl {\n"); + sb.append(" instructions: ").append(toIndentedString(instructions)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).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 SvamlControl.Builder { + OptionalValue> instructions = OptionalValue.empty(); + OptionalValue action = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_INSTRUCTIONS) + public Builder setInstructions(Collection instructions) { + this.instructions = OptionalValue.of(instructions); + return this; + } + + @JsonProperty(JSON_PROPERTY_ACTION) + public Builder setAction(SvamlAction action) { + this.action = OptionalValue.of(action); + return this; + } + + public SvamlControl build() { + return new SvamlControlImpl(instructions, action); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeader.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeader.java new file mode 100644 index 000000000..a6ac2f723 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeader.java @@ -0,0 +1,74 @@ +/* + * 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; + +/** + * Call Headers can be used to pass custom data from a Sinch SDK client to another, or specified in + * an ICE response to be made available to the receiving client. Further, if Call Headers is + * specified they will be available in ICE and DICE events. + */ +@JsonDeserialize(builder = CallHeaderImpl.Builder.class) +public interface CallHeader { + + /** + * The call header key of the key value pair. + * + * @return key + */ + String getKey(); + + /** + * The call header value of the key value pair. + * + * @return value + */ + String getValue(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new CallHeaderImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param key see getter + * @return Current builder + * @see #getKey + */ + Builder setKey(String key); + + /** + * see getter + * + * @param value see getter + * @return Current builder + * @see #getValue + */ + Builder setValue(String value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + CallHeader build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallHeaderDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeaderImpl.java similarity index 50% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallHeaderDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeaderImpl.java index cdcac76bd..478d977ea 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/CallHeaderDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/CallHeaderImpl.java @@ -1,100 +1,55 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +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; -/** - * Call Headers can be used to pass custom data from a Sinch SDK client to another, or specified in - * an ICE response to be made available to the receiving client. Further, if Call Headers is - * specified they will be available in ICE and DICE events. - */ -@JsonPropertyOrder({CallHeaderDto.JSON_PROPERTY_KEY, CallHeaderDto.JSON_PROPERTY_VALUE}) +@JsonPropertyOrder({CallHeaderImpl.JSON_PROPERTY_KEY, CallHeaderImpl.JSON_PROPERTY_VALUE}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class CallHeaderDto { +public class CallHeaderImpl implements CallHeader { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_KEY = "key"; - private String key; - private boolean keyDefined = false; + + private OptionalValue key; public static final String JSON_PROPERTY_VALUE = "value"; - private String value; - private boolean valueDefined = false; - public CallHeaderDto() {} + private OptionalValue value; - public CallHeaderDto key(String key) { - this.key = key; - this.keyDefined = true; - return this; - } + public CallHeaderImpl() {} - /** - * The call header key of the key value pair. - * - * @return key - */ - @JsonProperty(JSON_PROPERTY_KEY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getKey() { - return key; + protected CallHeaderImpl(OptionalValue key, OptionalValue value) { + this.key = key; + this.value = value; } @JsonIgnore - public boolean getKeyDefined() { - return keyDefined; + public String getKey() { + return key.orElse(null); } @JsonProperty(JSON_PROPERTY_KEY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setKey(String key) { - this.key = key; - this.keyDefined = true; - } - - public CallHeaderDto value(String value) { - this.value = value; - this.valueDefined = true; - return this; - } - - /** - * The call header value of the key value pair. - * - * @return value - */ - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getValue() { - return value; + public OptionalValue key() { + return key; } @JsonIgnore - public boolean getValueDefined() { - return valueDefined; + public String getValue() { + return value.orElse(null); } @JsonProperty(JSON_PROPERTY_VALUE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setValue(String value) { - this.value = value; - this.valueDefined = true; + public OptionalValue value() { + return value; } /** Return true if this callHeader object is equal to o. */ @@ -106,7 +61,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CallHeaderDto callHeader = (CallHeaderDto) o; + CallHeaderImpl callHeader = (CallHeaderImpl) o; return Objects.equals(this.key, callHeader.key) && Objects.equals(this.value, callHeader.value); } @@ -118,7 +73,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CallHeaderDto {\n"); + sb.append("class CallHeaderImpl {\n"); sb.append(" key: ").append(toIndentedString(key)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); @@ -134,4 +89,26 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements CallHeader.Builder { + OptionalValue key = OptionalValue.empty(); + OptionalValue value = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_KEY) + public Builder setKey(String key) { + this.key = OptionalValue.of(key); + return this; + } + + @JsonProperty(JSON_PROPERTY_VALUE) + public Builder setValue(String value) { + this.value = OptionalValue.of(value); + return this; + } + + public CallHeader build() { + return new CallHeaderImpl(key, value); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java new file mode 100644 index 000000000..843554ffe --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetection.java @@ -0,0 +1,58 @@ +/* + * 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; + +/** + * An optional property used to enable Answering Machine + * Detection (AMD). + */ +@JsonDeserialize(builder = ConnectPstnAnsweringMachineDetectionImpl.Builder.class) +public interface ConnectPstnAnsweringMachineDetection { + + /** + * Sets whether AMD is enabled. + * + * @return enabled + */ + Boolean getEnabled(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new ConnectPstnAnsweringMachineDetectionImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param enabled see getter + * @return Current builder + * @see #getEnabled + */ + Builder setEnabled(Boolean enabled); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + ConnectPstnAnsweringMachineDetection build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectPstnAmdDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java similarity index 53% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectPstnAmdDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java index 48a657f4d..bd480d92d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlActionConnectPstnAmdDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/ConnectPstnAnsweringMachineDetectionImpl.java @@ -1,66 +1,40 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +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; -/** - * An optional property used to enable [Answering Machine - * Detection](/docs/voice/api-reference/amd_v2) (AMD). - */ -@JsonPropertyOrder({SvamlActionConnectPstnAmdDto.JSON_PROPERTY_ENABLED}) +@JsonPropertyOrder({ConnectPstnAnsweringMachineDetectionImpl.JSON_PROPERTY_ENABLED}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlActionConnectPstnAmdDto { +public class ConnectPstnAnsweringMachineDetectionImpl + implements ConnectPstnAnsweringMachineDetection { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_ENABLED = "enabled"; - private Boolean enabled; - private boolean enabledDefined = false; - public SvamlActionConnectPstnAmdDto() {} + private OptionalValue enabled; - public SvamlActionConnectPstnAmdDto enabled(Boolean enabled) { - this.enabled = enabled; - this.enabledDefined = true; - return this; - } + public ConnectPstnAnsweringMachineDetectionImpl() {} - /** - * Sets whether AMD is enabled. - * - * @return enabled - */ - @JsonProperty(JSON_PROPERTY_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnabled() { - return enabled; + protected ConnectPstnAnsweringMachineDetectionImpl(OptionalValue enabled) { + this.enabled = enabled; } @JsonIgnore - public boolean getEnabledDefined() { - return enabledDefined; + public Boolean getEnabled() { + return enabled.orElse(null); } @JsonProperty(JSON_PROPERTY_ENABLED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - this.enabledDefined = true; + public OptionalValue enabled() { + return enabled; } /** Return true if this svaml_action_connectPstn_amd object is equal to o. */ @@ -72,7 +46,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SvamlActionConnectPstnAmdDto svamlActionConnectPstnAmd = (SvamlActionConnectPstnAmdDto) o; + ConnectPstnAnsweringMachineDetectionImpl svamlActionConnectPstnAmd = + (ConnectPstnAnsweringMachineDetectionImpl) o; return Objects.equals(this.enabled, svamlActionConnectPstnAmd.enabled); } @@ -84,7 +59,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SvamlActionConnectPstnAmdDto {\n"); + sb.append("class ConnectPstnAnsweringMachineDetectionImpl {\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append("}"); return sb.toString(); @@ -99,4 +74,19 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements ConnectPstnAnsweringMachineDetection.Builder { + OptionalValue enabled = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENABLED) + public Builder setEnabled(Boolean enabled) { + this.enabled = OptionalValue.of(enabled); + return this; + } + + public ConnectPstnAnsweringMachineDetection build() { + return new ConnectPstnAnsweringMachineDetectionImpl(enabled); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/Menu.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/Menu.java new file mode 100644 index 000000000..08244eeef --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/Menu.java @@ -0,0 +1,187 @@ +/* + * 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; +import java.util.List; + +/** An IVR menu that contains an audio prompt as well as configured options. */ +@JsonDeserialize(builder = MenuImpl.Builder.class) +public interface Menu { + + /** + * The identifier of a menu. One menu must have the ID value of main. + * + * @return id + */ + String getId(); + + /** + * The main voice prompt that the user hears when the menu starts the first time. You can use + * text-to-speech using the #tts[] element, SSML commands using the #ssml[] + * element, pre-recorded messages, or URL references to external media resources. You can + * use multiple prompts by separating each prompt with a semi-colon (;). If multiple + * prompts are used, they will be played in the order they are specified, without any pauses + * between playback. For external media resources, you can use an #href[...] or + * directly specify the full URL. Check the Supported + * audio formats section for more information. + * + * @return mainPrompt + */ + String getMainPrompt(); + + /** + * The prompt that will be played if valid or expected DTMF digits are not entered. You can use + * text-to-speech using the #tts[] element, SSML commands using the #ssml[] + * element, pre-recorded messages, or URL references to external media resources. You can + * use multiple prompts by separating each prompt with a semi-colon (;). If multiple + * prompts are used, they will be played in the order they are specified, without any pauses + * between playback. For external media resources, you can use an #href[...] or + * directly specify the full URL. Check the Supported + * audio formats section for more information. + * + * @return repeatPrompt + */ + String getRepeatPrompt(); + + /** + * The number of times that the repeatPrompt is played. + * + * @return repeats + */ + Integer getRepeats(); + + /** + * The maximum number of digits expected for a user to enter. Once these digits are collected, a + * Prompt + * Input Event (PIE) is triggered containing these digits. + * + * @return maxDigits + */ + Integer getMaxDigits(); + + /** + * Determines silence for the purposes of collecting a DTMF or voice response in milliseconds. If + * the timeout is reached, the response is considered completed and will be submitted. + * + * @return timeoutMills + */ + Integer getTimeoutMills(); + + /** + * Sets a limit for the maximum amount of time allowed to collect voice input. + * + * @return maxTimeoutMills + */ + Integer getMaxTimeoutMills(); + + /** + * The set of options available in the menu. + * + * @return options + */ + List getOptions(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new MenuImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param id see getter + * @return Current builder + * @see #getId + */ + Builder setId(String id); + + /** + * see getter + * + * @param mainPrompt see getter + * @return Current builder + * @see #getMainPrompt + */ + Builder setMainPrompt(String mainPrompt); + + /** + * see getter + * + * @param repeatPrompt see getter + * @return Current builder + * @see #getRepeatPrompt + */ + Builder setRepeatPrompt(String repeatPrompt); + + /** + * see getter + * + * @param repeats see getter + * @return Current builder + * @see #getRepeats + */ + Builder setRepeats(Integer repeats); + + /** + * see getter + * + * @param maxDigits see getter + * @return Current builder + * @see #getMaxDigits + */ + Builder setMaxDigits(Integer maxDigits); + + /** + * see getter + * + * @param timeoutMills see getter + * @return Current builder + * @see #getTimeoutMills + */ + Builder setTimeoutMills(Integer timeoutMills); + + /** + * see getter + * + * @param maxTimeoutMills see getter + * @return Current builder + * @see #getMaxTimeoutMills + */ + Builder setMaxTimeoutMills(Integer maxTimeoutMills); + + /** + * see getter + * + * @param options see getter + * @return Current builder + * @see #getOptions + */ + Builder setOptions(List options); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + Menu build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuImpl.java new file mode 100644 index 000000000..5d65ae3bc --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuImpl.java @@ -0,0 +1,285 @@ +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.List; +import java.util.Objects; + +@JsonPropertyOrder({ + MenuImpl.JSON_PROPERTY_ID, + MenuImpl.JSON_PROPERTY_MAIN_PROMPT, + MenuImpl.JSON_PROPERTY_REPEAT_PROMPT, + MenuImpl.JSON_PROPERTY_REPEATS, + MenuImpl.JSON_PROPERTY_MAX_DIGITS, + MenuImpl.JSON_PROPERTY_TIMEOUT_MILLS, + MenuImpl.JSON_PROPERTY_MAX_TIMEOUT_MILLS, + MenuImpl.JSON_PROPERTY_OPTIONS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class MenuImpl implements Menu { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_ID = "id"; + + private OptionalValue id; + + public static final String JSON_PROPERTY_MAIN_PROMPT = "mainPrompt"; + + private OptionalValue mainPrompt; + + public static final String JSON_PROPERTY_REPEAT_PROMPT = "repeatPrompt"; + + private OptionalValue repeatPrompt; + + public static final String JSON_PROPERTY_REPEATS = "repeats"; + + private OptionalValue repeats; + + public static final String JSON_PROPERTY_MAX_DIGITS = "maxDigits"; + + private OptionalValue maxDigits; + + public static final String JSON_PROPERTY_TIMEOUT_MILLS = "timeoutMills"; + + private OptionalValue timeoutMills; + + public static final String JSON_PROPERTY_MAX_TIMEOUT_MILLS = "maxTimeoutMills"; + + private OptionalValue maxTimeoutMills; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + + private OptionalValue> options; + + public MenuImpl() {} + + protected MenuImpl( + 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; + } + + @JsonIgnore + public String getId() { + return id.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue id() { + return id; + } + + @JsonIgnore + public String getMainPrompt() { + return mainPrompt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAIN_PROMPT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue mainPrompt() { + return mainPrompt; + } + + @JsonIgnore + public String getRepeatPrompt() { + return repeatPrompt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REPEAT_PROMPT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue repeatPrompt() { + return repeatPrompt; + } + + @JsonIgnore + public Integer getRepeats() { + return repeats.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REPEATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue repeats() { + return repeats; + } + + @JsonIgnore + public Integer getMaxDigits() { + return maxDigits.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDigits() { + return maxDigits; + } + + @JsonIgnore + public Integer getTimeoutMills() { + return timeoutMills.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timeoutMills() { + return timeoutMills; + } + + @JsonIgnore + public Integer getMaxTimeoutMills() { + return maxTimeoutMills.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_TIMEOUT_MILLS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxTimeoutMills() { + return maxTimeoutMills; + } + + @JsonIgnore + public List getOptions() { + return options.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> options() { + return options; + } + + /** Return true if this menu object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MenuImpl menu = (MenuImpl) o; + return Objects.equals(this.id, menu.id) + && Objects.equals(this.mainPrompt, menu.mainPrompt) + && Objects.equals(this.repeatPrompt, menu.repeatPrompt) + && Objects.equals(this.repeats, menu.repeats) + && Objects.equals(this.maxDigits, menu.maxDigits) + && Objects.equals(this.timeoutMills, menu.timeoutMills) + && Objects.equals(this.maxTimeoutMills, menu.maxTimeoutMills) + && Objects.equals(this.options, menu.options); + } + + @Override + public int hashCode() { + return Objects.hash( + id, mainPrompt, repeatPrompt, repeats, maxDigits, timeoutMills, maxTimeoutMills, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MenuImpl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" mainPrompt: ").append(toIndentedString(mainPrompt)).append("\n"); + sb.append(" repeatPrompt: ").append(toIndentedString(repeatPrompt)).append("\n"); + sb.append(" repeats: ").append(toIndentedString(repeats)).append("\n"); + sb.append(" maxDigits: ").append(toIndentedString(maxDigits)).append("\n"); + sb.append(" timeoutMills: ").append(toIndentedString(timeoutMills)).append("\n"); + sb.append(" maxTimeoutMills: ").append(toIndentedString(maxTimeoutMills)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).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 Menu.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(); + + @JsonProperty(JSON_PROPERTY_ID) + public Builder setId(String id) { + this.id = OptionalValue.of(id); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAIN_PROMPT) + public Builder setMainPrompt(String mainPrompt) { + this.mainPrompt = OptionalValue.of(mainPrompt); + return this; + } + + @JsonProperty(JSON_PROPERTY_REPEAT_PROMPT) + public Builder setRepeatPrompt(String repeatPrompt) { + this.repeatPrompt = OptionalValue.of(repeatPrompt); + return this; + } + + @JsonProperty(JSON_PROPERTY_REPEATS) + public Builder setRepeats(Integer repeats) { + this.repeats = OptionalValue.of(repeats); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DIGITS) + public Builder setMaxDigits(Integer maxDigits) { + this.maxDigits = OptionalValue.of(maxDigits); + return this; + } + + @JsonProperty(JSON_PROPERTY_TIMEOUT_MILLS) + public Builder setTimeoutMills(Integer timeoutMills) { + this.timeoutMills = OptionalValue.of(timeoutMills); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_TIMEOUT_MILLS) + public Builder setMaxTimeoutMills(Integer maxTimeoutMills) { + this.maxTimeoutMills = OptionalValue.of(maxTimeoutMills); + return this; + } + + @JsonProperty(JSON_PROPERTY_OPTIONS) + public Builder setOptions(List options) { + this.options = OptionalValue.of(options); + return this; + } + + public Menu build() { + return new MenuImpl( + id, mainPrompt, repeatPrompt, repeats, maxDigits, timeoutMills, maxTimeoutMills, options); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOption.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOption.java new file mode 100644 index 000000000..4d7639514 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOption.java @@ -0,0 +1,82 @@ +/* + * 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; +import com.sinch.sdk.models.DualToneMultiFrequency; + +/** + * A configured option that the user can trigger to perform an action. + * + *

Use the {@link + * com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory} factory builder + * helper to create menu action + * + * @see com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory + */ +@JsonDeserialize(builder = MenuOptionImpl.Builder.class) +public interface MenuOption { + + /** + * A DTMF digit the user can press to trigger the configured action. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** + * Determines which action is taken when the DTMF digit is pressed. The following values are + * accepted: - If you want to navigate to another menu, use menu(value). - If you + * want to perform another behavior you have coded in your application, use return (value) + * , where (value) is the name of the method you want to execute. + * + * @return action + */ + String getAction(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new MenuOptionImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param action see getter + * @return Current builder + * @see #getAction + */ + Builder setAction(String action); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + MenuOption build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/OptionDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionImpl.java similarity index 51% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/OptionDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionImpl.java index d3ba2c6b5..dc890134f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/OptionDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/MenuOptionImpl.java @@ -1,96 +1,57 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +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 com.sinch.sdk.models.DualToneMultiFrequency; import java.util.Objects; -/** A configured option that the user can trigger to perform an action. */ -@JsonPropertyOrder({OptionDto.JSON_PROPERTY_DTMF, OptionDto.JSON_PROPERTY_ACTION}) +@JsonPropertyOrder({MenuOptionImpl.JSON_PROPERTY_DTMF, MenuOptionImpl.JSON_PROPERTY_ACTION}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class OptionDto { +public class MenuOptionImpl implements MenuOption { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_DTMF = "dtmf"; - private String dtmf; - private boolean dtmfDefined = false; + + private OptionalValue dtmf; public static final String JSON_PROPERTY_ACTION = "action"; - private String action; - private boolean actionDefined = false; - public OptionDto() {} + private OptionalValue action; - public OptionDto dtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - return this; - } + public MenuOptionImpl() {} - /** - * A DTMF digit the user can press to trigger the configured action. - * - * @return dtmf - */ - @JsonProperty(JSON_PROPERTY_DTMF) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getDtmf() { - return dtmf; + protected MenuOptionImpl( + OptionalValue dtmf, OptionalValue action) { + this.dtmf = dtmf; + this.action = action; } @JsonIgnore - public boolean getDtmfDefined() { - return dtmfDefined; + public DualToneMultiFrequency getDtmf() { + return dtmf.orElse(null); } @JsonProperty(JSON_PROPERTY_DTMF) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setDtmf(String dtmf) { - this.dtmf = dtmf; - this.dtmfDefined = true; - } - - public OptionDto action(String action) { - this.action = action; - this.actionDefined = true; - return this; - } - - /** - * Determines which action is taken when the DTMF digit is pressed. - * - * @return action - */ - @JsonProperty(JSON_PROPERTY_ACTION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getAction() { - return action; + public OptionalValue dtmf() { + return dtmf; } @JsonIgnore - public boolean getActionDefined() { - return actionDefined; + public String getAction() { + return action.orElse(null); } @JsonProperty(JSON_PROPERTY_ACTION) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setAction(String action) { - this.action = action; - this.actionDefined = true; + public OptionalValue action() { + return action; } /** Return true if this option object is equal to o. */ @@ -102,7 +63,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - OptionDto option = (OptionDto) o; + MenuOptionImpl option = (MenuOptionImpl) o; return Objects.equals(this.dtmf, option.dtmf) && Objects.equals(this.action, option.action); } @@ -114,7 +75,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class OptionDto {\n"); + sb.append("class MenuOptionImpl {\n"); sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); sb.append(" action: ").append(toIndentedString(action)).append("\n"); sb.append("}"); @@ -130,4 +91,26 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements MenuOption.Builder { + OptionalValue dtmf = OptionalValue.empty(); + OptionalValue action = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_DTMF) + public Builder setDtmf(DualToneMultiFrequency dtmf) { + this.dtmf = OptionalValue.of(dtmf); + return this; + } + + @JsonProperty(JSON_PROPERTY_ACTION) + public Builder setAction(String action) { + this.action = OptionalValue.of(action); + return this; + } + + public MenuOption build() { + return new MenuOptionImpl(dtmf, action); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConference.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConference.java new file mode 100644 index 000000000..19e6ecb39 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConference.java @@ -0,0 +1,124 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions; +import java.util.Arrays; +import java.util.stream.Stream; + +/** + * Connects an incoming call to a conference. Available to use in a response to an Incoming + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionConnectConferenceImpl.Builder.class) +public interface SvamlActionConnectConference + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value connectConf. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum CONNECT_CONF = new NameEnum("connectConf"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(CONNECT_CONF)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The unique identifier of the conference. Shouldn't exceed 64 characters. + * + * @return conferenceId + */ + String getConferenceId(); + + /** + * Get conferenceDtmfOptions + * + * @return conferenceDtmfOptions + */ + ConferenceDtmfOptions getConferenceDtmfOptions(); + + /** + * Means "music on hold". 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 moh isn't specified, the user will only hear silence while alone in the + * conference. + * + * @return MusicOnHold + */ + MusicOnHold getMusicOnHold(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionConnectConferenceImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param conferenceId see getter + * @return Current builder + * @see #getConferenceId + */ + Builder setConferenceId(String conferenceId); + + /** + * see getter + * + * @param conferenceDtmfOptions see getter + * @return Current builder + * @see #getConferenceDtmfOptions + */ + Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions); + + /** + * see getter + * + * @param MusicOnHold see getter + * @return Current builder + * @see #getMusicOnHold + */ + Builder setMusicOnHold(MusicOnHold MusicOnHold); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionConnectConference build(); + } +} 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 new file mode 100644 index 000000000..e6cc5aa71 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceImpl.java @@ -0,0 +1,175 @@ +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 com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlActionConnectConferenceImpl.JSON_PROPERTY_NAME, + SvamlActionConnectConferenceImpl.JSON_PROPERTY_CONFERENCE_ID, + SvamlActionConnectConferenceImpl.JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS, + SvamlActionConnectConferenceImpl.JSON_PROPERTY_MOH +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionConnectConferenceImpl + implements SvamlActionConnectConference, + com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_CONFERENCE_ID = "conferenceId"; + + private OptionalValue conferenceId; + + public static final String JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS = "conferenceDtmfOptions"; + + private OptionalValue conferenceDtmfOptions; + + public static final String JSON_PROPERTY_MOH = "moh"; + + private OptionalValue MusicOnHold; + + public SvamlActionConnectConferenceImpl() {} + + protected SvamlActionConnectConferenceImpl( + OptionalValue name, + OptionalValue conferenceId, + OptionalValue conferenceDtmfOptions, + OptionalValue MusicOnHold) { + this.name = name; + this.conferenceId = conferenceId; + this.conferenceDtmfOptions = conferenceDtmfOptions; + this.MusicOnHold = MusicOnHold; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getConferenceId() { + return conferenceId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue conferenceId() { + return conferenceId; + } + + @JsonIgnore + public ConferenceDtmfOptions getConferenceDtmfOptions() { + return conferenceDtmfOptions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue conferenceDtmfOptions() { + return conferenceDtmfOptions; + } + + @JsonIgnore + public MusicOnHold getMusicOnHold() { + return MusicOnHold.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MOH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue musicOnHold() { + return MusicOnHold; + } + + /** Return true if this svaml.action.connectConf object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionConnectConferenceImpl svamlActionConnectConf = (SvamlActionConnectConferenceImpl) o; + return Objects.equals(this.name, svamlActionConnectConf.name) + && Objects.equals(this.conferenceId, svamlActionConnectConf.conferenceId) + && Objects.equals(this.conferenceDtmfOptions, svamlActionConnectConf.conferenceDtmfOptions) + && Objects.equals(this.MusicOnHold, svamlActionConnectConf.MusicOnHold); + } + + @Override + public int hashCode() { + return Objects.hash(name, conferenceId, conferenceDtmfOptions, MusicOnHold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionConnectConferenceImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" conferenceDtmfOptions: ") + .append(toIndentedString(conferenceDtmfOptions)) + .append("\n"); + sb.append(" MusicOnHold: ").append(toIndentedString(MusicOnHold)).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 SvamlActionConnectConference.Builder { + OptionalValue name = OptionalValue.of(NameEnum.CONNECT_CONF); + OptionalValue conferenceId = OptionalValue.empty(); + OptionalValue conferenceDtmfOptions = OptionalValue.empty(); + OptionalValue MusicOnHold = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_CONFERENCE_ID) + public Builder setConferenceId(String conferenceId) { + this.conferenceId = OptionalValue.of(conferenceId); + return this; + } + + @JsonProperty(JSON_PROPERTY_CONFERENCE_DTMF_OPTIONS) + public Builder setConferenceDtmfOptions(ConferenceDtmfOptions conferenceDtmfOptions) { + this.conferenceDtmfOptions = OptionalValue.of(conferenceDtmfOptions); + return this; + } + + @JsonProperty(JSON_PROPERTY_MOH) + public Builder setMusicOnHold(MusicOnHold MusicOnHold) { + this.MusicOnHold = OptionalValue.of(MusicOnHold); + return this; + } + + public SvamlActionConnectConference build() { + return new SvamlActionConnectConferenceImpl( + name, conferenceId, conferenceDtmfOptions, MusicOnHold); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxp.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxp.java new file mode 100644 index 000000000..6f9c4986a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxp.java @@ -0,0 +1,108 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +/** + * Determines how an application-to-application call is connected. Available to use in a response to + * an Incoming + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionConnectMxpImpl.Builder.class) +public interface SvamlActionConnectMxp + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value connectMxp. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum CONNECT_MXP = new NameEnum("connectMxp"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(CONNECT_MXP)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get destination + * + * @return destination + */ + DestinationMxp getDestination(); + + /** + * An optional parameter that allows you to specify or override call headers provided to the + * receiving Sinch SDK client. Read more about call headers here. + * + * @return callheaders + */ + List getCallheaders(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionConnectMxpImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationMxp destination); + + /** + * see getter + * + * @param callheaders see getter + * @return Current builder + * @see #getCallheaders + */ + Builder setCallheaders(List callheaders); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionConnectMxp build(); + } +} 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 new file mode 100644 index 000000000..8d7119f86 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpImpl.java @@ -0,0 +1,145 @@ +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 com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlActionConnectMxpImpl.JSON_PROPERTY_NAME, + SvamlActionConnectMxpImpl.JSON_PROPERTY_DESTINATION, + SvamlActionConnectMxpImpl.JSON_PROPERTY_CALLHEADERS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionConnectMxpImpl + implements SvamlActionConnectMxp, + com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + + private OptionalValue destination; + + public static final String JSON_PROPERTY_CALLHEADERS = "callheaders"; + + private OptionalValue> callheaders; + + public SvamlActionConnectMxpImpl() {} + + protected SvamlActionConnectMxpImpl( + OptionalValue name, + OptionalValue destination, + OptionalValue> callheaders) { + this.name = name; + this.destination = destination; + this.callheaders = callheaders; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public DestinationMxp getDestination() { + return destination.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue destination() { + return destination; + } + + @JsonIgnore + public List getCallheaders() { + return callheaders.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLHEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> callheaders() { + return callheaders; + } + + /** Return true if this svaml.action.connectMxp object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionConnectMxpImpl svamlActionConnectMxp = (SvamlActionConnectMxpImpl) o; + return Objects.equals(this.name, svamlActionConnectMxp.name) + && Objects.equals(this.destination, svamlActionConnectMxp.destination) + && Objects.equals(this.callheaders, svamlActionConnectMxp.callheaders); + } + + @Override + public int hashCode() { + return Objects.hash(name, destination, callheaders); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionConnectMxpImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" callheaders: ").append(toIndentedString(callheaders)).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 SvamlActionConnectMxp.Builder { + OptionalValue name = OptionalValue.of(NameEnum.CONNECT_MXP); + OptionalValue destination = OptionalValue.empty(); + OptionalValue> callheaders = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_DESTINATION) + public Builder setDestination(DestinationMxp destination) { + this.destination = OptionalValue.of(destination); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLHEADERS) + public Builder setCallheaders(List callheaders) { + this.callheaders = OptionalValue.of(callheaders); + return this; + } + + public SvamlActionConnectMxp build() { + return new SvamlActionConnectMxpImpl(name, destination, callheaders); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstn.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstn.java new file mode 100644 index 000000000..6e8e38563 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstn.java @@ -0,0 +1,300 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Arrays; +import java.util.stream.Stream; + +/** + * Determines how a PSTN call is connected. Available to use in a response to an Incoming + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionConnectPstnImpl.Builder.class) +public interface SvamlActionConnectPstn + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value connectPstn. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum CONNECT_PSTN = new NameEnum("connectPstn"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(CONNECT_PSTN)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Used to override where PSTN call is connected. If not specified, the extension the client + * called is used. + * + * @return number + */ + String getNumber(); + + /** + * Specifies the locale. Uses the language code according to ISO 639, a dash (- + * ), and a country code according to ISO 3166-1 alpha-2. If not specified, + * the default locale of en-US is used. + * + * @return locale + */ + String getLocale(); + + /** + * 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. + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * The max duration the call will wait in ringing unanswered state before terminating with + * TIMEOUT/NO ANSWER on PSTN leg and NA/BUSYon MXP leg. + * + * @return dialTimeout + */ + Integer getDialTimeout(); + + /** + * Used to override the CLI (or caller ID) of the client. The phone number of the person who + * initiated the call is shown as the CLI. To set your own CLI, you may use your verified number + * or your Dashboard virtual number. + * + * @return cli + */ + String getCli(); + + /** + * If enabled, suppresses ACE + * and DICE + * callbacks for the call. + * + * @return suppressCallbacks + */ + Boolean getSuppressCallbacks(); + + /** + * A string that determines the DTMF tones to play to the callee when the call is picked up. Valid + * characters are: 0-9, #, and w. w renders a + * 500ms pause. For example, the string ww1234#w#, plays a 1 second pause, the DTMF + * tones for 1, 2, 3, 4, and #, + * followed by a 500ms pause and finally the # tone. This is useful if the callout + * destination requires a conference PIN code or an extension. If there is a calling party, it + * will hear progress while the DTMF is sent. + * + * @return dtmf + */ + DualToneMultiFrequency getDtmf(); + + /** The locale's tone to play while ringing. */ + public class IndicationsEnum extends EnumDynamic { + public static final IndicationsEnum AT = new IndicationsEnum("at"); + public static final IndicationsEnum AU = new IndicationsEnum("au"); + public static final IndicationsEnum BG = new IndicationsEnum("bg"); + public static final IndicationsEnum BR = new IndicationsEnum("br"); + public static final IndicationsEnum BE = new IndicationsEnum("be"); + public static final IndicationsEnum CH = new IndicationsEnum("ch"); + public static final IndicationsEnum CL = new IndicationsEnum("cl"); + public static final IndicationsEnum CN = new IndicationsEnum("cn"); + public static final IndicationsEnum CZ = new IndicationsEnum("cz"); + public static final IndicationsEnum DE = new IndicationsEnum("de"); + public static final IndicationsEnum DK = new IndicationsEnum("dk"); + public static final IndicationsEnum EE = new IndicationsEnum("ee"); + public static final IndicationsEnum ES = new IndicationsEnum("es"); + public static final IndicationsEnum FI = new IndicationsEnum("fi"); + public static final IndicationsEnum FR = new IndicationsEnum("fr"); + public static final IndicationsEnum GR = new IndicationsEnum("gr"); + public static final IndicationsEnum HU = new IndicationsEnum("hu"); + public static final IndicationsEnum IL = new IndicationsEnum("il"); + public static final IndicationsEnum IN = new IndicationsEnum("in"); + public static final IndicationsEnum IT = new IndicationsEnum("it"); + public static final IndicationsEnum LT = new IndicationsEnum("lt"); + public static final IndicationsEnum JP = new IndicationsEnum("jp"); + public static final IndicationsEnum MX = new IndicationsEnum("mx"); + public static final IndicationsEnum MY = new IndicationsEnum("my"); + public static final IndicationsEnum NL = new IndicationsEnum("nl"); + public static final IndicationsEnum FALSE = new IndicationsEnum("false"); + public static final IndicationsEnum NZ = new IndicationsEnum("nz"); + public static final IndicationsEnum PH = new IndicationsEnum("ph"); + public static final IndicationsEnum PL = new IndicationsEnum("pl"); + public static final IndicationsEnum PT = new IndicationsEnum("pt"); + public static final IndicationsEnum RU = new IndicationsEnum("ru"); + public static final IndicationsEnum SE = new IndicationsEnum("se"); + public static final IndicationsEnum SG = new IndicationsEnum("sg"); + public static final IndicationsEnum TH = new IndicationsEnum("th"); + public static final IndicationsEnum UK = new IndicationsEnum("uk"); + public static final IndicationsEnum US = new IndicationsEnum("us"); + public static final IndicationsEnum TW = new IndicationsEnum("tw"); + public static final IndicationsEnum VE = new IndicationsEnum("ve"); + public static final IndicationsEnum ZA = new IndicationsEnum("za"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + IndicationsEnum.class, + IndicationsEnum::new, + Arrays.asList( + AT, AU, BG, BR, BE, CH, CL, CN, CZ, DE, DK, EE, ES, FI, FR, GR, HU, IL, IN, IT, LT, + JP, MX, MY, NL, FALSE, NZ, PH, PL, PT, RU, SE, SG, TH, UK, US, TW, VE, ZA)); + + private IndicationsEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static IndicationsEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(IndicationsEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The locale's tone to play while ringing. + * + * @return indications + */ + IndicationsEnum getIndications(); + + /** + * Get amd + * + * @return amd + */ + ConnectPstnAnsweringMachineDetection getAmd(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionConnectPstnImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param number see getter + * @return Current builder + * @see #getNumber + */ + Builder setNumber(String number); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param dialTimeout see getter + * @return Current builder + * @see #getDialTimeout + */ + Builder setDialTimeout(Integer dialTimeout); + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param suppressCallbacks see getter + * @return Current builder + * @see #getSuppressCallbacks + */ + Builder setSuppressCallbacks(Boolean suppressCallbacks); + + /** + * see getter + * + * @param dtmf see getter + * @return Current builder + * @see #getDtmf + */ + Builder setDtmf(DualToneMultiFrequency dtmf); + + /** + * see getter + * + * @param indications see getter + * @return Current builder + * @see #getIndications + */ + Builder setIndications(IndicationsEnum indications); + + /** + * see getter + * + * @param amd see getter + * @return Current builder + * @see #getAmd + */ + Builder setAmd(ConnectPstnAnsweringMachineDetection amd); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionConnectPstn build(); + } +} 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 new file mode 100644 index 000000000..cf5deb901 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnImpl.java @@ -0,0 +1,353 @@ +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 com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlActionConnectPstnImpl.JSON_PROPERTY_NAME, + SvamlActionConnectPstnImpl.JSON_PROPERTY_NUMBER, + SvamlActionConnectPstnImpl.JSON_PROPERTY_LOCALE, + SvamlActionConnectPstnImpl.JSON_PROPERTY_MAX_DURATION, + SvamlActionConnectPstnImpl.JSON_PROPERTY_DIAL_TIMEOUT, + SvamlActionConnectPstnImpl.JSON_PROPERTY_CLI, + SvamlActionConnectPstnImpl.JSON_PROPERTY_SUPPRESS_CALLBACKS, + SvamlActionConnectPstnImpl.JSON_PROPERTY_DTMF, + SvamlActionConnectPstnImpl.JSON_PROPERTY_INDICATIONS, + SvamlActionConnectPstnImpl.JSON_PROPERTY_AMD +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionConnectPstnImpl + implements SvamlActionConnectPstn, + com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_NUMBER = "number"; + + private OptionalValue number; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; + + private OptionalValue maxDuration; + + public static final String JSON_PROPERTY_DIAL_TIMEOUT = "dialTimeout"; + + private OptionalValue dialTimeout; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_SUPPRESS_CALLBACKS = "suppressCallbacks"; + + private OptionalValue suppressCallbacks; + + public static final String JSON_PROPERTY_DTMF = "dtmf"; + + private OptionalValue dtmf; + + public static final String JSON_PROPERTY_INDICATIONS = "indications"; + + private OptionalValue indications; + + public static final String JSON_PROPERTY_AMD = "amd"; + + private OptionalValue amd; + + public SvamlActionConnectPstnImpl() {} + + protected SvamlActionConnectPstnImpl( + OptionalValue name, + OptionalValue number, + OptionalValue locale, + OptionalValue maxDuration, + OptionalValue dialTimeout, + OptionalValue cli, + OptionalValue suppressCallbacks, + OptionalValue dtmf, + OptionalValue indications, + OptionalValue amd) { + this.name = name; + this.number = number; + this.locale = locale; + this.maxDuration = maxDuration; + this.dialTimeout = dialTimeout; + this.cli = cli; + this.suppressCallbacks = suppressCallbacks; + this.dtmf = dtmf; + this.indications = indications; + this.amd = amd; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getNumber() { + return number.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue number() { + return number; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + @JsonIgnore + public Integer getMaxDuration() { + return maxDuration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDuration() { + return maxDuration; + } + + @JsonIgnore + public Integer getDialTimeout() { + return dialTimeout.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DIAL_TIMEOUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue dialTimeout() { + return dialTimeout; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public Boolean getSuppressCallbacks() { + return suppressCallbacks.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue suppressCallbacks() { + return suppressCallbacks; + } + + @JsonIgnore + public DualToneMultiFrequency getDtmf() { + return dtmf.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DTMF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue dtmf() { + return dtmf; + } + + @JsonIgnore + public IndicationsEnum getIndications() { + return indications.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INDICATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue indications() { + return indications; + } + + @JsonIgnore + public ConnectPstnAnsweringMachineDetection getAmd() { + return amd.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AMD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue amd() { + return amd; + } + + /** Return true if this svaml.action.connectPstn object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionConnectPstnImpl svamlActionConnectPstn = (SvamlActionConnectPstnImpl) o; + return Objects.equals(this.name, svamlActionConnectPstn.name) + && Objects.equals(this.number, svamlActionConnectPstn.number) + && Objects.equals(this.locale, svamlActionConnectPstn.locale) + && Objects.equals(this.maxDuration, svamlActionConnectPstn.maxDuration) + && Objects.equals(this.dialTimeout, svamlActionConnectPstn.dialTimeout) + && Objects.equals(this.cli, svamlActionConnectPstn.cli) + && Objects.equals(this.suppressCallbacks, svamlActionConnectPstn.suppressCallbacks) + && Objects.equals(this.dtmf, svamlActionConnectPstn.dtmf) + && Objects.equals(this.indications, svamlActionConnectPstn.indications) + && Objects.equals(this.amd, svamlActionConnectPstn.amd); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + number, + locale, + maxDuration, + dialTimeout, + cli, + suppressCallbacks, + dtmf, + indications, + amd); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionConnectPstnImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); + sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); + sb.append(" dialTimeout: ").append(toIndentedString(dialTimeout)).append("\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" suppressCallbacks: ").append(toIndentedString(suppressCallbacks)).append("\n"); + sb.append(" dtmf: ").append(toIndentedString(dtmf)).append("\n"); + sb.append(" indications: ").append(toIndentedString(indications)).append("\n"); + sb.append(" amd: ").append(toIndentedString(amd)).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 SvamlActionConnectPstn.Builder { + OptionalValue name = OptionalValue.of(NameEnum.CONNECT_PSTN); + 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 dtmf = OptionalValue.empty(); + OptionalValue indications = OptionalValue.empty(); + OptionalValue amd = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_NUMBER) + public Builder setNumber(String number) { + this.number = OptionalValue.of(number); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + public Builder setMaxDuration(Integer maxDuration) { + this.maxDuration = OptionalValue.of(maxDuration); + return this; + } + + @JsonProperty(JSON_PROPERTY_DIAL_TIMEOUT) + public Builder setDialTimeout(Integer dialTimeout) { + this.dialTimeout = OptionalValue.of(dialTimeout); + return this; + } + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) + public Builder setSuppressCallbacks(Boolean suppressCallbacks) { + this.suppressCallbacks = OptionalValue.of(suppressCallbacks); + return this; + } + + @JsonProperty(JSON_PROPERTY_DTMF) + public Builder setDtmf(DualToneMultiFrequency dtmf) { + this.dtmf = OptionalValue.of(dtmf); + return this; + } + + @JsonProperty(JSON_PROPERTY_INDICATIONS) + public Builder setIndications(IndicationsEnum indications) { + this.indications = OptionalValue.of(indications); + return this; + } + + @JsonProperty(JSON_PROPERTY_AMD) + public Builder setAmd(ConnectPstnAnsweringMachineDetection amd) { + this.amd = OptionalValue.of(amd); + return this; + } + + public SvamlActionConnectPstn build() { + return new SvamlActionConnectPstnImpl( + name, + number, + locale, + maxDuration, + dialTimeout, + cli, + suppressCallbacks, + dtmf, + indications, + amd); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSip.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSip.java new file mode 100644 index 000000000..207f69ee4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSip.java @@ -0,0 +1,225 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +/** + * Determines how to route a call to a SIP server. Available to use in a response to an Incoming + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionConnectSipImpl.Builder.class) +public interface SvamlActionConnectSip + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value connectSip. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum CONNECT_SIP = new NameEnum("connectSip"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(CONNECT_SIP)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get destination + * + * @return destination + */ + DestinationSip getDestination(); + + /** + * 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. + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * Used to override the CLI (or caller ID) of the client. The phone number of the person who + * initiated the call is shown as the CLI. To set your own CLI, you may use your verified number + * or your Dashboard virtual number. + * + * @return cli + */ + String getCli(); + + /** An optional parameter to specify the SIP transport protocol. If unspecified, UDP is used. */ + public class TransportEnum extends EnumDynamic { + public static final TransportEnum UDP = new TransportEnum("UDP"); + public static final TransportEnum TCP = new TransportEnum("TCP"); + public static final TransportEnum TLS = new TransportEnum("TLS"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + TransportEnum.class, TransportEnum::new, Arrays.asList(UDP, TCP, TLS)); + + private TransportEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static TransportEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(TransportEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * An optional parameter to specify the SIP transport protocol. If unspecified, UDP is used. + * + * @return transport + */ + TransportEnum getTransport(); + + /** + * If enabled, suppresses ACE + * and DICE + * callbacks for the call. + * + * @return suppressCallbacks + */ + Boolean getSuppressCallbacks(); + + /** + * Private + * SIP headers to send with the call. + * + * @return callHeaders + */ + List getCallHeaders(); + + /** + * Means "music on hold". If this optional parameter is included, plays music to the + * connected participant if the SIP call is placed on hold. If moh isn't specified + * and the SIP call is placed on hold, the user will only hear silence while during the holding + * period . + * + * @return MusicOnHold + */ + MusicOnHold getMusicOnHold(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionConnectSipImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param destination see getter + * @return Current builder + * @see #getDestination + */ + Builder setDestination(DestinationSip destination); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param transport see getter + * @return Current builder + * @see #getTransport + */ + Builder setTransport(TransportEnum transport); + + /** + * see getter + * + * @param suppressCallbacks see getter + * @return Current builder + * @see #getSuppressCallbacks + */ + Builder setSuppressCallbacks(Boolean suppressCallbacks); + + /** + * see getter + * + * @param callHeaders see getter + * @return Current builder + * @see #getCallHeaders + */ + Builder setCallHeaders(List callHeaders); + + /** + * see getter + * + * @param MusicOnHold see getter + * @return Current builder + * @see #getMusicOnHold + */ + Builder setMusicOnHold(MusicOnHold MusicOnHold); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionConnectSip build(); + } +} 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 new file mode 100644 index 000000000..3240e21a2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipImpl.java @@ -0,0 +1,297 @@ +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 com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlActionConnectSipImpl.JSON_PROPERTY_NAME, + SvamlActionConnectSipImpl.JSON_PROPERTY_DESTINATION, + SvamlActionConnectSipImpl.JSON_PROPERTY_MAX_DURATION, + SvamlActionConnectSipImpl.JSON_PROPERTY_CLI, + SvamlActionConnectSipImpl.JSON_PROPERTY_TRANSPORT, + SvamlActionConnectSipImpl.JSON_PROPERTY_SUPPRESS_CALLBACKS, + SvamlActionConnectSipImpl.JSON_PROPERTY_CALL_HEADERS, + SvamlActionConnectSipImpl.JSON_PROPERTY_MOH +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionConnectSipImpl + implements SvamlActionConnectSip, + com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + + private OptionalValue destination; + + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; + + private OptionalValue maxDuration; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_TRANSPORT = "transport"; + + private OptionalValue transport; + + public static final String JSON_PROPERTY_SUPPRESS_CALLBACKS = "suppressCallbacks"; + + private OptionalValue suppressCallbacks; + + public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; + + private OptionalValue> callHeaders; + + public static final String JSON_PROPERTY_MOH = "moh"; + + private OptionalValue MusicOnHold; + + public SvamlActionConnectSipImpl() {} + + protected SvamlActionConnectSipImpl( + OptionalValue name, + OptionalValue destination, + OptionalValue maxDuration, + OptionalValue cli, + OptionalValue transport, + OptionalValue suppressCallbacks, + OptionalValue> callHeaders, + OptionalValue MusicOnHold) { + this.name = name; + this.destination = destination; + this.maxDuration = maxDuration; + this.cli = cli; + this.transport = transport; + this.suppressCallbacks = suppressCallbacks; + this.callHeaders = callHeaders; + this.MusicOnHold = MusicOnHold; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public DestinationSip getDestination() { + return destination.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue destination() { + return destination; + } + + @JsonIgnore + public Integer getMaxDuration() { + return maxDuration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDuration() { + return maxDuration; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public TransportEnum getTransport() { + return transport.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TRANSPORT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue transport() { + return transport; + } + + @JsonIgnore + public Boolean getSuppressCallbacks() { + return suppressCallbacks.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue suppressCallbacks() { + return suppressCallbacks; + } + + @JsonIgnore + public List getCallHeaders() { + return callHeaders.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> callHeaders() { + return callHeaders; + } + + @JsonIgnore + public MusicOnHold getMusicOnHold() { + return MusicOnHold.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MOH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue musicOnHold() { + return MusicOnHold; + } + + /** Return true if this svaml.action.connectSip object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionConnectSipImpl svamlActionConnectSip = (SvamlActionConnectSipImpl) o; + return Objects.equals(this.name, svamlActionConnectSip.name) + && Objects.equals(this.destination, svamlActionConnectSip.destination) + && Objects.equals(this.maxDuration, svamlActionConnectSip.maxDuration) + && Objects.equals(this.cli, svamlActionConnectSip.cli) + && Objects.equals(this.transport, svamlActionConnectSip.transport) + && Objects.equals(this.suppressCallbacks, svamlActionConnectSip.suppressCallbacks) + && Objects.equals(this.callHeaders, svamlActionConnectSip.callHeaders) + && Objects.equals(this.MusicOnHold, svamlActionConnectSip.MusicOnHold); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + destination, + maxDuration, + cli, + transport, + suppressCallbacks, + callHeaders, + MusicOnHold); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionConnectSipImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).append("\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" transport: ").append(toIndentedString(transport)).append("\n"); + sb.append(" suppressCallbacks: ").append(toIndentedString(suppressCallbacks)).append("\n"); + sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).append("\n"); + sb.append(" MusicOnHold: ").append(toIndentedString(MusicOnHold)).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 SvamlActionConnectSip.Builder { + OptionalValue name = OptionalValue.of(NameEnum.CONNECT_SIP); + 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(); + + @JsonProperty(JSON_PROPERTY_DESTINATION) + public Builder setDestination(DestinationSip destination) { + this.destination = OptionalValue.of(destination); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + public Builder setMaxDuration(Integer maxDuration) { + this.maxDuration = OptionalValue.of(maxDuration); + return this; + } + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_TRANSPORT) + public Builder setTransport(TransportEnum transport) { + this.transport = OptionalValue.of(transport); + return this; + } + + @JsonProperty(JSON_PROPERTY_SUPPRESS_CALLBACKS) + public Builder setSuppressCallbacks(Boolean suppressCallbacks) { + this.suppressCallbacks = OptionalValue.of(suppressCallbacks); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + public Builder setCallHeaders(List callHeaders) { + this.callHeaders = OptionalValue.of(callHeaders); + return this; + } + + @JsonProperty(JSON_PROPERTY_MOH) + public Builder setMusicOnHold(MusicOnHold MusicOnHold) { + this.MusicOnHold = OptionalValue.of(MusicOnHold); + return this; + } + + public SvamlActionConnectSip build() { + return new SvamlActionConnectSipImpl( + name, + destination, + maxDuration, + cli, + transport, + suppressCallbacks, + callHeaders, + MusicOnHold); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinue.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinue.java new file mode 100644 index 000000000..059444c7b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinue.java @@ -0,0 +1,74 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** + * Continues to set up a call. Available to use in a response to an Answered + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionContinueImpl.Builder.class) +public interface SvamlActionContinue + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** ready to use action to send a `continue` */ + SvamlActionContinue DEFAULT = SvamlActionContinue.builder().build(); + + /** The name property. Must have the value continue. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum CONTINUE = new NameEnum("continue"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(CONTINUE)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionContinueImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionContinue build(); + } +} 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 new file mode 100644 index 000000000..71afb7f97 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueImpl.java @@ -0,0 +1,85 @@ +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({SvamlActionContinueImpl.JSON_PROPERTY_NAME}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionContinueImpl + implements SvamlActionContinue, com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public SvamlActionContinueImpl() {} + + protected SvamlActionContinueImpl(OptionalValue name) { + this.name = name; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + /** Return true if this svaml.action.continue object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionContinueImpl svamlActionContinue = (SvamlActionContinueImpl) o; + return Objects.equals(this.name, svamlActionContinue.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionContinueImpl {\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 "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements SvamlActionContinue.Builder { + OptionalValue name = OptionalValue.of(NameEnum.CONTINUE); + + public SvamlActionContinue build() { + return new SvamlActionContinueImpl(name); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangup.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangup.java new file mode 100644 index 000000000..6b80ecfd1 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangup.java @@ -0,0 +1,76 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** + * Hangs up a call. Available to use in a response to an Incoming + * Call Event callback or an Answered + * Call Event callback. + */ +@JsonDeserialize(builder = SvamlActionHangupImpl.Builder.class) +public interface SvamlActionHangup + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** ready to use action to send a `hangup` */ + SvamlActionHangup DEFAULT = SvamlActionHangup.builder().build(); + + /** The name property. Must have the value hangup. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum HANGUP = new NameEnum("hangup"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(HANGUP)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionHangupImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionHangup build(); + } +} 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 new file mode 100644 index 000000000..ca37fd5d2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupImpl.java @@ -0,0 +1,85 @@ +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({SvamlActionHangupImpl.JSON_PROPERTY_NAME}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionHangupImpl + implements SvamlActionHangup, com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public SvamlActionHangupImpl() {} + + protected SvamlActionHangupImpl(OptionalValue name) { + this.name = name; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + /** Return true if this svaml.action.hangup object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionHangupImpl svamlActionHangup = (SvamlActionHangupImpl) o; + return Objects.equals(this.name, svamlActionHangup.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionHangupImpl {\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 "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements SvamlActionHangup.Builder { + OptionalValue name = OptionalValue.of(NameEnum.HANGUP); + + public SvamlActionHangup build() { + return new SvamlActionHangupImpl(name); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionPark.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionPark.java new file mode 100644 index 000000000..db8f2bdf2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionPark.java @@ -0,0 +1,142 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** + * Parks the call and places the caller on hold. The caller is placed into a loop, listening to an + * IVR prompt (either a pre-recorded audio file or generated by text to speech). If the call is + * unparked, prompts will stop playing immediately. If the max duration is reached, the last prompt + * will be fully played until the call ends. + */ +@JsonDeserialize(builder = SvamlActionParkImpl.Builder.class) +public interface SvamlActionPark + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value park. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum PARK = new NameEnum("park"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(PARK)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The voice and language you want to use for the text-to-speech message. This can either be + * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported + * languages and voices are detailed here. + * + * @return locale + */ + String getLocale(); + + /** + * That prompt that is played when the call is first answered. You can use text-to-speech using + * the #tts[] element, SSML commands using the #ssml[] element. + * + * @return introPrompt + */ + String getIntroPrompt(); + + /** + * The prompt that is played on repeat until the call is unparked or the until the + * maxDuration value is reached. You can use text-to-speech using the #tts[] + * element, SSML commands using the #ssml[] element. + * + * @return holdPrompt + */ + String getHoldPrompt(); + + /** + * The maximum amount of time in seconds that the holdPrompt will be played. + * + * @return maxDuration + */ + Integer getMaxDuration(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionParkImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param introPrompt see getter + * @return Current builder + * @see #getIntroPrompt + */ + Builder setIntroPrompt(String introPrompt); + + /** + * see getter + * + * @param holdPrompt see getter + * @return Current builder + * @see #getHoldPrompt + */ + Builder setHoldPrompt(String holdPrompt); + + /** + * see getter + * + * @param maxDuration see getter + * @return Current builder + * @see #getMaxDuration + */ + Builder setMaxDuration(Integer maxDuration); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionPark build(); + } +} 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 new file mode 100644 index 000000000..79a904a57 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkImpl.java @@ -0,0 +1,196 @@ +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({ + SvamlActionParkImpl.JSON_PROPERTY_NAME, + SvamlActionParkImpl.JSON_PROPERTY_LOCALE, + SvamlActionParkImpl.JSON_PROPERTY_INTRO_PROMPT, + SvamlActionParkImpl.JSON_PROPERTY_HOLD_PROMPT, + SvamlActionParkImpl.JSON_PROPERTY_MAX_DURATION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionParkImpl + implements SvamlActionPark, com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public static final String JSON_PROPERTY_INTRO_PROMPT = "introPrompt"; + + private OptionalValue introPrompt; + + public static final String JSON_PROPERTY_HOLD_PROMPT = "holdPrompt"; + + private OptionalValue holdPrompt; + + public static final String JSON_PROPERTY_MAX_DURATION = "maxDuration"; + + private OptionalValue maxDuration; + + public SvamlActionParkImpl() {} + + protected SvamlActionParkImpl( + OptionalValue name, + OptionalValue locale, + OptionalValue introPrompt, + OptionalValue holdPrompt, + OptionalValue maxDuration) { + this.name = name; + this.locale = locale; + this.introPrompt = introPrompt; + this.holdPrompt = holdPrompt; + this.maxDuration = maxDuration; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + @JsonIgnore + public String getIntroPrompt() { + return introPrompt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTRO_PROMPT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue introPrompt() { + return introPrompt; + } + + @JsonIgnore + public String getHoldPrompt() { + return holdPrompt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HOLD_PROMPT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue holdPrompt() { + return holdPrompt; + } + + @JsonIgnore + public Integer getMaxDuration() { + return maxDuration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue maxDuration() { + return maxDuration; + } + + /** Return true if this svaml.action.park object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionParkImpl svamlActionPark = (SvamlActionParkImpl) o; + return Objects.equals(this.name, svamlActionPark.name) + && Objects.equals(this.locale, svamlActionPark.locale) + && Objects.equals(this.introPrompt, svamlActionPark.introPrompt) + && Objects.equals(this.holdPrompt, svamlActionPark.holdPrompt) + && Objects.equals(this.maxDuration, svamlActionPark.maxDuration); + } + + @Override + public int hashCode() { + return Objects.hash(name, locale, introPrompt, holdPrompt, maxDuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionParkImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); + sb.append(" introPrompt: ").append(toIndentedString(introPrompt)).append("\n"); + sb.append(" holdPrompt: ").append(toIndentedString(holdPrompt)).append("\n"); + sb.append(" maxDuration: ").append(toIndentedString(maxDuration)).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 SvamlActionPark.Builder { + OptionalValue name = OptionalValue.of(NameEnum.PARK); + OptionalValue locale = OptionalValue.empty(); + OptionalValue introPrompt = OptionalValue.empty(); + OptionalValue holdPrompt = OptionalValue.empty(); + OptionalValue maxDuration = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + @JsonProperty(JSON_PROPERTY_INTRO_PROMPT) + public Builder setIntroPrompt(String introPrompt) { + this.introPrompt = OptionalValue.of(introPrompt); + return this; + } + + @JsonProperty(JSON_PROPERTY_HOLD_PROMPT) + public Builder setHoldPrompt(String holdPrompt) { + this.holdPrompt = OptionalValue.of(holdPrompt); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAX_DURATION) + public Builder setMaxDuration(Integer maxDuration) { + this.maxDuration = OptionalValue.of(maxDuration); + return this; + } + + public SvamlActionPark build() { + return new SvamlActionParkImpl(name, locale, introPrompt, holdPrompt, maxDuration); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenu.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenu.java new file mode 100644 index 000000000..13d1cbdd4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenu.java @@ -0,0 +1,171 @@ +/* + * 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; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +/** + * Plays an interactive voice response (IVR) menu to the callee. This menu can play pre-recorded + * files or text-to-speech messages, collect DTMF tones, and trigger the Prompt + * Input Event (PIE) callback towards your backend, notifying you of the actions the callee + * took. Available to use in a response to an Incoming + * Call Event callback or an Answered + * Call Event callback. Also be used in combination with the Conferences + * endpoint of the Calling API. + */ +@JsonDeserialize(builder = SvamlActionRunMenuImpl.Builder.class) +public interface SvamlActionRunMenu + extends com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + + /** The name property. Must have the value runMenu. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum RUN_MENU = new NameEnum("runMenu"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(RUN_MENU)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * 'Barging' means that the user can press a DTMF digit before the prompt has finished playing. If + * a valid input is pressed, the message will stop playing and accept the input. If barge + * is disabled, the user must listen to the entire prompt before input is accepted. By + * default, barging is enabled. + * + * @return barge + */ + Boolean getBarge(); + + /** + * The voice and language you want to use for the text-to-speech message. This can either be + * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported + * languages and voices are detailed here. If using + * the enableVoice to enable voice detection, the locale property is + * required in order to select the input language. + * + * @return locale + */ + String getLocale(); + + /** + * Selects the menu item from the menus array to play first. + * + * @return mainMenu + */ + String getMainMenu(); + + /** + * Enables voice detection. If enabled, users can say their answers to prompts in addition to + * entering them using the keypad. + * + * @return enableVoice + */ + Boolean getEnableVoice(); + + /** + * The list of menus available. The menu with the id value of main will + * always play first. If no menu has an id value of main, an error is + * returned. + * + * @return menus + */ + List

getMenus(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlActionRunMenuImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param barge see getter + * @return Current builder + * @see #getBarge + */ + Builder setBarge(Boolean barge); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * see getter + * + * @param mainMenu see getter + * @return Current builder + * @see #getMainMenu + */ + Builder setMainMenu(String mainMenu); + + /** + * see getter + * + * @param enableVoice see getter + * @return Current builder + * @see #getEnableVoice + */ + Builder setEnableVoice(Boolean enableVoice); + + /** + * see getter + * + * @param menus see getter + * @return Current builder + * @see #getMenus + */ + Builder setMenus(List menus); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlActionRunMenu build(); + } +} 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 new file mode 100644 index 000000000..b47ed13e2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuImpl.java @@ -0,0 +1,224 @@ +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.List; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlActionRunMenuImpl.JSON_PROPERTY_NAME, + SvamlActionRunMenuImpl.JSON_PROPERTY_BARGE, + SvamlActionRunMenuImpl.JSON_PROPERTY_LOCALE, + SvamlActionRunMenuImpl.JSON_PROPERTY_MAIN_MENU, + SvamlActionRunMenuImpl.JSON_PROPERTY_ENABLE_VOICE, + SvamlActionRunMenuImpl.JSON_PROPERTY_MENUS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlActionRunMenuImpl + implements SvamlActionRunMenu, com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_BARGE = "barge"; + + private OptionalValue barge; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public static final String JSON_PROPERTY_MAIN_MENU = "mainMenu"; + + private OptionalValue mainMenu; + + public static final String JSON_PROPERTY_ENABLE_VOICE = "enableVoice"; + + private OptionalValue enableVoice; + + public static final String JSON_PROPERTY_MENUS = "menus"; + + private OptionalValue> menus; + + public SvamlActionRunMenuImpl() {} + + protected SvamlActionRunMenuImpl( + OptionalValue name, + OptionalValue barge, + OptionalValue locale, + OptionalValue mainMenu, + OptionalValue enableVoice, + OptionalValue> menus) { + this.name = name; + this.barge = barge; + this.locale = locale; + this.mainMenu = mainMenu; + this.enableVoice = enableVoice; + this.menus = menus; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public Boolean getBarge() { + return barge.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BARGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue barge() { + return barge; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + @JsonIgnore + public String getMainMenu() { + return mainMenu.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MAIN_MENU) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue mainMenu() { + return mainMenu; + } + + @JsonIgnore + public Boolean getEnableVoice() { + return enableVoice.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ENABLE_VOICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue enableVoice() { + return enableVoice; + } + + @JsonIgnore + public List getMenus() { + return menus.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MENUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> menus() { + return menus; + } + + /** Return true if this svaml.action.runMenu object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlActionRunMenuImpl svamlActionRunMenu = (SvamlActionRunMenuImpl) o; + return Objects.equals(this.name, svamlActionRunMenu.name) + && Objects.equals(this.barge, svamlActionRunMenu.barge) + && Objects.equals(this.locale, svamlActionRunMenu.locale) + && Objects.equals(this.mainMenu, svamlActionRunMenu.mainMenu) + && Objects.equals(this.enableVoice, svamlActionRunMenu.enableVoice) + && Objects.equals(this.menus, svamlActionRunMenu.menus); + } + + @Override + public int hashCode() { + return Objects.hash(name, barge, locale, mainMenu, enableVoice, menus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlActionRunMenuImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" barge: ").append(toIndentedString(barge)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); + sb.append(" mainMenu: ").append(toIndentedString(mainMenu)).append("\n"); + sb.append(" enableVoice: ").append(toIndentedString(enableVoice)).append("\n"); + sb.append(" menus: ").append(toIndentedString(menus)).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 SvamlActionRunMenu.Builder { + OptionalValue name = OptionalValue.of(NameEnum.RUN_MENU); + OptionalValue barge = OptionalValue.empty(); + OptionalValue locale = OptionalValue.empty(); + OptionalValue mainMenu = OptionalValue.empty(); + OptionalValue enableVoice = OptionalValue.empty(); + OptionalValue> menus = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_BARGE) + public Builder setBarge(Boolean barge) { + this.barge = OptionalValue.of(barge); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + @JsonProperty(JSON_PROPERTY_MAIN_MENU) + public Builder setMainMenu(String mainMenu) { + this.mainMenu = OptionalValue.of(mainMenu); + return this; + } + + @JsonProperty(JSON_PROPERTY_ENABLE_VOICE) + public Builder setEnableVoice(Boolean enableVoice) { + this.enableVoice = OptionalValue.of(enableVoice); + return this; + } + + @JsonProperty(JSON_PROPERTY_MENUS) + public Builder setMenus(List menus) { + this.menus = OptionalValue.of(menus); + return this; + } + + public SvamlActionRunMenu build() { + return new SvamlActionRunMenuImpl(name, barge, locale, mainMenu, enableVoice, menus); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptions.java new file mode 100644 index 000000000..4eaf9df63 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptions.java @@ -0,0 +1,118 @@ +/* + * 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.instruction; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** StartRecordingOptions */ +@JsonDeserialize(builder = StartRecordingOptionsImpl.Builder.class) +public interface StartRecordingOptions { + + /** + * Get destinationUrl + * + * @return destinationUrl + */ + String getDestinationUrl(); + + /** + * Get credentials + * + * @return credentials + */ + String getCredentials(); + + /** + * Get format + * + * @return format + */ + String getFormat(); + + /** + * Get notificationEvents + * + * @return notificationEvents + */ + Boolean getNotificationEvents(); + + /** + * Get transcriptionOptions + * + * @return transcriptionOptions + */ + TranscriptionOptions getTranscriptionOptions(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new StartRecordingOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param destinationUrl see getter + * @return Current builder + * @see #getDestinationUrl + */ + Builder setDestinationUrl(String destinationUrl); + + /** + * see getter + * + * @param credentials see getter + * @return Current builder + * @see #getCredentials + */ + Builder setCredentials(String credentials); + + /** + * see getter + * + * @param format see getter + * @return Current builder + * @see #getFormat + */ + Builder setFormat(String format); + + /** + * see getter + * + * @param notificationEvents see getter + * @return Current builder + * @see #getNotificationEvents + */ + Builder setNotificationEvents(Boolean notificationEvents); + + /** + * see getter + * + * @param transcriptionOptions see getter + * @return Current builder + * @see #getTranscriptionOptions + */ + Builder setTranscriptionOptions(TranscriptionOptions transcriptionOptions); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + StartRecordingOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptionsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptionsImpl.java new file mode 100644 index 000000000..66170bc7b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/StartRecordingOptionsImpl.java @@ -0,0 +1,207 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({ + StartRecordingOptionsImpl.JSON_PROPERTY_DESTINATION_URL, + StartRecordingOptionsImpl.JSON_PROPERTY_CREDENTIALS, + StartRecordingOptionsImpl.JSON_PROPERTY_FORMAT, + StartRecordingOptionsImpl.JSON_PROPERTY_NOTIFICATION_EVENTS, + StartRecordingOptionsImpl.JSON_PROPERTY_TRANSCRIPTION_OPTIONS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class StartRecordingOptionsImpl implements StartRecordingOptions { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_DESTINATION_URL = "destinationUrl"; + + private OptionalValue destinationUrl; + + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + + private OptionalValue credentials; + + public static final String JSON_PROPERTY_FORMAT = "format"; + + private OptionalValue format; + + public static final String JSON_PROPERTY_NOTIFICATION_EVENTS = "notificationEvents"; + + private OptionalValue notificationEvents; + + public static final String JSON_PROPERTY_TRANSCRIPTION_OPTIONS = "transcriptionOptions"; + + private OptionalValue transcriptionOptions; + + public StartRecordingOptionsImpl() {} + + protected StartRecordingOptionsImpl( + 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; + } + + @JsonIgnore + public String getDestinationUrl() { + return destinationUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESTINATION_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue destinationUrl() { + return destinationUrl; + } + + @JsonIgnore + public String getCredentials() { + return credentials.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue credentials() { + return credentials; + } + + @JsonIgnore + public String getFormat() { + return format.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue format() { + return format; + } + + @JsonIgnore + public Boolean getNotificationEvents() { + return notificationEvents.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NOTIFICATION_EVENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue notificationEvents() { + return notificationEvents; + } + + @JsonIgnore + public TranscriptionOptions getTranscriptionOptions() { + return transcriptionOptions.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TRANSCRIPTION_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue transcriptionOptions() { + return transcriptionOptions; + } + + /** Return true if this svaml.instruction.startRecordingOptions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StartRecordingOptionsImpl svamlInstructionStartRecordingOptions = (StartRecordingOptionsImpl) o; + return Objects.equals(this.destinationUrl, svamlInstructionStartRecordingOptions.destinationUrl) + && Objects.equals(this.credentials, svamlInstructionStartRecordingOptions.credentials) + && Objects.equals(this.format, svamlInstructionStartRecordingOptions.format) + && Objects.equals( + this.notificationEvents, svamlInstructionStartRecordingOptions.notificationEvents) + && Objects.equals( + this.transcriptionOptions, svamlInstructionStartRecordingOptions.transcriptionOptions); + } + + @Override + public int hashCode() { + return Objects.hash( + destinationUrl, credentials, format, notificationEvents, transcriptionOptions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StartRecordingOptionsImpl {\n"); + sb.append(" destinationUrl: ").append(toIndentedString(destinationUrl)).append("\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" notificationEvents: ").append(toIndentedString(notificationEvents)).append("\n"); + sb.append(" transcriptionOptions: ") + .append(toIndentedString(transcriptionOptions)) + .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 StartRecordingOptions.Builder { + OptionalValue destinationUrl = OptionalValue.empty(); + OptionalValue credentials = OptionalValue.empty(); + OptionalValue format = OptionalValue.empty(); + OptionalValue notificationEvents = OptionalValue.empty(); + OptionalValue transcriptionOptions = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_DESTINATION_URL) + public Builder setDestinationUrl(String destinationUrl) { + this.destinationUrl = OptionalValue.of(destinationUrl); + return this; + } + + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + public Builder setCredentials(String credentials) { + this.credentials = OptionalValue.of(credentials); + return this; + } + + @JsonProperty(JSON_PROPERTY_FORMAT) + public Builder setFormat(String format) { + this.format = OptionalValue.of(format); + return this; + } + + @JsonProperty(JSON_PROPERTY_NOTIFICATION_EVENTS) + public Builder setNotificationEvents(Boolean notificationEvents) { + this.notificationEvents = OptionalValue.of(notificationEvents); + return this; + } + + @JsonProperty(JSON_PROPERTY_TRANSCRIPTION_OPTIONS) + public Builder setTranscriptionOptions(TranscriptionOptions transcriptionOptions) { + this.transcriptionOptions = OptionalValue.of(transcriptionOptions); + return this; + } + + public StartRecordingOptions build() { + return new StartRecordingOptionsImpl( + destinationUrl, credentials, format, notificationEvents, transcriptionOptions); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswer.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswer.java new file mode 100644 index 000000000..1f521f577 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswer.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.instruction; + +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; + +/** Forces the callee to answer the call. */ +@JsonDeserialize(builder = SvamlInstructionAnswerImpl.Builder.class) +public interface SvamlInstructionAnswer + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** ready to use instruction to send a `answer` */ + SvamlInstructionAnswer DEFAULT = SvamlInstructionAnswer.builder().build(); + + /** The name property. Must have the value answer. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum ANSWER = new NameEnum("answer"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(ANSWER)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionAnswerImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionAnswer build(); + } +} 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 new file mode 100644 index 000000000..fbdbc55e2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerImpl.java @@ -0,0 +1,86 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({SvamlInstructionAnswerImpl.JSON_PROPERTY_NAME}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionAnswerImpl + implements SvamlInstructionAnswer, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public SvamlInstructionAnswerImpl() {} + + protected SvamlInstructionAnswerImpl(OptionalValue name) { + this.name = name; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + /** Return true if this svaml.instruction.answer object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionAnswerImpl svamlInstructionAnswer = (SvamlInstructionAnswerImpl) o; + return Objects.equals(this.name, svamlInstructionAnswer.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionAnswerImpl {\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 "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements SvamlInstructionAnswer.Builder { + OptionalValue name = OptionalValue.of(NameEnum.ANSWER); + + public SvamlInstructionAnswer build() { + return new SvamlInstructionAnswerImpl(name); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFiles.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFiles.java new file mode 100644 index 000000000..58ed6dd95 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFiles.java @@ -0,0 +1,107 @@ +/* + * 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.instruction; + +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.List; +import java.util.stream.Stream; + +/** + * Plays Interactive Voice Response (IVR) files for the supported locale or SSML commands at the + * Sinch backend. An IVR message is played only on the caller's side. + */ +@JsonDeserialize(builder = SvamlInstructionPlayFilesImpl.Builder.class) +public interface SvamlInstructionPlayFiles + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** The name property. Must have the value playFiles. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum PLAY_FILES = new NameEnum("playFiles"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(PLAY_FILES)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The IDs of the files which will be played. These can be a URL to a file, SSML commands using + * the #ssml[] element, or text using the #tts[] element. + * + * @return ids + */ + List getIds(); + + /** + * If using SSML or TTS, this is a required field. The voice and language you want to use for the + * text-to-speech message. This can either be defined by the ISO 639 locale and language code or + * by specifying a particular voice. Supported languages and voices are detailed here. + * + * @return locale + */ + String getLocale(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionPlayFilesImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param ids see getter + * @return Current builder + * @see #getIds + */ + Builder setIds(List ids); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionPlayFiles build(); + } +} 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 new file mode 100644 index 000000000..c9e13e472 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesImpl.java @@ -0,0 +1,142 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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.List; +import java.util.Objects; + +@JsonPropertyOrder({ + SvamlInstructionPlayFilesImpl.JSON_PROPERTY_NAME, + SvamlInstructionPlayFilesImpl.JSON_PROPERTY_IDS, + SvamlInstructionPlayFilesImpl.JSON_PROPERTY_LOCALE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionPlayFilesImpl + implements SvamlInstructionPlayFiles, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_IDS = "ids"; + + private OptionalValue> ids; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public SvamlInstructionPlayFilesImpl() {} + + protected SvamlInstructionPlayFilesImpl( + OptionalValue name, OptionalValue> ids, OptionalValue locale) { + this.name = name; + this.ids = ids; + this.locale = locale; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public List getIds() { + return ids.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue> ids() { + return ids; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + /** Return true if this svaml.instruction.playFiles object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionPlayFilesImpl svamlInstructionPlayFiles = (SvamlInstructionPlayFilesImpl) o; + return Objects.equals(this.name, svamlInstructionPlayFiles.name) + && Objects.equals(this.ids, svamlInstructionPlayFiles.ids) + && Objects.equals(this.locale, svamlInstructionPlayFiles.locale); + } + + @Override + public int hashCode() { + return Objects.hash(name, ids, locale); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionPlayFilesImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).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 SvamlInstructionPlayFiles.Builder { + OptionalValue name = OptionalValue.of(NameEnum.PLAY_FILES); + OptionalValue> ids = OptionalValue.empty(); + OptionalValue locale = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_IDS) + public Builder setIds(List ids) { + this.ids = OptionalValue.of(ids); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + public SvamlInstructionPlayFiles build() { + return new SvamlInstructionPlayFilesImpl(name, ids, locale); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSay.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSay.java new file mode 100644 index 000000000..bf9aec294 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSay.java @@ -0,0 +1,106 @@ +/* + * 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.instruction; + +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; + +/** + * Plays a synthesized text-to-speech message to the end user. The message is provided in the text + * field. + */ +@JsonDeserialize(builder = SvamlInstructionSayImpl.Builder.class) +public interface SvamlInstructionSay + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** The name property. Must have the value say. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum SAY = new NameEnum("say"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(SAY)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Contains the message that will be spoken. Default maximum length is 600 characters. To change + * this limit, please contact support. + * + * @return text + */ + String getText(); + + /** + * The voice and language you want to use for the text-to-speech message. This can either be + * defined by the ISO 639 locale and language code or by specifying a particular voice. Supported + * languages and voices are detailed here. + * + * @return locale + */ + String getLocale(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionSayImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param text see getter + * @return Current builder + * @see #getText + */ + Builder setText(String text); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionSay build(); + } +} 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 new file mode 100644 index 000000000..723ab34a1 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayImpl.java @@ -0,0 +1,141 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({ + SvamlInstructionSayImpl.JSON_PROPERTY_NAME, + SvamlInstructionSayImpl.JSON_PROPERTY_TEXT, + SvamlInstructionSayImpl.JSON_PROPERTY_LOCALE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionSayImpl + implements SvamlInstructionSay, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_TEXT = "text"; + + private OptionalValue text; + + public static final String JSON_PROPERTY_LOCALE = "locale"; + + private OptionalValue locale; + + public SvamlInstructionSayImpl() {} + + protected SvamlInstructionSayImpl( + OptionalValue name, OptionalValue text, OptionalValue locale) { + this.name = name; + this.text = text; + this.locale = locale; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getText() { + return text.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue text() { + return text; + } + + @JsonIgnore + public String getLocale() { + return locale.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue locale() { + return locale; + } + + /** Return true if this svaml.instruction.say object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionSayImpl svamlInstructionSay = (SvamlInstructionSayImpl) o; + return Objects.equals(this.name, svamlInstructionSay.name) + && Objects.equals(this.text, svamlInstructionSay.text) + && Objects.equals(this.locale, svamlInstructionSay.locale); + } + + @Override + public int hashCode() { + return Objects.hash(name, text, locale); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionSayImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" locale: ").append(toIndentedString(locale)).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 SvamlInstructionSay.Builder { + OptionalValue name = OptionalValue.of(NameEnum.SAY); + OptionalValue text = OptionalValue.empty(); + OptionalValue locale = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TEXT) + public Builder setText(String text) { + this.text = OptionalValue.of(text); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + public SvamlInstructionSay build() { + return new SvamlInstructionSayImpl(name, text, locale); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmf.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmf.java new file mode 100644 index 000000000..9545e6215 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmf.java @@ -0,0 +1,89 @@ +/* + * 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.instruction; + +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; + +/** Plays DTMF tones in the call. */ +@JsonDeserialize(builder = SvamlInstructionSendDtmfImpl.Builder.class) +public interface SvamlInstructionSendDtmf + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** The name property. Must have the value sendDtmf. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum SEND_DTMF = new NameEnum("sendDtmf"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(SEND_DTMF)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * A string that determines the DTMF tones to play to the callee when the call is picked up. Valid + * characters are: 0-9, #, and w. w renders a + * 500ms pause. For example, the string ww1234#w#, plays a 1 second pause, the DTMF + * tones for 1, 2, 3, 4, and #, + * followed by a 500ms pause and finally the # tone. This is useful if the callout + * destination requires a conference PIN code or an extension. If there is a calling party, it + * will hear progress while the DTMF is sent. + * + * @return value + */ + String getValue(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionSendDtmfImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param value see getter + * @return Current builder + * @see #getValue + */ + Builder setValue(String value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionSendDtmf build(); + } +} 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 new file mode 100644 index 000000000..3e0d91a05 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfImpl.java @@ -0,0 +1,115 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({ + SvamlInstructionSendDtmfImpl.JSON_PROPERTY_NAME, + SvamlInstructionSendDtmfImpl.JSON_PROPERTY_VALUE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionSendDtmfImpl + implements SvamlInstructionSendDtmf, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_VALUE = "value"; + + private OptionalValue value; + + public SvamlInstructionSendDtmfImpl() {} + + protected SvamlInstructionSendDtmfImpl( + OptionalValue name, OptionalValue value) { + this.name = name; + this.value = value; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getValue() { + return value.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue value() { + return value; + } + + /** Return true if this svaml.instruction.sendDtmf object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionSendDtmfImpl svamlInstructionSendDtmf = (SvamlInstructionSendDtmfImpl) o; + return Objects.equals(this.name, svamlInstructionSendDtmf.name) + && Objects.equals(this.value, svamlInstructionSendDtmf.value); + } + + @Override + public int hashCode() { + return Objects.hash(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionSendDtmfImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 SvamlInstructionSendDtmf.Builder { + OptionalValue name = OptionalValue.of(NameEnum.SEND_DTMF); + OptionalValue value = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_VALUE) + public Builder setValue(String value) { + this.value = OptionalValue.of(value); + return this; + } + + public SvamlInstructionSendDtmf build() { + return new SvamlInstructionSendDtmfImpl(name, value); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookie.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookie.java new file mode 100644 index 000000000..a81f952c4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookie.java @@ -0,0 +1,99 @@ +/* + * 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.instruction; + +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; + +/** Creates a cookie for the duration of the call. */ +@JsonDeserialize(builder = SvamlInstructionSetCookieImpl.Builder.class) +public interface SvamlInstructionSetCookie + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** The name property. Must have the value setCookie. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum SET_COOKIE = new NameEnum("setCookie"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(SET_COOKIE)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The name of the cookie you want to set. + * + * @return key + */ + String getKey(); + + /** + * The value of the cookie you want to set. + * + * @return value + */ + String getValue(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionSetCookieImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param key see getter + * @return Current builder + * @see #getKey + */ + Builder setKey(String key); + + /** + * see getter + * + * @param value see getter + * @return Current builder + * @see #getValue + */ + Builder setValue(String value); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionSetCookie build(); + } +} 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 new file mode 100644 index 000000000..648da0506 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieImpl.java @@ -0,0 +1,141 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({ + SvamlInstructionSetCookieImpl.JSON_PROPERTY_NAME, + SvamlInstructionSetCookieImpl.JSON_PROPERTY_KEY, + SvamlInstructionSetCookieImpl.JSON_PROPERTY_VALUE +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionSetCookieImpl + implements SvamlInstructionSetCookie, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_KEY = "key"; + + private OptionalValue key; + + public static final String JSON_PROPERTY_VALUE = "value"; + + private OptionalValue value; + + public SvamlInstructionSetCookieImpl() {} + + protected SvamlInstructionSetCookieImpl( + OptionalValue name, OptionalValue key, OptionalValue value) { + this.name = name; + this.key = key; + this.value = value; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public String getKey() { + return key.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue key() { + return key; + } + + @JsonIgnore + public String getValue() { + return value.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue value() { + return value; + } + + /** Return true if this svaml.instruction.setCookie object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionSetCookieImpl svamlInstructionSetCookie = (SvamlInstructionSetCookieImpl) o; + return Objects.equals(this.name, svamlInstructionSetCookie.name) + && Objects.equals(this.key, svamlInstructionSetCookie.key) + && Objects.equals(this.value, svamlInstructionSetCookie.value); + } + + @Override + public int hashCode() { + return Objects.hash(name, key, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionSetCookieImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 SvamlInstructionSetCookie.Builder { + OptionalValue name = OptionalValue.of(NameEnum.SET_COOKIE); + OptionalValue key = OptionalValue.empty(); + OptionalValue value = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_KEY) + public Builder setKey(String key) { + this.key = OptionalValue.of(key); + return this; + } + + @JsonProperty(JSON_PROPERTY_VALUE) + public Builder setValue(String value) { + this.value = OptionalValue.of(value); + return this; + } + + public SvamlInstructionSetCookie build() { + return new SvamlInstructionSetCookieImpl(name, key, value); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecording.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecording.java new file mode 100644 index 000000000..565ed3026 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecording.java @@ -0,0 +1,83 @@ +/* + * 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.instruction; + +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; + +/** Starts a recording of the call. */ +@JsonDeserialize(builder = SvamlInstructionStartRecordingImpl.Builder.class) +public interface SvamlInstructionStartRecording + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** The name property. Must have the value startRecording. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum START_RECORDING = new NameEnum("startRecording"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(START_RECORDING)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get options + * + * @return options + */ + StartRecordingOptions getOptions(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionStartRecordingImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param options see getter + * @return Current builder + * @see #getOptions + */ + Builder setOptions(StartRecordingOptions options); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionStartRecording build(); + } +} 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 new file mode 100644 index 000000000..acbb08fd5 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingImpl.java @@ -0,0 +1,116 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({ + SvamlInstructionStartRecordingImpl.JSON_PROPERTY_NAME, + SvamlInstructionStartRecordingImpl.JSON_PROPERTY_OPTIONS +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionStartRecordingImpl + implements SvamlInstructionStartRecording, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + + private OptionalValue options; + + public SvamlInstructionStartRecordingImpl() {} + + protected SvamlInstructionStartRecordingImpl( + OptionalValue name, OptionalValue options) { + this.name = name; + this.options = options; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + @JsonIgnore + public StartRecordingOptions getOptions() { + return options.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue options() { + return options; + } + + /** Return true if this svaml.instruction.startRecording object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionStartRecordingImpl svamlInstructionStartRecording = + (SvamlInstructionStartRecordingImpl) o; + return Objects.equals(this.name, svamlInstructionStartRecording.name) + && Objects.equals(this.options, svamlInstructionStartRecording.options); + } + + @Override + public int hashCode() { + return Objects.hash(name, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionStartRecordingImpl {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).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 SvamlInstructionStartRecording.Builder { + OptionalValue name = OptionalValue.of(NameEnum.START_RECORDING); + OptionalValue options = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_OPTIONS) + public Builder setOptions(StartRecordingOptions options) { + this.options = OptionalValue.of(options); + return this; + } + + public SvamlInstructionStartRecording build() { + return new SvamlInstructionStartRecordingImpl(name, options); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecording.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecording.java new file mode 100644 index 000000000..ec7807e7a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecording.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.instruction; + +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; + +/** Stops the recording of the call. */ +@JsonDeserialize(builder = SvamlInstructionStopRecordingImpl.Builder.class) +public interface SvamlInstructionStopRecording + extends com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + + /** ready to use instruction to send a `stop recording` */ + SvamlInstructionStopRecording DEFAULT = SvamlInstructionStopRecording.builder().build(); + + /** The name property. Must have the value stopRecording. */ + public class NameEnum extends EnumDynamic { + public static final NameEnum STOP_RECORDING = new NameEnum("stopRecording"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>(NameEnum.class, NameEnum::new, Arrays.asList(STOP_RECORDING)); + + private NameEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static NameEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(NameEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new SvamlInstructionStopRecordingImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * Create instance + * + * @return The instance build with current builder values + */ + SvamlInstructionStopRecording build(); + } +} 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 new file mode 100644 index 000000000..177dbb240 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingImpl.java @@ -0,0 +1,87 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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({SvamlInstructionStopRecordingImpl.JSON_PROPERTY_NAME}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class SvamlInstructionStopRecordingImpl + implements SvamlInstructionStopRecording, + com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_NAME = "name"; + + private OptionalValue name; + + public SvamlInstructionStopRecordingImpl() {} + + protected SvamlInstructionStopRecordingImpl(OptionalValue name) { + this.name = name; + } + + @JsonIgnore + public NameEnum getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue name() { + return name; + } + + /** Return true if this svaml.instruction.stopRecording object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SvamlInstructionStopRecordingImpl svamlInstructionStopRecording = + (SvamlInstructionStopRecordingImpl) o; + return Objects.equals(this.name, svamlInstructionStopRecording.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SvamlInstructionStopRecordingImpl {\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 "); + } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements SvamlInstructionStopRecording.Builder { + OptionalValue name = OptionalValue.of(NameEnum.STOP_RECORDING); + + public SvamlInstructionStopRecording build() { + return new SvamlInstructionStopRecordingImpl(name); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptions.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptions.java new file mode 100644 index 000000000..a7805db7d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptions.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.instruction; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** TranscriptionOptions */ +@JsonDeserialize(builder = TranscriptionOptionsImpl.Builder.class) +public interface TranscriptionOptions { + + /** + * Get enabled + * + * @return enabled + */ + Boolean getEnabled(); + + /** + * Get locale + * + * @return locale + */ + String getLocale(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new TranscriptionOptionsImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param enabled see getter + * @return Current builder + * @see #getEnabled + */ + Builder setEnabled(Boolean enabled); + + /** + * see getter + * + * @param locale see getter + * @return Current builder + * @see #getLocale + */ + Builder setLocale(String locale); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + TranscriptionOptions build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptionsImpl.java similarity index 50% rename from openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto.java rename to openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptionsImpl.java index 42b1ad0bb..6000fb0ba 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/dto/v1/SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/TranscriptionOptionsImpl.java @@ -1,99 +1,58 @@ -/* - * Voice API | Sinch - * The Voice API exposes calling- and conference-related functionality in the Sinch Voice Platform. - * - * The version of the OpenAPI document: 1.0.1 - * 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.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; 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; -/** SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto */ @JsonPropertyOrder({ - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto.JSON_PROPERTY_ENABLED, - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto.JSON_PROPERTY_LOCALE + TranscriptionOptionsImpl.JSON_PROPERTY_ENABLED, + TranscriptionOptionsImpl.JSON_PROPERTY_LOCALE }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto { +public class TranscriptionOptionsImpl implements TranscriptionOptions { private static final long serialVersionUID = 1L; + public static final String JSON_PROPERTY_ENABLED = "enabled"; - private Boolean enabled; - private boolean enabledDefined = false; + + private OptionalValue enabled; public static final String JSON_PROPERTY_LOCALE = "locale"; - private String locale; - private boolean localeDefined = false; - public SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto() {} + private OptionalValue locale; - public SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto enabled(Boolean enabled) { - this.enabled = enabled; - this.enabledDefined = true; - return this; - } + public TranscriptionOptionsImpl() {} - /** - * Get enabled - * - * @return enabled - */ - @JsonProperty(JSON_PROPERTY_ENABLED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getEnabled() { - return enabled; + protected TranscriptionOptionsImpl(OptionalValue enabled, OptionalValue locale) { + this.enabled = enabled; + this.locale = locale; } @JsonIgnore - public boolean getEnabledDefined() { - return enabledDefined; + public Boolean getEnabled() { + return enabled.orElse(null); } @JsonProperty(JSON_PROPERTY_ENABLED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - this.enabledDefined = true; - } - - public SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto locale(String locale) { - this.locale = locale; - this.localeDefined = true; - return this; - } - - /** - * Get locale - * - * @return locale - */ - @JsonProperty(JSON_PROPERTY_LOCALE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getLocale() { - return locale; + public OptionalValue enabled() { + return enabled; } @JsonIgnore - public boolean getLocaleDefined() { - return localeDefined; + public String getLocale() { + return locale.orElse(null); } @JsonProperty(JSON_PROPERTY_LOCALE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setLocale(String locale) { - this.locale = locale; - this.localeDefined = true; + public OptionalValue locale() { + return locale; } /** @@ -108,9 +67,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto - svamlInstructionStartRecordingOptionsTranscriptionOptions = - (SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto) o; + TranscriptionOptionsImpl svamlInstructionStartRecordingOptionsTranscriptionOptions = + (TranscriptionOptionsImpl) o; return Objects.equals( this.enabled, svamlInstructionStartRecordingOptionsTranscriptionOptions.enabled) && Objects.equals( @@ -125,7 +83,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto {\n"); + sb.append("class TranscriptionOptionsImpl {\n"); sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); sb.append("}"); @@ -141,4 +99,26 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } + + @JsonPOJOBuilder(withPrefix = "set") + static class Builder implements TranscriptionOptions.Builder { + OptionalValue enabled = OptionalValue.empty(); + OptionalValue locale = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_ENABLED) + public Builder setEnabled(Boolean enabled) { + this.enabled = OptionalValue.of(enabled); + return this; + } + + @JsonProperty(JSON_PROPERTY_LOCALE) + public Builder setLocale(String locale) { + this.locale = OptionalValue.of(locale); + return this; + } + + public TranscriptionOptions build() { + return new TranscriptionOptionsImpl(enabled, locale); + } + } } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternal.java new file mode 100644 index 000000000..8db30ea58 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternal.java @@ -0,0 +1,16 @@ +/* + * 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.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = SvamlActionInternalImpl.SvamlActionInternalImplDeserializer.class) +public interface SvamlActionInternal {} 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 new file mode 100644 index 000000000..d986c11dc --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlActionInternalImpl.java @@ -0,0 +1,438 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.internal; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +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 com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectConferenceImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectMxpImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstnImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSipImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionContinueImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangupImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionParkImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenuImpl; +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 = SvamlActionInternalImpl.SvamlActionInternalImplDeserializer.class) +@JsonSerialize(using = SvamlActionInternalImpl.SvamlActionInternalImplSerializer.class) +public final class SvamlActionInternalImpl extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SvamlActionInternalImpl.class.getName()); + + public static final class SvamlActionInternalImplSerializer + extends StdSerializer { + private static final long serialVersionUID = 1L; + + public SvamlActionInternalImplSerializer(Class t) { + super(t); + } + + public SvamlActionInternalImplSerializer() { + this(null); + } + + @Override + public void serialize( + SvamlActionInternalImpl value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static final class SvamlActionInternalImplDeserializer + extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public SvamlActionInternalImplDeserializer() { + this(SvamlActionInternalImpl.class); + } + + public SvamlActionInternalImplDeserializer(Class vc) { + super(vc); + } + + @Override + public SvamlActionInternalImpl deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + Class cls = JSONNavigator.getClassForElement(tree, SvamlActionInternalImpl.class); + if (cls != null) { + // When the OAS schema includes a discriminator, use the discriminator value to + // discriminate the anyOf schemas. + // Get the discriminator mapping value to get the class. + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } + // deserialize SvamlActionConnectConferenceImpl + try { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectConferenceImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionConnectMxpImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectMxpImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionConnectPstnImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectPstnImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionConnectSipImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionConnectSipImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionContinueImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionContinueImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionHangupImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionHangupImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionParkImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionParkImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + // deserialize SvamlActionRunMenuImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlActionRunMenuImpl.class); + SvamlActionInternalImpl ret = new SvamlActionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlActionInternalImpl'", e); + } + + throw new IOException( + String.format("Failed deserialization for SvamlActionInternalImpl: no match found")); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SvamlActionInternalImpl getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SvamlActionInternalImpl cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public SvamlActionInternalImpl() { + super("anyOf", Boolean.FALSE); + } + + public SvamlActionInternalImpl(SvamlActionConnectConferenceImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionConnectMxpImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionConnectPstnImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionConnectSipImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionContinueImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionHangupImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionParkImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlActionInternalImpl(SvamlActionRunMenuImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SvamlActionConnectConferenceImpl", SvamlActionConnectConferenceImpl.class); + schemas.put("SvamlActionConnectMxpImpl", SvamlActionConnectMxpImpl.class); + schemas.put("SvamlActionConnectPstnImpl", SvamlActionConnectPstnImpl.class); + schemas.put("SvamlActionConnectSipImpl", SvamlActionConnectSipImpl.class); + schemas.put("SvamlActionContinueImpl", SvamlActionContinueImpl.class); + schemas.put("SvamlActionHangupImpl", SvamlActionHangupImpl.class); + schemas.put("SvamlActionParkImpl", SvamlActionParkImpl.class); + schemas.put("SvamlActionRunMenuImpl", SvamlActionRunMenuImpl.class); + JSONNavigator.registerDescendants( + SvamlActionInternalImpl.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("connectConf", SvamlActionConnectConferenceImpl.class); + mappings.put("connectMxp", SvamlActionConnectMxpImpl.class); + mappings.put("connectPstn", SvamlActionConnectPstnImpl.class); + mappings.put("connectSip", SvamlActionConnectSipImpl.class); + mappings.put("continue", SvamlActionContinueImpl.class); + 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.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); + } + + @Override + public Map> getSchemas() { + return SvamlActionInternalImpl.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: SvamlActionConnectConferenceImpl, SvamlActionConnectMxpImpl, + * SvamlActionConnectPstnImpl, SvamlActionConnectSipImpl, SvamlActionContinueImpl, + * SvamlActionHangupImpl, SvamlActionParkImpl, SvamlActionRunMenuImpl + * + *

It could be an instance of the 'anyOf' schemas. The anyOf child schemas may themselves be a + * composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSONNavigator.isInstanceOf( + SvamlActionConnectConferenceImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionConnectMxpImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionConnectPstnImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionConnectSipImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionContinueImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionHangupImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf(SvamlActionParkImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlActionRunMenuImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be SvamlActionConnectConferenceImpl," + + " SvamlActionConnectMxpImpl, SvamlActionConnectPstnImpl, SvamlActionConnectSipImpl," + + " SvamlActionContinueImpl, SvamlActionHangupImpl, SvamlActionParkImpl," + + " SvamlActionRunMenuImpl"); + } + + /** + * Get the actual instance, which can be the following: SvamlActionConnectConferenceImpl, + * SvamlActionConnectMxpImpl, SvamlActionConnectPstnImpl, SvamlActionConnectSipImpl, + * SvamlActionContinueImpl, SvamlActionHangupImpl, SvamlActionParkImpl, SvamlActionRunMenuImpl + * + * @return The actual instance (SvamlActionConnectConferenceImpl, SvamlActionConnectMxpImpl, + * SvamlActionConnectPstnImpl, SvamlActionConnectSipImpl, SvamlActionContinueImpl, + * SvamlActionHangupImpl, SvamlActionParkImpl, SvamlActionRunMenuImpl) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionConnectConferenceImpl`. If the actual instance is not + * `SvamlActionConnectConferenceImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionConnectConferenceImpl` + * @throws ClassCastException if the instance is not `SvamlActionConnectConferenceImpl` + */ + public SvamlActionConnectConferenceImpl getSvamlActionConnectConferenceImpl() + throws ClassCastException { + return (SvamlActionConnectConferenceImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionConnectMxpImpl`. If the actual instance is not + * `SvamlActionConnectMxpImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionConnectMxpImpl` + * @throws ClassCastException if the instance is not `SvamlActionConnectMxpImpl` + */ + public SvamlActionConnectMxpImpl getSvamlActionConnectMxpImpl() throws ClassCastException { + return (SvamlActionConnectMxpImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionConnectPstnImpl`. If the actual instance is not + * `SvamlActionConnectPstnImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionConnectPstnImpl` + * @throws ClassCastException if the instance is not `SvamlActionConnectPstnImpl` + */ + public SvamlActionConnectPstnImpl getSvamlActionConnectPstnImpl() throws ClassCastException { + return (SvamlActionConnectPstnImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionConnectSipImpl`. If the actual instance is not + * `SvamlActionConnectSipImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionConnectSipImpl` + * @throws ClassCastException if the instance is not `SvamlActionConnectSipImpl` + */ + public SvamlActionConnectSipImpl getSvamlActionConnectSipImpl() throws ClassCastException { + return (SvamlActionConnectSipImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionContinueImpl`. If the actual instance is not + * `SvamlActionContinueImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionContinueImpl` + * @throws ClassCastException if the instance is not `SvamlActionContinueImpl` + */ + public SvamlActionContinueImpl getSvamlActionContinueImpl() throws ClassCastException { + return (SvamlActionContinueImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionHangupImpl`. If the actual instance is not + * `SvamlActionHangupImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionHangupImpl` + * @throws ClassCastException if the instance is not `SvamlActionHangupImpl` + */ + public SvamlActionHangupImpl getSvamlActionHangupImpl() throws ClassCastException { + return (SvamlActionHangupImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionParkImpl`. If the actual instance is not + * `SvamlActionParkImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionParkImpl` + * @throws ClassCastException if the instance is not `SvamlActionParkImpl` + */ + public SvamlActionParkImpl getSvamlActionParkImpl() throws ClassCastException { + return (SvamlActionParkImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlActionRunMenuImpl`. If the actual instance is not + * `SvamlActionRunMenuImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlActionRunMenuImpl` + * @throws ClassCastException if the instance is not `SvamlActionRunMenuImpl` + */ + public SvamlActionRunMenuImpl getSvamlActionRunMenuImpl() throws ClassCastException { + return (SvamlActionRunMenuImpl) super.getActualInstance(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternal.java new file mode 100644 index 000000000..5e7b99615 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternal.java @@ -0,0 +1,17 @@ +/* + * 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.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize( + using = SvamlInstructionInternalImpl.SvamlInstructionInternalImplDeserializer.class) +public interface SvamlInstructionInternal {} 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 new file mode 100644 index 000000000..941ff3e1b --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/svaml/internal/SvamlInstructionInternalImpl.java @@ -0,0 +1,411 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.internal; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +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 com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionAnswerImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionPlayFilesImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSayImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSendDtmfImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSetCookieImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecordingImpl; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStopRecordingImpl; +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 = SvamlInstructionInternalImpl.SvamlInstructionInternalImplDeserializer.class) +@JsonSerialize(using = SvamlInstructionInternalImpl.SvamlInstructionInternalImplSerializer.class) +public final class SvamlInstructionInternalImpl extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(SvamlInstructionInternalImpl.class.getName()); + + public static final class SvamlInstructionInternalImplSerializer + extends StdSerializer { + private static final long serialVersionUID = 1L; + + public SvamlInstructionInternalImplSerializer(Class t) { + super(t); + } + + public SvamlInstructionInternalImplSerializer() { + this(null); + } + + @Override + public void serialize( + SvamlInstructionInternalImpl value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static final class SvamlInstructionInternalImplDeserializer + extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public SvamlInstructionInternalImplDeserializer() { + this(SvamlInstructionInternalImpl.class); + } + + public SvamlInstructionInternalImplDeserializer(Class vc) { + super(vc); + } + + @Override + public SvamlInstructionInternalImpl deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + Class cls = JSONNavigator.getClassForElement(tree, SvamlInstructionInternalImpl.class); + if (cls != null) { + // When the OAS schema includes a discriminator, use the discriminator value to + // discriminate the anyOf schemas. + // Get the discriminator mapping value to get the class. + deserialized = tree.traverse(jp.getCodec()).readValueAs(cls); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } + // deserialize SvamlInstructionAnswerImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionAnswerImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionPlayFilesImpl + try { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionPlayFilesImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionSayImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSayImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionSendDtmfImpl + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSendDtmfImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionSetCookieImpl + try { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionSetCookieImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionStartRecordingImpl + try { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionStartRecordingImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + // deserialize SvamlInstructionStopRecordingImpl + try { + deserialized = + tree.traverse(jp.getCodec()).readValueAs(SvamlInstructionStopRecordingImpl.class); + SvamlInstructionInternalImpl ret = new SvamlInstructionInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'SvamlInstructionInternalImpl'", e); + } + + throw new IOException( + String.format("Failed deserialization for SvamlInstructionInternalImpl: no match found")); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SvamlInstructionInternalImpl getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "SvamlInstructionInternalImpl cannot be null"); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public SvamlInstructionInternalImpl() { + super("anyOf", Boolean.FALSE); + } + + public SvamlInstructionInternalImpl(SvamlInstructionAnswerImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionPlayFilesImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionSayImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionSendDtmfImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionSetCookieImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionStartRecordingImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public SvamlInstructionInternalImpl(SvamlInstructionStopRecordingImpl o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("SvamlInstructionAnswerImpl", SvamlInstructionAnswerImpl.class); + schemas.put("SvamlInstructionPlayFilesImpl", SvamlInstructionPlayFilesImpl.class); + schemas.put("SvamlInstructionSayImpl", SvamlInstructionSayImpl.class); + schemas.put("SvamlInstructionSendDtmfImpl", SvamlInstructionSendDtmfImpl.class); + schemas.put("SvamlInstructionSetCookieImpl", SvamlInstructionSetCookieImpl.class); + schemas.put("SvamlInstructionStartRecordingImpl", SvamlInstructionStartRecordingImpl.class); + schemas.put("SvamlInstructionStopRecordingImpl", SvamlInstructionStopRecordingImpl.class); + JSONNavigator.registerDescendants( + SvamlInstructionInternalImpl.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("answer", SvamlInstructionAnswerImpl.class); + mappings.put("playFiles", SvamlInstructionPlayFilesImpl.class); + mappings.put("say", SvamlInstructionSayImpl.class); + mappings.put("sendDtmf", SvamlInstructionSendDtmfImpl.class); + 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); + } + + @Override + public Map> getSchemas() { + return SvamlInstructionInternalImpl.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: SvamlInstructionAnswerImpl, SvamlInstructionPlayFilesImpl, + * SvamlInstructionSayImpl, SvamlInstructionSendDtmfImpl, SvamlInstructionSetCookieImpl, + * SvamlInstructionStartRecordingImpl, SvamlInstructionStopRecordingImpl + * + *

It could be an instance of the 'anyOf' schemas. The anyOf child schemas may themselves be a + * composed schema (allOf, anyOf, anyOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSONNavigator.isInstanceOf( + SvamlInstructionAnswerImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionPlayFilesImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionSayImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionSendDtmfImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionSetCookieImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionStartRecordingImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + SvamlInstructionStopRecordingImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be SvamlInstructionAnswerImpl, SvamlInstructionPlayFilesImpl," + + " SvamlInstructionSayImpl, SvamlInstructionSendDtmfImpl," + + " SvamlInstructionSetCookieImpl, SvamlInstructionStartRecordingImpl," + + " SvamlInstructionStopRecordingImpl"); + } + + /** + * Get the actual instance, which can be the following: SvamlInstructionAnswerImpl, + * SvamlInstructionPlayFilesImpl, SvamlInstructionSayImpl, SvamlInstructionSendDtmfImpl, + * SvamlInstructionSetCookieImpl, SvamlInstructionStartRecordingImpl, + * SvamlInstructionStopRecordingImpl + * + * @return The actual instance (SvamlInstructionAnswerImpl, SvamlInstructionPlayFilesImpl, + * SvamlInstructionSayImpl, SvamlInstructionSendDtmfImpl, SvamlInstructionSetCookieImpl, + * SvamlInstructionStartRecordingImpl, SvamlInstructionStopRecordingImpl) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionAnswerImpl`. If the actual instance is not + * `SvamlInstructionAnswerImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionAnswerImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionAnswerImpl` + */ + public SvamlInstructionAnswerImpl getSvamlInstructionAnswerImpl() throws ClassCastException { + return (SvamlInstructionAnswerImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionPlayFilesImpl`. If the actual instance is not + * `SvamlInstructionPlayFilesImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionPlayFilesImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionPlayFilesImpl` + */ + public SvamlInstructionPlayFilesImpl getSvamlInstructionPlayFilesImpl() + throws ClassCastException { + return (SvamlInstructionPlayFilesImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionSayImpl`. If the actual instance is not + * `SvamlInstructionSayImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionSayImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionSayImpl` + */ + public SvamlInstructionSayImpl getSvamlInstructionSayImpl() throws ClassCastException { + return (SvamlInstructionSayImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionSendDtmfImpl`. If the actual instance is not + * `SvamlInstructionSendDtmfImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionSendDtmfImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionSendDtmfImpl` + */ + public SvamlInstructionSendDtmfImpl getSvamlInstructionSendDtmfImpl() throws ClassCastException { + return (SvamlInstructionSendDtmfImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionSetCookieImpl`. If the actual instance is not + * `SvamlInstructionSetCookieImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionSetCookieImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionSetCookieImpl` + */ + public SvamlInstructionSetCookieImpl getSvamlInstructionSetCookieImpl() + throws ClassCastException { + return (SvamlInstructionSetCookieImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionStartRecordingImpl`. If the actual instance is not + * `SvamlInstructionStartRecordingImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionStartRecordingImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionStartRecordingImpl` + */ + public SvamlInstructionStartRecordingImpl getSvamlInstructionStartRecordingImpl() + throws ClassCastException { + return (SvamlInstructionStartRecordingImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `SvamlInstructionStopRecordingImpl`. If the actual instance is not + * `SvamlInstructionStopRecordingImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `SvamlInstructionStopRecordingImpl` + * @throws ClassCastException if the instance is not `SvamlInstructionStopRecordingImpl` + */ + public SvamlInstructionStopRecordingImpl getSvamlInstructionStopRecordingImpl() + throws ClassCastException { + return (SvamlInstructionStopRecordingImpl) super.getActualInstance(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEvent.java new file mode 100644 index 000000000..7bbea8eba --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEvent.java @@ -0,0 +1,133 @@ +/* + * 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.webhooks; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.time.Instant; +import java.util.Arrays; +import java.util.stream.Stream; + +/** The request body of an Answered Call Event. */ +@JsonDeserialize(builder = AnsweredCallEventImpl.Builder.class) +public interface AnsweredCallEvent extends VoiceWebhookEvent, VoiceWebhookCallEvent { + + /** + * The timestamp in UTC format. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * The unique application key. You can find it in the Sinch dashboard. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** Must have the value ace. */ + public class WebhooksEventRequestType extends EnumDynamic { + public static final WebhooksEventRequestType ACE = new WebhooksEventRequestType("ace"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WebhooksEventRequestType.class, WebhooksEventRequestType::new, Arrays.asList(ACE)); + + private WebhooksEventRequestType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WebhooksEventRequestType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WebhooksEventRequestType e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * Get amd + * + * @return amd + */ + AnsweredCallEventAnsweringMachineDetection getAmd(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new AnsweredCallEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends VoiceWebhookEvent.Builder, VoiceWebhookCallEvent.Builder { + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param amd see getter + * @return Current builder + * @see #getAmd + */ + Builder setAmd(AnsweredCallEventAnsweringMachineDetection amd); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + AnsweredCallEvent build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java new file mode 100644 index 000000000..3c9a399a4 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetection.java @@ -0,0 +1,148 @@ +/* + * 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.webhooks; + +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; + +/** + * If Answering Machine + * Detection (AMD) is enabled, this object contains information about whether the call was + * answered by a machine. + */ +@JsonDeserialize(builder = AnsweredCallEventAnsweringMachineDetectionImpl.Builder.class) +public interface AnsweredCallEventAnsweringMachineDetection { + + /** The determination by the system of who answered the call. */ + public class StatusEnum extends EnumDynamic { + public static final StatusEnum MACHINE = new StatusEnum("machine"); + public static final StatusEnum HUMAN = new StatusEnum("human"); + public static final StatusEnum NOTSURE = new StatusEnum("notsure"); + public static final StatusEnum HANGUP = new StatusEnum("hangup"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + StatusEnum.class, StatusEnum::new, Arrays.asList(MACHINE, HUMAN, NOTSURE, HANGUP)); + + private StatusEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static StatusEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(StatusEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The determination by the system of who answered the call. + * + * @return status + */ + StatusEnum getStatus(); + + /** The reason that the system used to determine who answered the call. */ + public class ReasonEnum extends EnumDynamic { + public static final ReasonEnum LONGGREETING = new ReasonEnum("longgreeting"); + public static final ReasonEnum INITIALSILENCE = new ReasonEnum("initialsilence"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + ReasonEnum.class, ReasonEnum::new, Arrays.asList(LONGGREETING, INITIALSILENCE)); + + private ReasonEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static ReasonEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(ReasonEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The reason that the system used to determine who answered the call. + * + * @return reason + */ + ReasonEnum getReason(); + + /** + * The length of the call. + * + * @return duration + */ + Integer getDuration(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new AnsweredCallEventAnsweringMachineDetectionImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param status see getter + * @return Current builder + * @see #getStatus + */ + Builder setStatus(StatusEnum status); + + /** + * see getter + * + * @param reason see getter + * @return Current builder + * @see #getReason + */ + Builder setReason(ReasonEnum reason); + + /** + * see getter + * + * @param duration see getter + * @return Current builder + * @see #getDuration + */ + Builder setDuration(Integer duration); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + AnsweredCallEventAnsweringMachineDetection build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java new file mode 100644 index 000000000..2d650aaa3 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventAnsweringMachineDetectionImpl.java @@ -0,0 +1,149 @@ +package com.sinch.sdk.domains.voice.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 java.util.Objects; + +@JsonPropertyOrder({ + AnsweredCallEventAnsweringMachineDetectionImpl.JSON_PROPERTY_STATUS, + AnsweredCallEventAnsweringMachineDetectionImpl.JSON_PROPERTY_REASON, + AnsweredCallEventAnsweringMachineDetectionImpl.JSON_PROPERTY_DURATION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class AnsweredCallEventAnsweringMachineDetectionImpl + implements AnsweredCallEventAnsweringMachineDetection { + private static final long serialVersionUID = 1L; + + 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_DURATION = "duration"; + + private OptionalValue duration; + + public AnsweredCallEventAnsweringMachineDetectionImpl() {} + + protected AnsweredCallEventAnsweringMachineDetectionImpl( + OptionalValue status, + OptionalValue reason, + OptionalValue duration) { + this.status = status; + this.reason = reason; + this.duration = duration; + } + + @JsonIgnore + public StatusEnum getStatus() { + return status.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue status() { + return status; + } + + @JsonIgnore + public ReasonEnum getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reason() { + return reason; + } + + @JsonIgnore + public Integer getDuration() { + return duration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue duration() { + return duration; + } + + /** Return true if this aceRequest_allOf_amd object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnsweredCallEventAnsweringMachineDetectionImpl aceRequestAllOfAmd = + (AnsweredCallEventAnsweringMachineDetectionImpl) o; + return Objects.equals(this.status, aceRequestAllOfAmd.status) + && Objects.equals(this.reason, aceRequestAllOfAmd.reason) + && Objects.equals(this.duration, aceRequestAllOfAmd.duration); + } + + @Override + public int hashCode() { + return Objects.hash(status, reason, duration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnsweredCallEventAnsweringMachineDetectionImpl {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).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 AnsweredCallEventAnsweringMachineDetection.Builder { + OptionalValue status = OptionalValue.empty(); + OptionalValue reason = OptionalValue.empty(); + OptionalValue duration = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_STATUS) + public Builder setStatus(StatusEnum status) { + this.status = OptionalValue.of(status); + return this; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public Builder setReason(ReasonEnum reason) { + this.reason = OptionalValue.of(reason); + return this; + } + + @JsonProperty(JSON_PROPERTY_DURATION) + public Builder setDuration(Integer duration) { + this.duration = OptionalValue.of(duration); + return this; + } + + public AnsweredCallEventAnsweringMachineDetection build() { + return new AnsweredCallEventAnsweringMachineDetectionImpl(status, reason, duration); + } + } +} 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 new file mode 100644 index 000000000..a0c30bf37 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/AnsweredCallEventImpl.java @@ -0,0 +1,263 @@ +package com.sinch.sdk.domains.voice.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 java.time.Instant; +import java.util.Objects; + +@JsonPropertyOrder({ + AnsweredCallEventImpl.JSON_PROPERTY_TIMESTAMP, + AnsweredCallEventImpl.JSON_PROPERTY_CUSTOM, + AnsweredCallEventImpl.JSON_PROPERTY_APPLICATION_KEY, + AnsweredCallEventImpl.JSON_PROPERTY_EVENT, + AnsweredCallEventImpl.JSON_PROPERTY_AMD, + AnsweredCallEventImpl.JSON_PROPERTY_CALLID, + AnsweredCallEventImpl.JSON_PROPERTY_VERSION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) + +/*@JsonIgnoreProperties( + value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the event to be set during deserialization +)*/ +/*@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "event", visible = true) + */ + +public class AnsweredCallEventImpl + implements AnsweredCallEvent, VoiceWebhookEvent, VoiceWebhookCallEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + + private OptionalValue timestamp; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_AMD = "amd"; + + private OptionalValue amd; + + public static final String JSON_PROPERTY_CALLID = "callid"; + + private OptionalValue callid; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public AnsweredCallEventImpl() {} + + protected AnsweredCallEventImpl( + OptionalValue timestamp, + OptionalValue custom, + OptionalValue applicationKey, + OptionalValue event, + OptionalValue amd, + OptionalValue callid, + OptionalValue version) { + this.timestamp = timestamp; + this.custom = custom; + this.applicationKey = applicationKey; + this.event = event; + this.amd = amd; + this.callid = callid; + this.version = version; + } + + @JsonIgnore + public Instant getTimestamp() { + return timestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timestamp() { + return timestamp; + } + + @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 String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public WebhooksEventRequestType getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public AnsweredCallEventAnsweringMachineDetection getAmd() { + return amd.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AMD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue amd() { + return amd; + } + + @JsonIgnore + public String getCallid() { + return callid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callid() { + return callid; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + /** Return true if this aceRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnsweredCallEventImpl aceRequest = (AnsweredCallEventImpl) o; + return Objects.equals(this.timestamp, aceRequest.timestamp) + && Objects.equals(this.custom, aceRequest.custom) + && Objects.equals(this.applicationKey, aceRequest.applicationKey) + && Objects.equals(this.event, aceRequest.event) + && Objects.equals(this.amd, aceRequest.amd) + && Objects.equals(this.callid, aceRequest.callid) + && Objects.equals(this.version, aceRequest.version) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash( + timestamp, custom, applicationKey, event, amd, callid, version, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnsweredCallEventImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" amd: ").append(toIndentedString(amd)).append("\n"); + sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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 AnsweredCallEvent.Builder { + OptionalValue timestamp = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(WebhooksEventRequestType.ACE); + OptionalValue amd = OptionalValue.empty(); + OptionalValue callid = OptionalValue.empty(); + OptionalValue version = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + public Builder setTimestamp(Instant timestamp) { + this.timestamp = OptionalValue.of(timestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_AMD) + public Builder setAmd(AnsweredCallEventAnsweringMachineDetection amd) { + this.amd = OptionalValue.of(amd); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLID) + public Builder setCallid(String callid) { + this.callid = OptionalValue.of(callid); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + public AnsweredCallEvent build() { + return new AnsweredCallEventImpl( + timestamp, custom, applicationKey, event, amd, callid, version); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEvent.java new file mode 100644 index 000000000..75a77c0ad --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEvent.java @@ -0,0 +1,300 @@ +/* + * 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.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.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.Destination; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +/** The request body of a Disconnected Call Event. */ +@JsonDeserialize(builder = DisconnectedCallEventImpl.Builder.class) +public interface DisconnectedCallEvent extends VoiceWebhookEvent, VoiceWebhookCallEvent { + + /** + * The timestamp in UTC format. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * The unique application key. You can find it in the Sinch dashboard. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** Must have the value dice. */ + public class WebhooksEventRequestType extends EnumDynamic { + public static final WebhooksEventRequestType DICE = new WebhooksEventRequestType("dice"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WebhooksEventRequestType.class, WebhooksEventRequestType::new, Arrays.asList(DICE)); + + private WebhooksEventRequestType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WebhooksEventRequestType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WebhooksEventRequestType e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** The reason the call was disconnected. */ + public class ReasonEnum extends EnumDynamic { + public static final ReasonEnum N_A = new ReasonEnum("N/A"); + public static final ReasonEnum TIMEOUT = new ReasonEnum("TIMEOUT"); + public static final ReasonEnum CALLERHANGUP = new ReasonEnum("CALLERHANGUP"); + public static final ReasonEnum CALLEEHANGUP = new ReasonEnum("CALLEEHANGUP"); + public static final ReasonEnum BLOCKED = new ReasonEnum("BLOCKED"); + public static final ReasonEnum MANAGERHANGUP = new ReasonEnum("MANAGERHANGUP"); + public static final ReasonEnum NOCREDITPARTNER = new ReasonEnum("NOCREDITPARTNER"); + public static final ReasonEnum GENERALERROR = new ReasonEnum("GENERALERROR"); + public static final ReasonEnum CANCEL = new ReasonEnum("CANCEL"); + public static final ReasonEnum USERNOTFOUND = new ReasonEnum("USERNOTFOUND"); + public static final ReasonEnum CALLBACKERROR = new ReasonEnum("CALLBACKERROR"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + ReasonEnum.class, + ReasonEnum::new, + Arrays.asList( + N_A, + TIMEOUT, + CALLERHANGUP, + CALLEEHANGUP, + BLOCKED, + MANAGERHANGUP, + NOCREDITPARTNER, + GENERALERROR, + CANCEL, + USERNOTFOUND, + CALLBACKERROR)); + + private ReasonEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static ReasonEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(ReasonEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The reason the call was disconnected. + * + * @return reason + */ + ReasonEnum getReason(); + + /** + * Get result + * + * @return result + */ + CallResult getResult(); + + /** + * Get debit + * + * @return debit + */ + Price getDebit(); + + /** + * Get userRate + * + * @return userRate + */ + Price getUserRate(); + + /** + * Get to + * + * @return to + */ + Destination getTo(); + + /** + * The duration of the call in seconds. + * + * @return duration + */ + Integer getDuration(); + + /** + * Information about the initiator of the call. + * + * @return from + */ + String getFrom(); + + /** + * If the call was initiated by a Sinch SDK client, call headers are the headers specified by the + * caller client. Read more about call headers here. + * + * @return callHeaders + */ + List getCallHeaders(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new DisconnectedCallEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends VoiceWebhookEvent.Builder, VoiceWebhookCallEvent.Builder { + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param reason see getter + * @return Current builder + * @see #getReason + */ + Builder setReason(ReasonEnum reason); + + /** + * see getter + * + * @param result see getter + * @return Current builder + * @see #getResult + */ + Builder setResult(CallResult result); + + /** + * see getter + * + * @param debit see getter + * @return Current builder + * @see #getDebit + */ + Builder setDebit(Price debit); + + /** + * see getter + * + * @param userRate see getter + * @return Current builder + * @see #getUserRate + */ + Builder setUserRate(Price userRate); + + /** + * see getter + * + * @param to see getter + * @return Current builder + * @see #getTo + */ + Builder setTo(Destination to); + + /** + * see getter + * + * @param duration see getter + * @return Current builder + * @see #getDuration + */ + Builder setDuration(Integer duration); + + /** + * see getter + * + * @param from see getter + * @return Current builder + * @see #getFrom + */ + Builder setFrom(String from); + + /** + * see getter + * + * @param callHeaders see getter + * @return Current builder + * @see #getCallHeaders + */ + Builder setCallHeaders(List callHeaders); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + DisconnectedCallEvent build(); + } +} 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 new file mode 100644 index 000000000..d04f53ff0 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/DisconnectedCallEventImpl.java @@ -0,0 +1,484 @@ +package com.sinch.sdk.domains.voice.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.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.Destination; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import java.time.Instant; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({ + DisconnectedCallEventImpl.JSON_PROPERTY_TIMESTAMP, + DisconnectedCallEventImpl.JSON_PROPERTY_CUSTOM, + DisconnectedCallEventImpl.JSON_PROPERTY_APPLICATION_KEY, + DisconnectedCallEventImpl.JSON_PROPERTY_EVENT, + DisconnectedCallEventImpl.JSON_PROPERTY_REASON, + DisconnectedCallEventImpl.JSON_PROPERTY_RESULT, + DisconnectedCallEventImpl.JSON_PROPERTY_DEBIT, + DisconnectedCallEventImpl.JSON_PROPERTY_USER_RATE, + DisconnectedCallEventImpl.JSON_PROPERTY_TO, + DisconnectedCallEventImpl.JSON_PROPERTY_DURATION, + DisconnectedCallEventImpl.JSON_PROPERTY_FROM, + DisconnectedCallEventImpl.JSON_PROPERTY_CALL_HEADERS, + DisconnectedCallEventImpl.JSON_PROPERTY_CALLID, + DisconnectedCallEventImpl.JSON_PROPERTY_VERSION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) + +/*@JsonIgnoreProperties( + value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the event to be set during deserialization +)*/ +/*@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "event", visible = true) + */ + +public class DisconnectedCallEventImpl + implements DisconnectedCallEvent, VoiceWebhookEvent, VoiceWebhookCallEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + + private OptionalValue timestamp; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_REASON = "reason"; + + private OptionalValue reason; + + public static final String JSON_PROPERTY_RESULT = "result"; + + private OptionalValue result; + + public static final String JSON_PROPERTY_DEBIT = "debit"; + + private OptionalValue debit; + + public static final String JSON_PROPERTY_USER_RATE = "userRate"; + + private OptionalValue userRate; + + public static final String JSON_PROPERTY_TO = "to"; + + private OptionalValue to; + + public static final String JSON_PROPERTY_DURATION = "duration"; + + private OptionalValue duration; + + public static final String JSON_PROPERTY_FROM = "from"; + + private OptionalValue from; + + public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; + + private OptionalValue> callHeaders; + + public static final String JSON_PROPERTY_CALLID = "callid"; + + private OptionalValue callid; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public DisconnectedCallEventImpl() {} + + protected DisconnectedCallEventImpl( + OptionalValue timestamp, + OptionalValue custom, + OptionalValue applicationKey, + OptionalValue event, + OptionalValue reason, + OptionalValue result, + OptionalValue debit, + OptionalValue userRate, + OptionalValue to, + OptionalValue duration, + OptionalValue from, + OptionalValue> callHeaders, + OptionalValue callid, + OptionalValue version) { + this.timestamp = timestamp; + this.custom = custom; + this.applicationKey = applicationKey; + this.event = event; + this.reason = reason; + this.result = result; + this.debit = debit; + this.userRate = userRate; + this.to = to; + this.duration = duration; + this.from = from; + this.callHeaders = callHeaders; + this.callid = callid; + this.version = version; + } + + @JsonIgnore + public Instant getTimestamp() { + return timestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timestamp() { + return timestamp; + } + + @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 String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public WebhooksEventRequestType getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public ReasonEnum getReason() { + return reason.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue reason() { + return reason; + } + + @JsonIgnore + public CallResult getResult() { + return result.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue result() { + return result; + } + + @JsonIgnore + public Price getDebit() { + return debit.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEBIT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue debit() { + return debit; + } + + @JsonIgnore + public Price getUserRate() { + return userRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue userRate() { + return userRate; + } + + @JsonIgnore + public Destination getTo() { + return to.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue to() { + return to; + } + + @JsonIgnore + public Integer getDuration() { + return duration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue duration() { + return duration; + } + + @JsonIgnore + public String getFrom() { + return from.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue from() { + return from; + } + + @JsonIgnore + public List getCallHeaders() { + return callHeaders.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> callHeaders() { + return callHeaders; + } + + @JsonIgnore + public String getCallid() { + return callid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callid() { + return callid; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + /** Return true if this diceRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisconnectedCallEventImpl diceRequest = (DisconnectedCallEventImpl) o; + return Objects.equals(this.timestamp, diceRequest.timestamp) + && Objects.equals(this.custom, diceRequest.custom) + && Objects.equals(this.applicationKey, diceRequest.applicationKey) + && Objects.equals(this.event, diceRequest.event) + && Objects.equals(this.reason, diceRequest.reason) + && Objects.equals(this.result, diceRequest.result) + && Objects.equals(this.debit, diceRequest.debit) + && Objects.equals(this.userRate, diceRequest.userRate) + && Objects.equals(this.to, diceRequest.to) + && Objects.equals(this.duration, diceRequest.duration) + && Objects.equals(this.from, diceRequest.from) + && Objects.equals(this.callHeaders, diceRequest.callHeaders) + && Objects.equals(this.callid, diceRequest.callid) + && Objects.equals(this.version, diceRequest.version) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash( + timestamp, + custom, + applicationKey, + event, + reason, + result, + debit, + userRate, + to, + duration, + from, + callHeaders, + callid, + version, + super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisconnectedCallEventImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" debit: ").append(toIndentedString(debit)).append("\n"); + sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).append("\n"); + sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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 DisconnectedCallEvent.Builder { + OptionalValue timestamp = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(WebhooksEventRequestType.DICE); + OptionalValue reason = OptionalValue.empty(); + OptionalValue result = OptionalValue.empty(); + OptionalValue debit = OptionalValue.empty(); + OptionalValue userRate = OptionalValue.empty(); + OptionalValue to = OptionalValue.empty(); + OptionalValue duration = OptionalValue.empty(); + OptionalValue from = OptionalValue.empty(); + OptionalValue> callHeaders = OptionalValue.empty(); + OptionalValue callid = OptionalValue.empty(); + OptionalValue version = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + public Builder setTimestamp(Instant timestamp) { + this.timestamp = OptionalValue.of(timestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_REASON) + public Builder setReason(ReasonEnum reason) { + this.reason = OptionalValue.of(reason); + return this; + } + + @JsonProperty(JSON_PROPERTY_RESULT) + public Builder setResult(CallResult result) { + this.result = OptionalValue.of(result); + return this; + } + + @JsonProperty(JSON_PROPERTY_DEBIT) + public Builder setDebit(Price debit) { + this.debit = OptionalValue.of(debit); + return this; + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + public Builder setUserRate(Price userRate) { + this.userRate = OptionalValue.of(userRate); + return this; + } + + @JsonProperty(JSON_PROPERTY_TO) + public Builder setTo(Destination to) { + this.to = OptionalValue.of(to); + return this; + } + + @JsonProperty(JSON_PROPERTY_DURATION) + public Builder setDuration(Integer duration) { + this.duration = OptionalValue.of(duration); + return this; + } + + @JsonProperty(JSON_PROPERTY_FROM) + public Builder setFrom(String from) { + this.from = OptionalValue.of(from); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + public Builder setCallHeaders(List callHeaders) { + this.callHeaders = OptionalValue.of(callHeaders); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLID) + public Builder setCallid(String callid) { + this.callid = OptionalValue.of(callid); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + public DisconnectedCallEvent build() { + return new DisconnectedCallEventImpl( + timestamp, + custom, + applicationKey, + event, + reason, + result, + debit, + userRate, + to, + duration, + from, + callHeaders, + callid, + version); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEvent.java new file mode 100644 index 000000000..54d83da8d --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEvent.java @@ -0,0 +1,242 @@ +/* + * 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.webhooks; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.domains.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.destination.Destination; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import java.time.Instant; +import java.util.List; + +/** The request body of an Incoming Call Event. */ +@JsonDeserialize(builder = IncomingCallEventImpl.Builder.class) +public interface IncomingCallEvent extends VoiceWebhookEvent, VoiceWebhookCallEvent { + + /** + * The timestamp in UTC format. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * The unique application key. You can find it in the Sinch dashboard. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** + * The path of the API resource. + * + * @return callResourceUrl + */ + String getCallResourceUrl(); + + /** + * Get userRate + * + * @return userRate + */ + Price getUserRate(); + + /** + * 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 connectPSTN + * SVAML response to the Incoming Call Event request. It must be in E.164 format. + * + * @return cli + */ + String getCli(); + + /** + * Get to + * + * @return to + */ + Destination getTo(); + + /** + * Get domain + * + * @return domain + */ + Domain getDomain(); + + /** + * Get originationType + * + * @return originationType + */ + Domain getOriginationType(); + + /** + * The duration of the call in seconds. + * + * @return duration + */ + Integer getDuration(); + + /** + * The redirected dialled number identification service. + * + * @return rdnis + */ + String getRdnis(); + + /** + * 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 callHeaders + */ + List getCallHeaders(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new IncomingCallEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends VoiceWebhookEvent.Builder, VoiceWebhookCallEvent.Builder { + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * see getter + * + * @param callResourceUrl see getter + * @return Current builder + * @see #getCallResourceUrl + */ + Builder setCallResourceUrl(String callResourceUrl); + + /** + * see getter + * + * @param userRate see getter + * @return Current builder + * @see #getUserRate + */ + Builder setUserRate(Price userRate); + + /** + * see getter + * + * @param cli see getter + * @return Current builder + * @see #getCli + */ + Builder setCli(String cli); + + /** + * see getter + * + * @param to see getter + * @return Current builder + * @see #getTo + */ + Builder setTo(Destination to); + + /** + * see getter + * + * @param domain see getter + * @return Current builder + * @see #getDomain + */ + Builder setDomain(Domain domain); + + /** + * see getter + * + * @param originationType see getter + * @return Current builder + * @see #getOriginationType + */ + Builder setOriginationType(Domain originationType); + + /** + * see getter + * + * @param duration see getter + * @return Current builder + * @see #getDuration + */ + Builder setDuration(Integer duration); + + /** + * see getter + * + * @param rdnis see getter + * @return Current builder + * @see #getRdnis + */ + Builder setRdnis(String rdnis); + + /** + * see getter + * + * @param callHeaders see getter + * @return Current builder + * @see #getCallHeaders + */ + Builder setCallHeaders(List callHeaders); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + IncomingCallEvent build(); + } +} 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 new file mode 100644 index 000000000..81948db2f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/IncomingCallEventImpl.java @@ -0,0 +1,513 @@ +package com.sinch.sdk.domains.voice.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.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.destination.Destination; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import java.time.Instant; +import java.util.List; +import java.util.Objects; + +@JsonPropertyOrder({ + IncomingCallEventImpl.JSON_PROPERTY_TIMESTAMP, + IncomingCallEventImpl.JSON_PROPERTY_CUSTOM, + IncomingCallEventImpl.JSON_PROPERTY_APPLICATION_KEY, + IncomingCallEventImpl.JSON_PROPERTY_EVENT, + IncomingCallEventImpl.JSON_PROPERTY_CALL_RESOURCE_URL, + IncomingCallEventImpl.JSON_PROPERTY_USER_RATE, + IncomingCallEventImpl.JSON_PROPERTY_CLI, + IncomingCallEventImpl.JSON_PROPERTY_TO, + IncomingCallEventImpl.JSON_PROPERTY_DOMAIN, + IncomingCallEventImpl.JSON_PROPERTY_ORIGINATION_TYPE, + IncomingCallEventImpl.JSON_PROPERTY_DURATION, + IncomingCallEventImpl.JSON_PROPERTY_RDNIS, + IncomingCallEventImpl.JSON_PROPERTY_CALL_HEADERS, + IncomingCallEventImpl.JSON_PROPERTY_CALLID, + IncomingCallEventImpl.JSON_PROPERTY_VERSION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) + +/*@JsonIgnoreProperties( + value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the event to be set during deserialization +)*/ +/*@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "event", visible = true) + */ + +public class IncomingCallEventImpl + implements IncomingCallEvent, VoiceWebhookEvent, VoiceWebhookCallEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + + private OptionalValue timestamp; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_CALL_RESOURCE_URL = "callResourceUrl"; + + private OptionalValue callResourceUrl; + + public static final String JSON_PROPERTY_USER_RATE = "userRate"; + + private OptionalValue userRate; + + public static final String JSON_PROPERTY_CLI = "cli"; + + private OptionalValue cli; + + public static final String JSON_PROPERTY_TO = "to"; + + private OptionalValue to; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + + private OptionalValue domain; + + public static final String JSON_PROPERTY_ORIGINATION_TYPE = "originationType"; + + private OptionalValue originationType; + + public static final String JSON_PROPERTY_DURATION = "duration"; + + private OptionalValue duration; + + public static final String JSON_PROPERTY_RDNIS = "rdnis"; + + private OptionalValue rdnis; + + public static final String JSON_PROPERTY_CALL_HEADERS = "callHeaders"; + + private OptionalValue> callHeaders; + + public static final String JSON_PROPERTY_CALLID = "callid"; + + private OptionalValue callid; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public IncomingCallEventImpl() {} + + protected IncomingCallEventImpl( + OptionalValue timestamp, + OptionalValue custom, + OptionalValue applicationKey, + OptionalValue event, + OptionalValue callResourceUrl, + OptionalValue userRate, + OptionalValue cli, + OptionalValue to, + OptionalValue domain, + OptionalValue originationType, + OptionalValue duration, + OptionalValue rdnis, + OptionalValue> callHeaders, + OptionalValue callid, + OptionalValue version) { + this.timestamp = timestamp; + this.custom = custom; + this.applicationKey = applicationKey; + this.event = event; + this.callResourceUrl = callResourceUrl; + this.userRate = userRate; + this.cli = cli; + this.to = to; + this.domain = domain; + this.originationType = originationType; + this.duration = duration; + this.rdnis = rdnis; + this.callHeaders = callHeaders; + this.callid = callid; + this.version = version; + } + + @JsonIgnore + public Instant getTimestamp() { + return timestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timestamp() { + return timestamp; + } + + @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 String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public WebhooksEventRequestType getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public String getCallResourceUrl() { + return callResourceUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALL_RESOURCE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callResourceUrl() { + return callResourceUrl; + } + + @JsonIgnore + public Price getUserRate() { + return userRate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue userRate() { + return userRate; + } + + @JsonIgnore + public String getCli() { + return cli.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue cli() { + return cli; + } + + @JsonIgnore + public Destination getTo() { + return to.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue to() { + return to; + } + + @JsonIgnore + public Domain getDomain() { + return domain.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue domain() { + return domain; + } + + @JsonIgnore + public Domain getOriginationType() { + return originationType.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGINATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue originationType() { + return originationType; + } + + @JsonIgnore + public Integer getDuration() { + return duration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DURATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue duration() { + return duration; + } + + @JsonIgnore + public String getRdnis() { + return rdnis.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RDNIS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue rdnis() { + return rdnis; + } + + @JsonIgnore + public List getCallHeaders() { + return callHeaders.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue> callHeaders() { + return callHeaders; + } + + @JsonIgnore + public String getCallid() { + return callid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callid() { + return callid; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + /** Return true if this iceRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncomingCallEventImpl iceRequest = (IncomingCallEventImpl) o; + return Objects.equals(this.timestamp, iceRequest.timestamp) + && Objects.equals(this.custom, iceRequest.custom) + && Objects.equals(this.applicationKey, iceRequest.applicationKey) + && Objects.equals(this.event, iceRequest.event) + && Objects.equals(this.callResourceUrl, iceRequest.callResourceUrl) + && Objects.equals(this.userRate, iceRequest.userRate) + && Objects.equals(this.cli, iceRequest.cli) + && Objects.equals(this.to, iceRequest.to) + && Objects.equals(this.domain, iceRequest.domain) + && Objects.equals(this.originationType, iceRequest.originationType) + && Objects.equals(this.duration, iceRequest.duration) + && Objects.equals(this.rdnis, iceRequest.rdnis) + && Objects.equals(this.callHeaders, iceRequest.callHeaders) + && Objects.equals(this.callid, iceRequest.callid) + && Objects.equals(this.version, iceRequest.version) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash( + timestamp, + custom, + applicationKey, + event, + callResourceUrl, + userRate, + cli, + to, + domain, + originationType, + duration, + rdnis, + callHeaders, + callid, + version, + super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncomingCallEventImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" callResourceUrl: ").append(toIndentedString(callResourceUrl)).append("\n"); + sb.append(" userRate: ").append(toIndentedString(userRate)).append("\n"); + sb.append(" cli: ").append(toIndentedString(cli)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" originationType: ").append(toIndentedString(originationType)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" rdnis: ").append(toIndentedString(rdnis)).append("\n"); + sb.append(" callHeaders: ").append(toIndentedString(callHeaders)).append("\n"); + sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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 IncomingCallEvent.Builder { + OptionalValue timestamp = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue event = OptionalValue.of(WebhooksEventRequestType.ICE); + OptionalValue callResourceUrl = OptionalValue.empty(); + OptionalValue userRate = OptionalValue.empty(); + OptionalValue cli = OptionalValue.empty(); + OptionalValue to = OptionalValue.empty(); + OptionalValue domain = OptionalValue.empty(); + OptionalValue originationType = OptionalValue.empty(); + OptionalValue duration = OptionalValue.empty(); + OptionalValue rdnis = OptionalValue.empty(); + OptionalValue> callHeaders = OptionalValue.empty(); + OptionalValue callid = OptionalValue.empty(); + OptionalValue version = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + public Builder setTimestamp(Instant timestamp) { + this.timestamp = OptionalValue.of(timestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALL_RESOURCE_URL) + public Builder setCallResourceUrl(String callResourceUrl) { + this.callResourceUrl = OptionalValue.of(callResourceUrl); + return this; + } + + @JsonProperty(JSON_PROPERTY_USER_RATE) + public Builder setUserRate(Price userRate) { + this.userRate = OptionalValue.of(userRate); + return this; + } + + @JsonProperty(JSON_PROPERTY_CLI) + public Builder setCli(String cli) { + this.cli = OptionalValue.of(cli); + return this; + } + + @JsonProperty(JSON_PROPERTY_TO) + public Builder setTo(Destination to) { + this.to = OptionalValue.of(to); + return this; + } + + @JsonProperty(JSON_PROPERTY_DOMAIN) + public Builder setDomain(Domain domain) { + this.domain = OptionalValue.of(domain); + return this; + } + + @JsonProperty(JSON_PROPERTY_ORIGINATION_TYPE) + public Builder setOriginationType(Domain originationType) { + this.originationType = OptionalValue.of(originationType); + return this; + } + + @JsonProperty(JSON_PROPERTY_DURATION) + public Builder setDuration(Integer duration) { + this.duration = OptionalValue.of(duration); + return this; + } + + @JsonProperty(JSON_PROPERTY_RDNIS) + public Builder setRdnis(String rdnis) { + this.rdnis = OptionalValue.of(rdnis); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALL_HEADERS) + public Builder setCallHeaders(List callHeaders) { + this.callHeaders = OptionalValue.of(callHeaders); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLID) + public Builder setCallid(String callid) { + this.callid = OptionalValue.of(callid); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + public IncomingCallEvent build() { + return new IncomingCallEventImpl( + timestamp, + custom, + applicationKey, + event, + callResourceUrl, + userRate, + cli, + to, + domain, + originationType, + duration, + rdnis, + callHeaders, + callid, + version); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.java new file mode 100644 index 000000000..a45ae1222 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResult.java @@ -0,0 +1,164 @@ +/* + * 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.webhooks; + +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; + +/** An object containing information about the returned menu result. */ +@JsonDeserialize(builder = MenuResultImpl.Builder.class) +public interface MenuResult { + + /** + * The ID of the menu that triggered the prompt input event. + * + * @return menuId + */ + String getMenuId(); + + /** The type of information that's returned. */ + public class TypeEnum extends EnumDynamic { + public static final TypeEnum ERROR = new TypeEnum("error"); + public static final TypeEnum RETURN = new TypeEnum("return"); + public static final TypeEnum SEQUENCE = new TypeEnum("sequence"); + public static final TypeEnum TIMEOUT = new TypeEnum("timeout"); + public static final TypeEnum HANGUP = new TypeEnum("hangup"); + public static final TypeEnum INVALIDINPUT = new TypeEnum("invalidinput"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + TypeEnum.class, + TypeEnum::new, + Arrays.asList(ERROR, RETURN, SEQUENCE, TIMEOUT, HANGUP, INVALIDINPUT)); + + private TypeEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static TypeEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(TypeEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The type of information that's returned. + * + * @return type + */ + TypeEnum getType(); + + /** + * The value of the returned information. + * + * @return value + */ + String getValue(); + + /** The type of input received. */ + public class InputMethodEnum extends EnumDynamic { + public static final InputMethodEnum DTMF = new InputMethodEnum("dtmf"); + public static final InputMethodEnum VOICE = new InputMethodEnum("voice"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + InputMethodEnum.class, InputMethodEnum::new, Arrays.asList(DTMF, VOICE)); + + private InputMethodEnum(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static InputMethodEnum from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(InputMethodEnum e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The type of input received. + * + * @return inputMethod + */ + InputMethodEnum getInputMethod(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new MenuResultImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param menuId see getter + * @return Current builder + * @see #getMenuId + */ + Builder setMenuId(String menuId); + + /** + * see getter + * + * @param type see getter + * @return Current builder + * @see #getType + */ + Builder setType(TypeEnum type); + + /** + * see getter + * + * @param value see getter + * @return Current builder + * @see #getValue + */ + Builder setValue(String value); + + /** + * see getter + * + * @param inputMethod see getter + * @return Current builder + * @see #getInputMethod + */ + Builder setInputMethod(InputMethodEnum inputMethod); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + MenuResult build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResultImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResultImpl.java new file mode 100644 index 000000000..251974c73 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/MenuResultImpl.java @@ -0,0 +1,174 @@ +package com.sinch.sdk.domains.voice.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 java.util.Objects; + +@JsonPropertyOrder({ + MenuResultImpl.JSON_PROPERTY_MENU_ID, + MenuResultImpl.JSON_PROPERTY_TYPE, + MenuResultImpl.JSON_PROPERTY_VALUE, + MenuResultImpl.JSON_PROPERTY_INPUT_METHOD +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) +public class MenuResultImpl implements MenuResult { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_MENU_ID = "menuId"; + + private OptionalValue menuId; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_VALUE = "value"; + + private OptionalValue value; + + public static final String JSON_PROPERTY_INPUT_METHOD = "inputMethod"; + + private OptionalValue inputMethod; + + public MenuResultImpl() {} + + protected MenuResultImpl( + OptionalValue menuId, + OptionalValue type, + OptionalValue value, + OptionalValue inputMethod) { + this.menuId = menuId; + this.type = type; + this.value = value; + this.inputMethod = inputMethod; + } + + @JsonIgnore + public String getMenuId() { + return menuId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MENU_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue menuId() { + return menuId; + } + + @JsonIgnore + public TypeEnum getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue type() { + return type; + } + + @JsonIgnore + public String getValue() { + return value.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue value() { + return value; + } + + @JsonIgnore + public InputMethodEnum getInputMethod() { + return inputMethod.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INPUT_METHOD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue inputMethod() { + return inputMethod; + } + + /** Return true if this pieRequest_allOf_menuResult object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MenuResultImpl pieRequestAllOfMenuResult = (MenuResultImpl) o; + return Objects.equals(this.menuId, pieRequestAllOfMenuResult.menuId) + && Objects.equals(this.type, pieRequestAllOfMenuResult.type) + && Objects.equals(this.value, pieRequestAllOfMenuResult.value) + && Objects.equals(this.inputMethod, pieRequestAllOfMenuResult.inputMethod); + } + + @Override + public int hashCode() { + return Objects.hash(menuId, type, value, inputMethod); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MenuResultImpl {\n"); + sb.append(" menuId: ").append(toIndentedString(menuId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" inputMethod: ").append(toIndentedString(inputMethod)).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 MenuResult.Builder { + OptionalValue menuId = OptionalValue.empty(); + OptionalValue type = OptionalValue.empty(); + OptionalValue value = OptionalValue.empty(); + OptionalValue inputMethod = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_MENU_ID) + public Builder setMenuId(String menuId) { + this.menuId = OptionalValue.of(menuId); + return this; + } + + @JsonProperty(JSON_PROPERTY_TYPE) + public Builder setType(TypeEnum type) { + this.type = OptionalValue.of(type); + return this; + } + + @JsonProperty(JSON_PROPERTY_VALUE) + public Builder setValue(String value) { + this.value = OptionalValue.of(value); + return this; + } + + @JsonProperty(JSON_PROPERTY_INPUT_METHOD) + public Builder setInputMethod(InputMethodEnum inputMethod) { + this.inputMethod = OptionalValue.of(inputMethod); + return this; + } + + public MenuResult build() { + return new MenuResultImpl(menuId, type, value, inputMethod); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEvent.java new file mode 100644 index 000000000..2b969005a --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEvent.java @@ -0,0 +1,99 @@ +/* + * 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.webhooks; + +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; + +/** The request body of a Notify Event. */ +@JsonDeserialize(builder = NotificationEventImpl.Builder.class) +public interface NotificationEvent extends VoiceWebhookEvent { + + /** Must have the value notify. */ + public class WebhooksEventRequestType extends EnumDynamic { + public static final WebhooksEventRequestType NOTIFY = new WebhooksEventRequestType("notify"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WebhooksEventRequestType.class, WebhooksEventRequestType::new, Arrays.asList(NOTIFY)); + + private WebhooksEventRequestType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WebhooksEventRequestType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WebhooksEventRequestType e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The type of information communicated in the notification. + * + * @return type + */ + String getType(); + + /** + * An optional parameter containing notification-specific information. + * + * @return custom + */ + String getCustom(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new NotificationEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends VoiceWebhookEvent.Builder { + + /** + * see getter + * + * @param type see getter + * @return Current builder + * @see #getType + */ + Builder setType(String type); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + NotificationEvent build(); + } +} 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 new file mode 100644 index 000000000..60a0e5963 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/NotificationEventImpl.java @@ -0,0 +1,206 @@ +package com.sinch.sdk.domains.voice.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 java.util.Objects; + +@JsonPropertyOrder({ + NotificationEventImpl.JSON_PROPERTY_EVENT, + NotificationEventImpl.JSON_PROPERTY_TYPE, + NotificationEventImpl.JSON_PROPERTY_CUSTOM, + NotificationEventImpl.JSON_PROPERTY_CALLID, + NotificationEventImpl.JSON_PROPERTY_VERSION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) + +/*@JsonIgnoreProperties( + value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the event to be set during deserialization +)*/ +/*@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "event", visible = true) + */ + +public class NotificationEventImpl implements NotificationEvent, VoiceWebhookEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_TYPE = "type"; + + private OptionalValue type; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_CALLID = "callid"; + + private OptionalValue callid; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public NotificationEventImpl() {} + + protected NotificationEventImpl( + OptionalValue event, + OptionalValue type, + OptionalValue custom, + OptionalValue callid, + OptionalValue version) { + this.event = event; + this.type = type; + this.custom = custom; + this.callid = callid; + this.version = version; + } + + @JsonIgnore + public WebhooksEventRequestType getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public String getType() { + return type.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue type() { + return type; + } + + @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 String getCallid() { + return callid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callid() { + return callid; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + /** Return true if this notifyRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NotificationEventImpl notifyRequest = (NotificationEventImpl) o; + return Objects.equals(this.event, notifyRequest.event) + && Objects.equals(this.type, notifyRequest.type) + && Objects.equals(this.custom, notifyRequest.custom) + && Objects.equals(this.callid, notifyRequest.callid) + && Objects.equals(this.version, notifyRequest.version) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(event, type, custom, callid, version, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotificationEventImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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 NotificationEvent.Builder { + OptionalValue event = + OptionalValue.of(WebhooksEventRequestType.NOTIFY); + OptionalValue type = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue callid = OptionalValue.empty(); + OptionalValue version = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TYPE) + public Builder setType(String type) { + this.type = OptionalValue.of(type); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLID) + public Builder setCallid(String callid) { + this.callid = OptionalValue.of(callid); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + public NotificationEvent build() { + return new NotificationEventImpl(event, type, custom, callid, version); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEvent.java new file mode 100644 index 000000000..2c51962a2 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEvent.java @@ -0,0 +1,133 @@ +/* + * 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.webhooks; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.time.Instant; +import java.util.Arrays; +import java.util.stream.Stream; + +/** The request body of a Prompt Input Event. */ +@JsonDeserialize(builder = PromptInputEventImpl.Builder.class) +public interface PromptInputEvent extends VoiceWebhookEvent { + + /** Must have the value pie. */ + public class WebhooksEventRequestType extends EnumDynamic { + public static final WebhooksEventRequestType PIE = new WebhooksEventRequestType("pie"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WebhooksEventRequestType.class, WebhooksEventRequestType::new, Arrays.asList(PIE)); + + private WebhooksEventRequestType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WebhooksEventRequestType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WebhooksEventRequestType e) { + return ENUM_SUPPORT.valueOf(e); + } + } + + /** + * The timestamp in UTC format. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * Get menuResult + * + * @return menuResult + */ + MenuResult getMenuResult(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * The unique application key. You can find it in the Sinch dashboard. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** + * Getting builder + * + * @return New Builder instance + */ + static Builder builder() { + return new PromptInputEventImpl.Builder(); + } + + /** Dedicated Builder */ + interface Builder extends VoiceWebhookEvent.Builder { + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param menuResult see getter + * @return Current builder + * @see #getMenuResult + */ + Builder setMenuResult(MenuResult menuResult); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + PromptInputEvent build(); + } +} 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 new file mode 100644 index 000000000..ff413d128 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/PromptInputEventImpl.java @@ -0,0 +1,262 @@ +package com.sinch.sdk.domains.voice.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 java.time.Instant; +import java.util.Objects; + +@JsonPropertyOrder({ + PromptInputEventImpl.JSON_PROPERTY_EVENT, + PromptInputEventImpl.JSON_PROPERTY_TIMESTAMP, + PromptInputEventImpl.JSON_PROPERTY_MENU_RESULT, + PromptInputEventImpl.JSON_PROPERTY_CUSTOM, + PromptInputEventImpl.JSON_PROPERTY_APPLICATION_KEY, + PromptInputEventImpl.JSON_PROPERTY_CALLID, + PromptInputEventImpl.JSON_PROPERTY_VERSION +}) +@JsonFilter("uninitializedFilter") +@JsonInclude(value = JsonInclude.Include.CUSTOM) + +/*@JsonIgnoreProperties( + value = "event", // ignore manually set event, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the event to be set during deserialization +)*/ +/*@JsonTypeInfo(use = JsonTypeInfo.Id.NONE, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "event", visible = true) + */ + +public class PromptInputEventImpl implements PromptInputEvent, VoiceWebhookEvent { + private static final long serialVersionUID = 1L; + + public static final String JSON_PROPERTY_EVENT = "event"; + + private OptionalValue event; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + + private OptionalValue timestamp; + + public static final String JSON_PROPERTY_MENU_RESULT = "menuResult"; + + private OptionalValue menuResult; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + + private OptionalValue custom; + + public static final String JSON_PROPERTY_APPLICATION_KEY = "applicationKey"; + + private OptionalValue applicationKey; + + public static final String JSON_PROPERTY_CALLID = "callid"; + + private OptionalValue callid; + + public static final String JSON_PROPERTY_VERSION = "version"; + + private OptionalValue version; + + public PromptInputEventImpl() {} + + protected PromptInputEventImpl( + OptionalValue event, + OptionalValue timestamp, + OptionalValue menuResult, + OptionalValue custom, + OptionalValue applicationKey, + OptionalValue callid, + OptionalValue version) { + this.event = event; + this.timestamp = timestamp; + this.menuResult = menuResult; + this.custom = custom; + this.applicationKey = applicationKey; + this.callid = callid; + this.version = version; + } + + @JsonIgnore + public WebhooksEventRequestType getEvent() { + return event.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EVENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OptionalValue event() { + return event; + } + + @JsonIgnore + public Instant getTimestamp() { + return timestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue timestamp() { + return timestamp; + } + + @JsonIgnore + public MenuResult getMenuResult() { + return menuResult.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MENU_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue menuResult() { + return menuResult; + } + + @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 String getApplicationKey() { + return applicationKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue applicationKey() { + return applicationKey; + } + + @JsonIgnore + public String getCallid() { + return callid.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CALLID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue callid() { + return callid; + } + + @JsonIgnore + public Integer getVersion() { + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OptionalValue version() { + return version; + } + + /** Return true if this pieRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PromptInputEventImpl pieRequest = (PromptInputEventImpl) o; + return Objects.equals(this.event, pieRequest.event) + && Objects.equals(this.timestamp, pieRequest.timestamp) + && Objects.equals(this.menuResult, pieRequest.menuResult) + && Objects.equals(this.custom, pieRequest.custom) + && Objects.equals(this.applicationKey, pieRequest.applicationKey) + && Objects.equals(this.callid, pieRequest.callid) + && Objects.equals(this.version, pieRequest.version) + && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash( + event, timestamp, menuResult, custom, applicationKey, callid, version, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PromptInputEventImpl {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" menuResult: ").append(toIndentedString(menuResult)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" applicationKey: ").append(toIndentedString(applicationKey)).append("\n"); + sb.append(" callid: ").append(toIndentedString(callid)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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 PromptInputEvent.Builder { + OptionalValue event = OptionalValue.of(WebhooksEventRequestType.PIE); + OptionalValue timestamp = OptionalValue.empty(); + OptionalValue menuResult = OptionalValue.empty(); + OptionalValue custom = OptionalValue.empty(); + OptionalValue applicationKey = OptionalValue.empty(); + OptionalValue callid = OptionalValue.empty(); + OptionalValue version = OptionalValue.empty(); + + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + public Builder setTimestamp(Instant timestamp) { + this.timestamp = OptionalValue.of(timestamp); + return this; + } + + @JsonProperty(JSON_PROPERTY_MENU_RESULT) + public Builder setMenuResult(MenuResult menuResult) { + this.menuResult = OptionalValue.of(menuResult); + return this; + } + + @JsonProperty(JSON_PROPERTY_CUSTOM) + public Builder setCustom(String custom) { + this.custom = OptionalValue.of(custom); + return this; + } + + @JsonProperty(JSON_PROPERTY_APPLICATION_KEY) + public Builder setApplicationKey(String applicationKey) { + this.applicationKey = OptionalValue.of(applicationKey); + return this; + } + + @JsonProperty(JSON_PROPERTY_CALLID) + public Builder setCallid(String callid) { + this.callid = OptionalValue.of(callid); + return this; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + public Builder setVersion(Integer version) { + this.version = OptionalValue.of(version); + return this; + } + + public PromptInputEvent build() { + return new PromptInputEventImpl( + event, timestamp, menuResult, custom, applicationKey, callid, version); + } + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookCallEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookCallEvent.java new file mode 100644 index 000000000..64137eb91 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookCallEvent.java @@ -0,0 +1,77 @@ +/* + * 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.webhooks; + +import java.time.Instant; + +/** VoiceWebhookCallEvent */ +public interface VoiceWebhookCallEvent { + + /** + * The timestamp in UTC format. + * + * @return timestamp + */ + Instant getTimestamp(); + + /** + * A string that can be used to pass custom information related to the call. + * + * @return custom + */ + String getCustom(); + + /** + * The unique application key. You can find it in the Sinch dashboard. + * + * @return applicationKey + */ + String getApplicationKey(); + + /** Dedicated Builder */ + interface Builder { + + /** + * see getter + * + * @param timestamp see getter + * @return Current builder + * @see #getTimestamp + */ + Builder setTimestamp(Instant timestamp); + + /** + * see getter + * + * @param custom see getter + * @return Current builder + * @see #getCustom + */ + Builder setCustom(String custom); + + /** + * see getter + * + * @param applicationKey see getter + * @return Current builder + * @see #getApplicationKey + */ + Builder setApplicationKey(String applicationKey); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VoiceWebhookCallEvent build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEvent.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEvent.java new file mode 100644 index 000000000..a45756215 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEvent.java @@ -0,0 +1,58 @@ +/* + * 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.webhooks; + +/** VoiceWebhookEvent */ +public interface VoiceWebhookEvent { + + /** + * The unique ID assigned to this call. + * + * @return callid + */ + String getCallid(); + + /** + * The current API version. + * + * @return version + */ + Integer getVersion(); + + /** Dedicated Builder */ + interface Builder> { + + /** + * see getter + * + * @param callid see getter + * @return Current builder + * @see #getCallid + */ + B setCallid(String callid); + + /** + * see getter + * + * @param version see getter + * @return Current builder + * @see #getVersion + */ + B setVersion(Integer version); + + /** + * Create instance + * + * @return The instance build with current builder values + */ + VoiceWebhookEvent build(); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/WebhooksEventRequestType.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/WebhooksEventRequestType.java new file mode 100644 index 000000000..65bedc4b6 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/WebhooksEventRequestType.java @@ -0,0 +1,42 @@ +package com.sinch.sdk.domains.voice.models.v1.webhooks; + +import com.sinch.sdk.core.utils.EnumDynamic; +import com.sinch.sdk.core.utils.EnumSupportDynamic; +import java.util.Arrays; +import java.util.stream.Stream; + +/** Gets or Sets webhooksEventRequestType */ +public class WebhooksEventRequestType extends EnumDynamic { + + public static final WebhooksEventRequestType ICE = new WebhooksEventRequestType("ice"); + + public static final WebhooksEventRequestType ACE = new WebhooksEventRequestType("ace"); + + public static final WebhooksEventRequestType DICE = new WebhooksEventRequestType("dice"); + + public static final WebhooksEventRequestType PIE = new WebhooksEventRequestType("pie"); + + public static final WebhooksEventRequestType NOTIFY = new WebhooksEventRequestType("notify"); + + private static final EnumSupportDynamic ENUM_SUPPORT = + new EnumSupportDynamic<>( + WebhooksEventRequestType.class, + WebhooksEventRequestType::new, + Arrays.asList(ICE, ACE, DICE, PIE, NOTIFY)); + + private WebhooksEventRequestType(String value) { + super(value); + } + + public static Stream values() { + return ENUM_SUPPORT.values(); + } + + public static WebhooksEventRequestType from(String value) { + return ENUM_SUPPORT.from(value); + } + + public static String valueOf(WebhooksEventRequestType e) { + return ENUM_SUPPORT.valueOf(e); + } +} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternal.java b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternal.java new file mode 100644 index 000000000..6e26e7ed7 --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternal.java @@ -0,0 +1,16 @@ +/* + * 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.webhooks.internal; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = WebhooksEventInternalImpl.WebhooksEventInternalImplDeserializer.class) +public interface WebhooksEventInternal {} 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 new file mode 100644 index 000000000..3198f345f --- /dev/null +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/voice/models/v1/webhooks/internal/WebhooksEventInternalImpl.java @@ -0,0 +1,530 @@ +package com.sinch.sdk.domains.voice.models.v1.webhooks.internal; + +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 com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEventImpl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEventImpl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.IncomingCallEventImpl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.NotificationEventImpl; +import com.sinch.sdk.domains.voice.models.v1.webhooks.PromptInputEventImpl; +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 = WebhooksEventInternalImpl.WebhooksEventInternalImplDeserializer.class) +@JsonSerialize(using = WebhooksEventInternalImpl.WebhooksEventInternalImplSerializer.class) +public class WebhooksEventInternalImpl extends AbstractOpenApiSchema + implements WebhooksEventInternal { + private static final Logger log = Logger.getLogger(WebhooksEventInternalImpl.class.getName()); + + public static final class WebhooksEventInternalImplSerializer + extends StdSerializer { + private static final long serialVersionUID = 1L; + + public WebhooksEventInternalImplSerializer(Class t) { + super(t); + } + + public WebhooksEventInternalImplSerializer() { + this(null); + } + + @Override + public void serialize( + WebhooksEventInternalImpl value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static final class WebhooksEventInternalImplDeserializer + extends StdDeserializer { + + private static final long serialVersionUID = 1L; + + public WebhooksEventInternalImplDeserializer() { + this(WebhooksEventInternalImpl.class); + } + + public WebhooksEventInternalImplDeserializer(Class vc) { + super(vc); + } + + @Override + public WebhooksEventInternalImpl deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + WebhooksEventInternalImpl newWebhooksEventInternalImpl = new WebhooksEventInternalImpl(); + Map result2 = + tree.traverse(jp.getCodec()).readValueAs(new TypeReference>() {}); + String discriminatorValue = (String) result2.get("event"); + switch (discriminatorValue) { + case "ace": + deserialized = tree.traverse(jp.getCodec()).readValueAs(AnsweredCallEventImpl.class); + newWebhooksEventInternalImpl.setActualInstance(deserialized); + return newWebhooksEventInternalImpl; + case "dice": + deserialized = tree.traverse(jp.getCodec()).readValueAs(DisconnectedCallEventImpl.class); + newWebhooksEventInternalImpl.setActualInstance(deserialized); + return newWebhooksEventInternalImpl; + case "ice": + deserialized = tree.traverse(jp.getCodec()).readValueAs(IncomingCallEventImpl.class); + newWebhooksEventInternalImpl.setActualInstance(deserialized); + return newWebhooksEventInternalImpl; + case "notify": + deserialized = tree.traverse(jp.getCodec()).readValueAs(NotificationEventImpl.class); + newWebhooksEventInternalImpl.setActualInstance(deserialized); + return newWebhooksEventInternalImpl; + case "pie": + 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", + discriminatorValue)); + } + + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize AnsweredCallEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AnsweredCallEventImpl.class.equals(Integer.class) + || AnsweredCallEventImpl.class.equals(Long.class) + || AnsweredCallEventImpl.class.equals(Float.class) + || AnsweredCallEventImpl.class.equals(Double.class) + || AnsweredCallEventImpl.class.equals(Boolean.class) + || AnsweredCallEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AnsweredCallEventImpl.class.equals(Integer.class) + || AnsweredCallEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AnsweredCallEventImpl.class.equals(Float.class) + || AnsweredCallEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (AnsweredCallEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AnsweredCallEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(AnsweredCallEventImpl.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 'AnsweredCallEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AnsweredCallEventImpl'", e); + } + + // deserialize DisconnectedCallEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DisconnectedCallEventImpl.class.equals(Integer.class) + || DisconnectedCallEventImpl.class.equals(Long.class) + || DisconnectedCallEventImpl.class.equals(Float.class) + || DisconnectedCallEventImpl.class.equals(Double.class) + || DisconnectedCallEventImpl.class.equals(Boolean.class) + || DisconnectedCallEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DisconnectedCallEventImpl.class.equals(Integer.class) + || DisconnectedCallEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DisconnectedCallEventImpl.class.equals(Float.class) + || DisconnectedCallEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (DisconnectedCallEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DisconnectedCallEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DisconnectedCallEventImpl.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 'DisconnectedCallEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DisconnectedCallEventImpl'", e); + } + + // deserialize IncomingCallEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IncomingCallEventImpl.class.equals(Integer.class) + || IncomingCallEventImpl.class.equals(Long.class) + || IncomingCallEventImpl.class.equals(Float.class) + || IncomingCallEventImpl.class.equals(Double.class) + || IncomingCallEventImpl.class.equals(Boolean.class) + || IncomingCallEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((IncomingCallEventImpl.class.equals(Integer.class) + || IncomingCallEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((IncomingCallEventImpl.class.equals(Float.class) + || IncomingCallEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (IncomingCallEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (IncomingCallEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(IncomingCallEventImpl.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 'IncomingCallEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IncomingCallEventImpl'", e); + } + + // deserialize NotificationEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (NotificationEventImpl.class.equals(Integer.class) + || NotificationEventImpl.class.equals(Long.class) + || NotificationEventImpl.class.equals(Float.class) + || NotificationEventImpl.class.equals(Double.class) + || NotificationEventImpl.class.equals(Boolean.class) + || NotificationEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((NotificationEventImpl.class.equals(Integer.class) + || NotificationEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((NotificationEventImpl.class.equals(Float.class) + || NotificationEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (NotificationEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (NotificationEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(NotificationEventImpl.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 'NotificationEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'NotificationEventImpl'", e); + } + + // deserialize PromptInputEventImpl + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (PromptInputEventImpl.class.equals(Integer.class) + || PromptInputEventImpl.class.equals(Long.class) + || PromptInputEventImpl.class.equals(Float.class) + || PromptInputEventImpl.class.equals(Double.class) + || PromptInputEventImpl.class.equals(Boolean.class) + || PromptInputEventImpl.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((PromptInputEventImpl.class.equals(Integer.class) + || PromptInputEventImpl.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((PromptInputEventImpl.class.equals(Float.class) + || PromptInputEventImpl.class.equals(Double.class)) + && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= + (PromptInputEventImpl.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (PromptInputEventImpl.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(PromptInputEventImpl.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 'PromptInputEventImpl'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'PromptInputEventImpl'", e); + } + + if (match == 1) { + WebhooksEventInternalImpl ret = new WebhooksEventInternalImpl(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException( + String.format( + "Failed deserialization for WebhooksEventInternalImpl: %d classes match result," + + " expected 1", + match)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public WebhooksEventInternalImpl getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "WebhooksEventInternalImpl cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public WebhooksEventInternalImpl() { + super("oneOf", Boolean.FALSE); + } + + public WebhooksEventInternalImpl(AnsweredCallEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public WebhooksEventInternalImpl(DisconnectedCallEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public WebhooksEventInternalImpl(IncomingCallEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public WebhooksEventInternalImpl(NotificationEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public WebhooksEventInternalImpl(PromptInputEventImpl o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("AnsweredCallEventImpl", AnsweredCallEventImpl.class); + schemas.put("DisconnectedCallEventImpl", DisconnectedCallEventImpl.class); + schemas.put("IncomingCallEventImpl", IncomingCallEventImpl.class); + schemas.put("NotificationEventImpl", NotificationEventImpl.class); + schemas.put("PromptInputEventImpl", PromptInputEventImpl.class); + JSONNavigator.registerDescendants( + WebhooksEventInternalImpl.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("ace", AnsweredCallEventImpl.class); + mappings.put("dice", DisconnectedCallEventImpl.class); + 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); + } + + @Override + public Map> getSchemas() { + return WebhooksEventInternalImpl.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: AnsweredCallEventImpl, DisconnectedCallEventImpl, + * IncomingCallEventImpl, NotificationEventImpl, PromptInputEventImpl + * + *

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( + AnsweredCallEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + DisconnectedCallEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + IncomingCallEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf( + NotificationEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSONNavigator.isInstanceOf(PromptInputEventImpl.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be AnsweredCallEventImpl, DisconnectedCallEventImpl," + + " IncomingCallEventImpl, NotificationEventImpl, PromptInputEventImpl"); + } + + /** + * Get the actual instance, which can be the following: AnsweredCallEventImpl, + * DisconnectedCallEventImpl, IncomingCallEventImpl, NotificationEventImpl, PromptInputEventImpl + * + * @return The actual instance (AnsweredCallEventImpl, DisconnectedCallEventImpl, + * IncomingCallEventImpl, NotificationEventImpl, PromptInputEventImpl) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `AnsweredCallEventImpl`. If the actual instance is not + * `AnsweredCallEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `AnsweredCallEventImpl` + * @throws ClassCastException if the instance is not `AnsweredCallEventImpl` + */ + public AnsweredCallEventImpl getAnsweredCallEventImpl() throws ClassCastException { + return (AnsweredCallEventImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `DisconnectedCallEventImpl`. If the actual instance is not + * `DisconnectedCallEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `DisconnectedCallEventImpl` + * @throws ClassCastException if the instance is not `DisconnectedCallEventImpl` + */ + public DisconnectedCallEventImpl getDisconnectedCallEventImpl() throws ClassCastException { + return (DisconnectedCallEventImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `IncomingCallEventImpl`. If the actual instance is not + * `IncomingCallEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `IncomingCallEventImpl` + * @throws ClassCastException if the instance is not `IncomingCallEventImpl` + */ + public IncomingCallEventImpl getIncomingCallEventImpl() throws ClassCastException { + return (IncomingCallEventImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `NotificationEventImpl`. If the actual instance is not + * `NotificationEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `NotificationEventImpl` + * @throws ClassCastException if the instance is not `NotificationEventImpl` + */ + public NotificationEventImpl getNotificationEventImpl() throws ClassCastException { + return (NotificationEventImpl) super.getActualInstance(); + } + + /** + * Get the actual instance of `PromptInputEventImpl`. If the actual instance is not + * `PromptInputEventImpl`, the ClassCastException will be thrown. + * + * @return The actual instance of `PromptInputEventImpl` + * @throws ClassCastException if the instance is not `PromptInputEventImpl` + */ + public PromptInputEventImpl getPromptInputEventImpl() throws ClassCastException { + return (PromptInputEventImpl) super.getActualInstance(); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceBaseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceBaseTest.java new file mode 100644 index 000000000..723b9a2ab --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/adapters/VoiceBaseTest.java @@ -0,0 +1,17 @@ +package com.sinch.sdk.domains.voice.adapters; + +import com.sinch.sdk.BaseTest; +import com.sinch.sdk.domains.voice.api.v1.adapters.VoiceService; +import com.sinch.sdk.domains.voice.api.v1.adapters.mapper.CallInformationMapper; +import com.sinch.sdk.domains.voice.api.v1.adapters.mapper.CalloutRequestCustomMapper; +import com.sinch.sdk.models.adapters.DualToneMultiFrequencyMapper; + +public class VoiceBaseTest extends BaseTest { + + static { + DualToneMultiFrequencyMapper.initMapper(); + CalloutRequestCustomMapper.initMapper(); + CallInformationMapper.initMapper(); + VoiceService.LocalLazyInit.init(); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectConfDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectConfDtoTest.java deleted file mode 100644 index 2728a3801..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectConfDtoTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlActionConnectConfConferenceDtmfOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectConfDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectConfDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionConnectConfDtoTest extends BaseTest { - - public static SvamlActionConnectConfDto dto = - new SvamlActionConnectConfDto() - .name(NameEnum.CONNECTCONF.getValue()) - .conferenceId("My Conference Id") - .conferenceDtmfOptions( - new SvamlActionConnectConfConferenceDtmfOptionsDto() - .mode("forward") - .maxDigits(45) - .timeoutMills(456)) - .moh("music3"); - - @GivenTextResource("/domains/voice/svaml/ActionConnectConferenceDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectMxpDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectMxpDtoTest.java deleted file mode 100644 index 035f87869..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectMxpDtoTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.CallHeaderDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DestinationDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DestinationTypeDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectMxpDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectMxpDto.NameEnum; -import java.util.Collections; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionConnectMxpDtoTest extends BaseTest { - - public static SvamlActionConnectMxpDto dto = - new SvamlActionConnectMxpDto() - .name(NameEnum.CONNECTMXP.getValue()) - .destination( - new DestinationDto().type(DestinationTypeDto.USERNAME).endpoint("a user string")) - .callheaders( - Collections.singletonList( - new CallHeaderDto().key("left string").value("right string"))); - - @GivenTextResource("/domains/voice/svaml/ActionConnectMxpDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectPstnDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectPstnDtoTest.java deleted file mode 100644 index 730a1ff03..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectPstnDtoTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlActionConnectPstnAmdDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectPstnDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectPstnDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionConnectPstnDtoTest extends BaseTest { - - public static SvamlActionConnectPstnDto dto = - new SvamlActionConnectPstnDto() - .name(NameEnum.CONNECTPSTN.getValue()) - .number("+123456789") - .locale("fr") - .maxDuration(123) - .dialTimeout(456) - .cli("cli value") - .suppressCallbacks(true) - .dtmf("#w123") - .indications("unknown value") - .amd(new SvamlActionConnectPstnAmdDto().enabled(true)); - - @GivenTextResource("/domains/voice/svaml/ActionConnectPstnDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectSipDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectSipDtoTest.java deleted file mode 100644 index 7f1adbdf1..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionConnectSipDtoTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.CallHeaderDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DestinationDto; -import com.sinch.sdk.domains.voice.models.dto.v1.DestinationTypeDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectSipDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionConnectSipDto.NameEnum; -import java.util.Collections; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionConnectSipDtoTest extends BaseTest { - - public static SvamlActionConnectSipDto dto = - new SvamlActionConnectSipDto() - .name(NameEnum.CONNECTSIP.getValue()) - .destination(new DestinationDto().type(DestinationTypeDto.SIP).endpoint("a sip string")) - .maxDuration(456) - .cli("a cli value") - .transport("TLS") - .suppressCallbacks(true) - .callHeaders( - Collections.singletonList( - new CallHeaderDto().key("left string").value("right string"))) - .moh("music2"); - - @GivenTextResource("/domains/voice/svaml/ActionConnectSipDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionParkDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionParkDtoTest.java deleted file mode 100644 index 05a6aeefd..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionParkDtoTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlActionParkDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionParkDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionParkDtoTest extends BaseTest { - - public static SvamlActionParkDto dto = - new SvamlActionParkDto() - .name(NameEnum.PARK.getValue()) - .locale("en") - .introPrompt("intro prompt") - .holdPrompt("hold prompt") - .maxDuration(456); - - @GivenTextResource("/domains/voice/svaml/ActionParkDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionRunMenuDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionRunMenuDtoTest.java deleted file mode 100644 index d67d340b9..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionRunMenuDtoTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.MenuDto; -import com.sinch.sdk.domains.voice.models.dto.v1.OptionDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionRunMenuDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionRunMenuDto.NameEnum; -import java.util.Collections; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ActionRunMenuDtoTest extends BaseTest { - - public static SvamlActionRunMenuDto dto = - new SvamlActionRunMenuDto() - .name(NameEnum.RUNMENU.getValue()) - .barge(true) - .locale("fr") - .mainMenu(" the main menu") - .enableVoice(false) - .menus( - Collections.singletonList( - new MenuDto() - .id("the id") - .mainPrompt("main prompt") - .repeatPrompt("repeat prompt") - .repeats(5) - .maxDigits(18) - .timeoutMills(500) - .maxTimeoutMills(123456) - .options( - Collections.singletonList( - new OptionDto().dtmf("#w").action("menu(foo)"))))); - - @GivenTextResource("/domains/voice/svaml/ActionRunMenuDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSendDtfmDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSendDtfmDtoTest.java deleted file mode 100644 index e15dca833..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSendDtfmDtoTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlInstructionSendDtmfDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSendDtmfDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class InstructionSendDtfmDtoTest extends BaseTest { - - public static SvamlInstructionSendDtmfDto dto = - new SvamlInstructionSendDtmfDto().name(NameEnum.SENDDTMF.getValue()).value("ww123#"); - - @GivenTextResource("/domains/voice/svaml/InstructionSendDtfmDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSetCookieDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSetCookieDtoTest.java deleted file mode 100644 index 1118d481c..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSetCookieDtoTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlInstructionSetCookieDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSetCookieDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class InstructionSetCookieDtoTest extends BaseTest { - - public static SvamlInstructionSetCookieDto dto = - new SvamlInstructionSetCookieDto() - .name(NameEnum.SETCOOKIE.getValue()) - .key("a key") - .value("a value"); - - @GivenTextResource("/domains/voice/svaml/InstructionSetCookieDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStartRecordingDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStartRecordingDtoTest.java deleted file mode 100644 index 20e655468..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStartRecordingDtoTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlInstructionStartRecordingDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingDto.NameEnum; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingOptionsDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class InstructionStartRecordingDtoTest extends BaseTest { - - public static SvamlInstructionStartRecordingDto dto = - new SvamlInstructionStartRecordingDto() - .name(NameEnum.STARTRECORDING.getValue()) - .options( - new SvamlInstructionStartRecordingOptionsDto() - .credentials("credential value") - .destinationUrl("destination value") - .format("mp3") - .notificationEvents(true) - .transcriptionOptions( - new SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto() - .enabled(true) - .locale("en-US"))); - - @GivenTextResource("/domains/voice/svaml/InstructionStartRecordingDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStopRecordingDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStopRecordingDtoTest.java deleted file mode 100644 index 21d29547a..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionStopRecordingDtoTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; - -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.domains.voice.models.dto.v1.SvamlInstructionStopRecordingDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionStopRecordingDto.NameEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class InstructionStopRecordingDtoTest extends BaseTest { - - public static SvamlInstructionStopRecordingDto dto = - new SvamlInstructionStopRecordingDto().name(NameEnum.STOPRECORDING.getValue()); - - @GivenTextResource("/domains/voice/svaml/InstructionStopRecordingDto.json") - String json; - - @Test - void serialize() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(dto); - - JSONAssert.assertEquals(json, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsCallbackUrlsDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsCallbackUrlsDtoTest.java deleted file mode 100644 index a9e120c3f..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsCallbackUrlsDtoTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sinch.sdk.domains.voice.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 org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ApplicationsCallbackUrlsDtoTest extends BaseTest { - - public static CallbacksDto expected = - new CallbacksDto() - .url( - new CallbacksUrlDto() - .primary("https://foo.com") - .fallback("https://fallback.foo.com")); - - @GivenJsonResource("/domains/voice/v1/ApplicationsGetCallbackUrlsResponseDto.json") - CallbacksDto loaded; - - @GivenTextResource("/domains/voice/v1/ApplicationsGetCallbackUrlsRequestDto.json") - String jsonRequest; - - @Test - void serializeResponse() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(expected); - JSONAssert.assertEquals(jsonRequest, serializedString, true); - } - - @Test - void deserializeResponse() { - Assertions.assertThat(loaded).usingRecursiveComparison().isEqualTo(expected); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsGetNumbersResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsGetNumbersResponseDtoTest.java deleted file mode 100644 index 4b6f8cb54..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsGetNumbersResponseDtoTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.sinch.sdk.domains.voice.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.Arrays; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class ApplicationsGetNumbersResponseDtoTest extends BaseTest { - - public static GetNumbersResponseObjDto expected = - new GetNumbersResponseObjDto() - .numbers( - Arrays.asList( - new GetNumbersResponseObjNumbersInnerDto() - .number("+123456789") - .applicationkey("an application key") - .capability("voice"), - new GetNumbersResponseObjNumbersInnerDto() - .number("+134567890") - .capability("sms"))); - - @GivenJsonResource("/domains/voice/v1/ApplicationsGetNumbersResponseDto.json") - GetNumbersResponseObjDto loaded; - - @Test - void deserializeResponse() { - Assertions.assertThat(loaded).usingRecursiveComparison().isEqualTo(expected); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsQueryNumberResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsQueryNumberResponseDtoTest.java deleted file mode 100644 index dc9c8b060..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsQueryNumberResponseDtoTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sinch.sdk.domains.voice.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 org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class ApplicationsQueryNumberResponseDtoTest extends BaseTest { - - public static GetQueryNumberDto expected = - new GetQueryNumberDto() - .number( - new GetQueryNumberNumberDto() - .countryId("FR") - .numberType("Mobile") - .normalizedNumber("+331234567489") - .restricted(true) - .rate(new PriceDto().currencyId("USD").amount(0.1850F))); - - @GivenJsonResource("/domains/voice/v1/ApplicationsQueryNumberResponseDto.json") - GetQueryNumberDto loaded; - - @Test - void deserializeResponse() { - Assertions.assertThat(loaded).usingRecursiveComparison().isEqualTo(expected); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUpdateNumberRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUpdateNumberRequestDtoTest.java deleted file mode 100644 index a819ea817..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUpdateNumberRequestDtoTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.sinch.sdk.domains.voice.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.util.Arrays; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class ApplicationsUpdateNumberRequestDtoTest extends BaseTest { - - @GivenTextResource("/domains/voice/v1/ApplicationsUpdateNumbersRequestDto.json") - String jsonRequest; - - public static UpdateNumbersDto updateNumbersDto = - new UpdateNumbersDto() - .numbers(Arrays.asList("+12073091712")) - .applicationkey("an app key") - .capability("voice"); - - @Test - void serializeUpdateNumbersDto() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(updateNumbersDto); - - JSONAssert.assertEquals(jsonRequest, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDtoTest.java deleted file mode 100644 index 921dd1d0c..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutRequestDtoTest.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.sinch.sdk.domains.voice.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 com.sinch.sdk.domains.voice.models.dto.v1.CalloutRequestDto.MethodEnum; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class CalloutRequestDtoTest extends BaseTest { - - @GivenTextResource("/domains/voice/v1/CalloutRequestConferenceDto.json") - String jsonCalloutRequestConference; - - @GivenTextResource("/domains/voice/v1/CalloutRequestTtsDto.json") - String jsonCalloutRequestTts; - - @GivenTextResource("/domains/voice/v1/CalloutRequestCustomDto.json") - String jsonCalloutRequestCustom; - - public static CalloutRequestDto conferenceRequestCalloutDto = - new CalloutRequestDto() - .method(MethodEnum.CONFERENCECALLOUT.getValue()) - .conferenceCallout( - new ConferenceCalloutRequestDto() - .destination( - new DestinationDto().type(DestinationTypeDto.NUMBER).endpoint("+14045005000")) - .cli("+14045001000") - .locale("en-US") - .greeting("Welcome to my conference") - .conferenceId("MyConfId") - .conferenceDtmfOptions( - new ConferenceCalloutRequestConferenceDtmfOptionsDto() - .mode("detect") - .maxDigits(3) - .timeoutMills(456)) - .dtmf("w123#") - .maxDuration(32) - .enableAce(true) - .enableDice(true) - .enablePie(true) - .mohClass("music2") - .custom("my custom value") - .domain("pstn")); - - public static CalloutRequestDto ttsRequestDto = - new CalloutRequestDto() - .method(MethodEnum.TTSCALLOUT.getValue()) - .ttsCallout( - new TtsCalloutRequestDto() - .destination( - new DestinationDto() - .type(DestinationTypeDto.USERNAME) - .endpoint("an user name")) - .cli("+14045001000") - .dtmf("w123#") - .custom("my custom value") - .domain(DomainDto.PSTN) - .locale("en-US") - .text("text value") - .prompts( - "#ssml[

Your PIN code is 1234

Please enter it" - + " now

]") - .enableAce(true) - .enableDice(true) - .enablePie(true)); - - public static CalloutRequestDto customRequestDto = - new CalloutRequestDto() - .method(MethodEnum.CUSTOMCALLOUT.getValue()) - .customCallout( - new CustomCalloutRequestDto() - .destination( - new DestinationDto().type(DestinationTypeDto.NUMBER).endpoint("+14045005000")) - .cli("+14045001000") - .dtmf("w123#") - .custom("my custom value") - .maxDuration(32) - .ice( - "{\"action\":{\"name\":\"connectPstn\",\"number\":" - + "\"+12233445566\",\"cli\":\"+12234325234\",\"amd\":" - + "{\"enabled\":true}}}") - .ace( - "{\"instructions\":[{\"name\":\"say\",\"text\":\"Hello," - + " this is a call from Sinch!\"}],\"action\":{\"name\":" - + "\"hangup\"}}") - .pie("https://your-application-server-host/application")); - - @Test - void serializeCalloutConference() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(conferenceRequestCalloutDto); - - JSONAssert.assertEquals(jsonCalloutRequestConference, serializedString, true); - } - - @Test - void serializeCalloutTts() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(ttsRequestDto); - - JSONAssert.assertEquals(jsonCalloutRequestTts, serializedString, true); - } - - @Test - void serializeCalloutCustom() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(customRequestDto); - - JSONAssert.assertEquals(jsonCalloutRequestCustom, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CallsResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CallsResponseDtoTest.java deleted file mode 100644 index d857f057b..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CallsResponseDtoTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.sinch.sdk.domains.voice.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 com.sinch.sdk.domains.voice.models.dto.v1.GetCallResponseObjDto.ReasonEnum; -import com.sinch.sdk.domains.voice.models.dto.v1.GetCallResponseObjDto.StatusEnum; -import java.time.OffsetDateTime; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class CallsResponseDtoTest extends BaseTest { - - @GivenJsonResource("/domains/voice/v1/CallsGetInformationResponseDto.json") - GetCallResponseObjDto loadedCallsGetInformationResponseDto; - - public static GetCallResponseObjDto expectedCallsGetInformationResponseDto = - new GetCallResponseObjDto() - .from( - new DestinationDto() - .type(DestinationTypeDto.USERNAME2) - .endpoint("user name endpoint validation")) - .to(new DestinationDto().type(DestinationTypeDto.NUMBER2).endpoint("+33123456789")) - .domain("pstn") - .callId("a call UUID") - .duration(138) - .status(StatusEnum.FINAL.getValue()) - .result(CallResultDto.ANSWERED) - .reason(ReasonEnum.CALLEEHANGUP.getValue()) - .timestamp(OffsetDateTime.parse("2024-01-08T09:48:12Z")) - .custom("{}") - .userRate(new PriceDto().currencyId("EUR").amount(0.1758F)) - .debit(new PriceDto().currencyId("EUR").amount(0.5274F)); - - @Test - void deserializeResponseCallout() { - Assertions.assertThat(loadedCallsGetInformationResponseDto) - .usingRecursiveComparison() - .isEqualTo(expectedCallsGetInformationResponseDto); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesResponseDtoTest.java deleted file mode 100644 index 6c0955d75..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesResponseDtoTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sinch.sdk.domains.voice.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 org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -@TestWithResources -public class ConferencesResponseDtoTest extends BaseTest { - - @GivenJsonResource("/domains/voice/v1/ConferenceGetResponseDto.json") - GetConferenceInfoResponseDto loadedGetConferenceInfoResponseDto; - - public static GetConferenceInfoResponseDto expectedGetConferenceInfoResponseDto = - new GetConferenceInfoResponseDto() - .addParticipantsItem( - new GetConferenceInfoResponseParticipantsInnerDto() - .cli("a cli") - .id("an id") - .duration(5) - .muted(true) - .onhold(false)); - - @Test - void deserializeGetConferenceInfoResponseDto() { - Assertions.assertThat(loadedGetConferenceInfoResponseDto) - .usingRecursiveComparison() - .isEqualTo(expectedGetConferenceInfoResponseDto); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventDtoTest.java deleted file mode 100644 index 8e0a4be66..000000000 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/WebhooksEventDtoTest.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.sinch.sdk.domains.voice.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.domains.voice.models.dto.v1.NotifyRequestDto.EventEnum; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.Collections; -import org.assertj.core.api.Assertions; -import org.json.JSONException; -import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.JSONAssert; - -@TestWithResources -public class WebhooksEventDtoTest extends BaseTest { - - @GivenJsonResource("/domains/voice/webhooks/IceRequestDto.json") - WebhooksEventDto loadedIceRequestDto; - - @GivenJsonResource("/domains/voice/webhooks/DiceRequestDto.json") - WebhooksEventDto loadedDiceRequestDto; - - @GivenJsonResource("/domains/voice/webhooks/AceRequestDto.json") - WebhooksEventDto loadedAceRequestDto; - - @GivenJsonResource("/domains/voice/webhooks/PieRequestDto.json") - WebhooksEventDto loadedPieRequestDto; - - @GivenJsonResource("/domains/voice/webhooks/NotifyRequestDto.json") - WebhooksEventDto loadedNotifyRequestDto; - - @GivenTextResource("/domains/voice/webhooks/SVAMLResponseDto.json") - String jsonSVAMLResponseDto; - - public static WebhooksEventDto expectedIceRequestDto = - new WebhooksEventDto( - new IceRequestDto() - .event(IceRequestDto.EventEnum.ICE.getValue()) - .callid("a call id") - .callResourceUrl("https://calling-euc1.api.sinch.com/calling/v1/calls/id/a call id") - .timestamp(OffsetDateTime.parse("2024-01-16T16:46:36Z")) - .version(1) - .custom("my custom") - .userRate(new PriceDto().currencyId("USD").amount(0.0F)) - .cli("cli number") - .to(new DestinationDto().type(DestinationTypeDto.NUMBER).endpoint("+123456879")) - .domain(DomainDto.MXP) - .applicationKey("an app key") - .originationType(DomainDto.MXP2) - .rdnis("rdnis value") - .callHeaders( - Collections.singletonList( - new CallHeaderDto().key("the key").value("the value")))); - - public static WebhooksEventDto expectedDiceRequestDto = - new WebhooksEventDto( - new DiceRequestDto() - .event(DiceRequestDto.EventEnum.DICE.getValue()) - .callid("a call id") - .timestamp(OffsetDateTime.parse("2024-01-19T12:49:53Z")) - .version(1) - .custom("my custom value") - .userRate(new PriceDto().currencyId("EUR").amount(0.1758F)) - .to(new DestinationDto().type(DestinationTypeDto.NUMBER).endpoint("123456789")) - .applicationKey("an app key") - .result(CallResultDto.ANSWERED) - .reason(DiceRequestDto.ReasonEnum.MANAGERHANGUP.getValue()) - .from("private") - .duration(1) - .debit(new PriceDto().currencyId("EUR").amount(0.1758F)) - .userRate(new PriceDto().currencyId("USD").amount(0.345F))); - - public static WebhooksEventDto expectedAceRequestDto = - new WebhooksEventDto( - new AceRequestDto() - .event(AceRequestDto.EventEnum.ACE.getValue()) - .callid("a call id") - .timestamp(OffsetDateTime.parse("2024-01-19T12:49:53Z")) - .version(1) - .custom("my custom value") - .applicationKey("my application key") - .amd( - new AceRequestAllOfAmdDto().status("human").reason("longgreeting").duration(15))); - - public static WebhooksEventDto expectedPieRequestDto = - new WebhooksEventDto( - new PieRequestDto() - .event(PieRequestDto.EventEnum.PIE.getValue()) - .callid("a call id") - .timestamp(OffsetDateTime.parse("2024-01-23T15:04:28Z")) - .version(1) - .custom("my custom value") - .applicationKey("my application key") - .menuResult( - new PieRequestAllOfMenuResultDto() - .menuId("confirm") - .type("sequence") - .value("1452") - .inputMethod("dtmf"))); - - public static WebhooksEventDto expectedNotifyRequestDto = - new WebhooksEventDto( - new NotifyRequestDto() - .event(EventEnum.NOTIFY.getValue()) - .callid("a call id") - .version(1) - .custom("my custom value") - .type("recording_finished")); - - public static SVAMLRequestBodyDto expectedSVAMLResponseDto = - new SVAMLRequestBodyDto() - .action( - new SvamlActionDto( - new SvamlActionConnectConfDto() - .name(SvamlActionConnectConfDto.NameEnum.CONNECTCONF.getValue()) - .conferenceId("My Conference Id"))) - .instructions( - Arrays.asList( - new SvamlInstructionDto( - new SvamlInstructionSayDto() - .name(SvamlInstructionSayDto.NameEnum.SAY.getValue()) - .text("Hello from instruction")), - new SvamlInstructionDto( - new SvamlInstructionStartRecordingDto() - .name( - SvamlInstructionStartRecordingDto.NameEnum.STARTRECORDING.getValue()) - .options( - new SvamlInstructionStartRecordingOptionsDto() - .destinationUrl("s3://my-bucket/") - .credentials( - "AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY:eu-central-1") - .notificationEvents(true) - .transcriptionOptions( - new SvamlInstructionStartRecordingOptionsTranscriptionOptionsDto() - .enabled(true)))))); - - @Test - void deserializeIceRequest() { - Assertions.assertThat(loadedIceRequestDto) - .usingRecursiveComparison() - .isEqualTo(expectedIceRequestDto); - } - - @Test - void deserializeDiceRequest() { - Assertions.assertThat(loadedDiceRequestDto) - .usingRecursiveComparison() - .isEqualTo(expectedDiceRequestDto); - } - - @Test - void deserializeAceRequest() { - Assertions.assertThat(loadedAceRequestDto) - .usingRecursiveComparison() - .isEqualTo(expectedAceRequestDto); - } - - @Test - void deserializePieRequest() { - Assertions.assertThat(loadedPieRequestDto) - .usingRecursiveComparison() - .isEqualTo(expectedPieRequestDto); - } - - @Test - void deserializeNotifyRequest() { - Assertions.assertThat(loadedNotifyRequestDto) - .usingRecursiveComparison() - .isEqualTo(expectedNotifyRequestDto); - } - - @Test - void serializeSVAMLResponse() throws JsonProcessingException, JSONException { - - String serializedString = objectMapper.writeValueAsString(expectedSVAMLResponseDto); - - JSONAssert.assertEquals(jsonSVAMLResponseDto, serializedString, true); - } -} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSayDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/PriceTest.java similarity index 55% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSayDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/PriceTest.java index b253acbef..03f0754ae 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionSayDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/PriceTest.java @@ -1,22 +1,20 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; +package com.sinch.sdk.domains.voice.models.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 com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSayDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionSayDto.NameEnum; +import com.sinch.sdk.core.TestHelpers; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class InstructionSayDtoTest extends BaseTest { +class PriceTest extends BaseTest { - public static SvamlInstructionSayDto dto = - new SvamlInstructionSayDto().name(NameEnum.SAY.getValue()).text("[Welcome]").locale("en"); + public static Price dto = Price.builder().setAmount(0.123456F).setCurrencyId("EUR").build(); - @GivenTextResource("/domains/voice/svaml/InstructionSayDto.json") + @GivenTextResource("/domains/voice/v1/PriceDto.json") String json; @Test @@ -25,4 +23,11 @@ void serialize() throws JsonProcessingException, JSONException { JSONAssert.assertEquals(json, serializedString, true); } + + @Test + void deserialize() throws JsonProcessingException, JSONException { + Price expected = objectMapper.readValue(json, Price.class); + + TestHelpers.recursiveEquals(dto, expected); + } } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUnassignNumberRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestTest.java similarity index 52% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUnassignNumberRequestDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestTest.java index 81e8faa23..cc90775ea 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ApplicationsUnassignNumberRequestDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UnAssignNumberRequestTest.java @@ -1,4 +1,4 @@ -package com.sinch.sdk.domains.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.applications.request; import com.adelean.inject.resources.junit.jupiter.GivenTextResource; import com.adelean.inject.resources.junit.jupiter.TestWithResources; @@ -9,17 +9,20 @@ import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class ApplicationsUnassignNumberRequestDtoTest extends BaseTest { +public class UnAssignNumberRequestTest extends BaseTest { - @GivenTextResource("/domains/voice/v1/ApplicationsUnassignNumberRequestDto.json") + @GivenTextResource("/domains/voice/v1/applications/request/UnAssignNumberRequestDto.json") String jsonRequest; - public static UnassignNumbersDto unassignNumberDto = - new UnassignNumbersDto().number("+12073091712").applicationkey("an app key"); + public static UnAssignNumberRequest unAssignNumberDto = + UnAssignNumberRequest.builder() + .setNumber("+12073091712") + .setApplicationKey("an app key") + .build(); @Test - void serializeUnassignNumbersDto() throws JsonProcessingException, JSONException { - String serializedString = objectMapper.writeValueAsString(unassignNumberDto); + void serializeUnAssignNumbersDto() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(unAssignNumberDto); JSONAssert.assertEquals(jsonRequest, serializedString, true); } diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateCallbackUrlsRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateCallbackUrlsRequestTest.java new file mode 100644 index 000000000..81e84eb73 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateCallbackUrlsRequestTest.java @@ -0,0 +1,33 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.request; + +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.domains.voice.models.v1.applications.Callbacks; +import com.sinch.sdk.domains.voice.models.v1.applications.CallbacksUrl; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class UpdateCallbackUrlsRequestTest extends BaseTest { + + public static Callbacks expected = + Callbacks.builder() + .setUrl( + CallbacksUrl.builder() + .setPrimary("https://foo.com") + .setFallback("https://fallback.foo.com") + .build()) + .build(); + + @GivenTextResource("/domains/voice/v1/applications/request/UpdateCallbackUrlsRequestDto.json") + String jsonRequest; + + @Test + void serializeRequest() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(expected); + JSONAssert.assertEquals(jsonRequest, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestTest.java new file mode 100644 index 000000000..9e88a0aad --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/request/UpdateNumbersRequestTest.java @@ -0,0 +1,32 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.request; + +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.domains.voice.models.v1.applications.Capability; +import java.util.Arrays; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class UpdateNumbersRequestTest extends BaseTest { + + @GivenTextResource("/domains/voice/v1/applications/request/UpdateNumbersRequestDto.json") + String jsonRequest; + + public static UpdateNumbersRequest updateNumbersDto = + UpdateNumbersRequest.builder() + .setNumbers(Arrays.asList("+12073091712")) + .setApplicationKey("an app key") + .setCapability(Capability.VOICE) + .build(); + + @Test + void serializeUpdateNumbersRequest() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(updateNumbersDto); + + JSONAssert.assertEquals(jsonRequest, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/GetCallbackUrlsResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/GetCallbackUrlsResponseTest.java new file mode 100644 index 000000000..3c0e75fee --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/GetCallbackUrlsResponseTest.java @@ -0,0 +1,30 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.response; + +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.voice.models.v1.applications.Callbacks; +import com.sinch.sdk.domains.voice.models.v1.applications.CallbacksUrl; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class GetCallbackUrlsResponseTest extends BaseTest { + + public static Callbacks expected = + Callbacks.builder() + .setUrl( + CallbacksUrl.builder() + .setPrimary("https://foo.com") + .setFallback("https://fallback.foo.com") + .build()) + .build(); + + @GivenJsonResource("/domains/voice/v1/applications/response/GetCallbackUrlsResponseDto.json") + Callbacks loaded; + + @Test + void deserializeResponse() { + TestHelpers.recursiveEquals(loaded, expected); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseTest.java new file mode 100644 index 000000000..1568a6791 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/OwnedNumbersResponseTest.java @@ -0,0 +1,36 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.response; + +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.voice.models.v1.applications.Capability; +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class OwnedNumbersResponseTest extends BaseTest { + + public static OwnedNumbersResponse expected = + OwnedNumbersResponse.builder() + .setNumbers( + Arrays.asList( + OwnedNumberInformation.builder() + .setNumber("+123456789") + .setApplicationKey("an application key") + .setCapability(Capability.VOICE) + .build(), + OwnedNumberInformation.builder() + .setNumber("+134567890") + .setCapability(Capability.SMS) + .build())) + .build(); + + @GivenJsonResource("/domains/voice/v1/applications/response/OwnedNumbersResponseDto.json") + OwnedNumbersResponse loaded; + + @Test + void deserializeResponse() { + TestHelpers.recursiveEquals(loaded, expected); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseTest.java new file mode 100644 index 000000000..cf5b3b1d5 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/applications/response/QueryNumberResponseTest.java @@ -0,0 +1,33 @@ +package com.sinch.sdk.domains.voice.models.v1.applications.response; + +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.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.applications.response.QueryNumberInformation.NumberTypeEnum; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class QueryNumberResponseTest extends BaseTest { + + public static QueryNumberResponse expected = + QueryNumberResponse.builder() + .setNumber( + QueryNumberInformation.builder() + .setCountryId("FR") + .setNumberType(NumberTypeEnum.MOBILE) + .setNormalizedNumber("+331234567489") + .setRestricted(true) + .setRate(Price.builder().setCurrencyId("USD").setAmount(0.1850F).build()) + .build()) + .build(); + + @GivenJsonResource("/domains/voice/v1/applications/response/QueryNumberResponseDto.json") + QueryNumberResponse loaded; + + @Test + void deserializeResponse() { + TestHelpers.recursiveEquals(loaded, expected); + } +} 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 new file mode 100644 index 000000000..1cf3d3751 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutRequestDtoTest.java @@ -0,0 +1,132 @@ +package com.sinch.sdk.domains.voice.models.v1.callouts; + +import com.adelean.inject.resources.junit.jupiter.GivenTextResource; +import com.adelean.inject.resources.junit.jupiter.TestWithResources; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.sinch.sdk.domains.voice.adapters.VoiceBaseTest; +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.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.conferences.ConferenceDtmfOptions; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceDtmfOptions.ModeEnum; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; +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.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class CalloutRequestDtoTest extends VoiceBaseTest { + + @GivenTextResource("/domains/voice/v1/callouts/CalloutRequestConferenceDto.json") + String jsonCalloutRequestConference; + + @GivenTextResource("/domains/voice/v1/callouts/CalloutRequestTtsDto.json") + String jsonCalloutRequestTts; + + @GivenTextResource("/domains/voice/v1/callouts/CalloutRequestCustomDto.json") + String jsonCalloutRequestCustom; + + public static CalloutRequestConference conferenceRequestCalloutDto = + CalloutRequestConference.builder() + .setDestination(DestinationPstn.from("+14045005000")) + .setCli("+14045001000") + .setLocale("en-US") + .setGreeting("Welcome to my conference") + .setConferenceId("MyConfId") + .setConferenceDtmfOptions( + ConferenceDtmfOptions.builder() + .setMode(ModeEnum.DETECT) + .setMaxDigits(3) + .setTimeoutMills(456) + .build()) + .setDtmf(DualToneMultiFrequency.valueOf("w123#")) + .setMaxDuration(32) + .setEnableAce(true) + .setEnableDice(true) + .setEnablePie(true) + .setMusicOnHold(MusicOnHold.MUSIC2) + .setCustom("my custom value") + .setDomain(Domain.PSTN) + .build(); + + public static CalloutRequestTTS ttsRequestDto = + CalloutRequestTTS.builder() + .setDestination(DestinationMxp.from("an user name")) + .setCli("+14045001000") + .setDtmf(DualToneMultiFrequency.valueOf("w123#")) + .setCustom("my custom value") + .setDomain(Domain.PSTN) + .setLocale("en-US") + .setText("text value") + .setPrompts( + "#ssml[

Your PIN code is 1234

Please enter it" + + " now

]") + .setEnableAce(true) + .setEnableDice(true) + .setEnablePie(true) + .build(); + + public static CalloutRequestCustom customRequestDto = + 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(); + + @Test + void serializeCalloutConference() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(conferenceRequestCalloutDto); + + JSONAssert.assertEquals(jsonCalloutRequestConference, serializedString, true); + } + + @Test + void serializeCalloutTts() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(ttsRequestDto); + + JSONAssert.assertEquals(jsonCalloutRequestTts, serializedString, true); + } + + @Test + void serializeCalloutCustom() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(customRequestDto); + + JSONAssert.assertEquals(jsonCalloutRequestCustom, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutResponseDtoTest.java similarity index 55% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutResponseDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutResponseDtoTest.java index 074e56824..b2c6e97a5 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/CalloutResponseDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/callouts/CalloutResponseDtoTest.java @@ -1,19 +1,20 @@ -package com.sinch.sdk.domains.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.callouts; 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.voice.models.v1.callouts.response.CalloutResponse; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @TestWithResources public class CalloutResponseDtoTest extends BaseTest { - @GivenJsonResource("/domains/voice/v1/CalloutResponseDto.json") - GetCalloutResponseObjDto loadedCalloutResponseDto; + @GivenJsonResource("/domains/voice/v1/callouts/CalloutResponseDto.json") + CalloutResponse loadedCalloutResponseDto; - public static GetCalloutResponseObjDto expectedCalloutResponseDto = - new GetCalloutResponseObjDto().callId("adf92089-df2a-4f14-a377-1e975f588fe4"); + public static CalloutResponse expectedCalloutResponseDto = + CalloutResponse.builder().setCallId("adf92089-df2a-4f14-a377-1e975f588fe4").build(); @Test void deserializeResponseCallout() { diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/calls/CallInformationTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/calls/CallInformationTest.java new file mode 100644 index 000000000..9bbc76781 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/calls/CallInformationTest.java @@ -0,0 +1,45 @@ +package com.sinch.sdk.domains.voice.models.v1.calls; + +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.voice.adapters.VoiceBaseTest; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.DomainEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.ReasonEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallInformation.StatusEnum; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; +import java.time.Instant; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class CallInformationTest extends VoiceBaseTest { + + @GivenJsonResource("/domains/voice/v1/calls/GetCallInformationResponseDto.json") + CallInformation getCallInformationResponseDto; + + public static CallInformation expectedCallsGetInformationResponseDto = + CallInformation.builder() + .setFrom(DestinationMxp.from("user name endpoint validation")) + .setTo(DestinationPstn.from("+33123456789")) + .setDomain(DomainEnum.PSTN) + .setCallId("a call UUID") + .setDuration(138) + .setStatus(StatusEnum.FINAL) + .setResult(CallResult.ANSWERED) + .setReason(ReasonEnum.CALLEEHANGUP) + .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(); + + @Test + void deserializeResponseCallout() { + TestHelpers.recursiveEquals( + getCallInformationResponseDto, expectedCallsGetInformationResponseDto); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantTest.java new file mode 100644 index 000000000..5522132dd --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/ConferenceParticipantTest.java @@ -0,0 +1,28 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences; + +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 org.junit.jupiter.api.Test; + +@TestWithResources +public class ConferenceParticipantTest extends BaseTest { + + @GivenJsonResource("/domains/voice/v1/conferences/ConferenceParticipantDto.json") + ConferenceParticipant loadedParticipant; + + public static ConferenceParticipant expectedGetConferenceInfoResponseDto = + ConferenceParticipant.builder() + .setCli("a cli") + .setId("an id") + .setDuration(5) + .setMuted(true) + .setOnHold(false) + .build(); + + @Test + void deserializeGetConferenceInfoResponseDto() { + TestHelpers.recursiveEquals(loadedParticipant, expectedGetConferenceInfoResponseDto); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesRequestDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/request/ConferencesRequestDtoTest.java similarity index 56% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesRequestDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/request/ConferencesRequestDtoTest.java index 47111ed9b..8dbf25559 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/v1/ConferencesRequestDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/request/ConferencesRequestDtoTest.java @@ -1,9 +1,11 @@ -package com.sinch.sdk.domains.voice.models.dto.v1; +package com.sinch.sdk.domains.voice.models.v1.conferences.request; 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.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest.CommandEnum; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -11,11 +13,15 @@ @TestWithResources public class ConferencesRequestDtoTest extends BaseTest { - @GivenTextResource("/domains/voice/v1/ConferenceManageParticipantRequestDto.json") + @GivenTextResource( + "/domains/voice/v1/conferences/request/ConferenceManageParticipantRequestDto.json") String jsonConferenceManageParticipantDto; - public static ManageConferenceParticipantRequestDto manageConferenceParticipantRequestDto = - new ManageConferenceParticipantRequestDto().command("unmute").moh("ring"); + public static ManageConferenceParticipantRequest manageConferenceParticipantRequestDto = + ManageConferenceParticipantRequest.builder() + .setCommand(CommandEnum.UNMUTE) + .setMusicOnHold(MusicOnHold.RING) + .build(); @Test void serializeManageConferenceParticipantRequestDto() diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/response/ConferencesResponseDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/response/ConferencesResponseDtoTest.java new file mode 100644 index 000000000..c7b745633 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/conferences/response/ConferencesResponseDtoTest.java @@ -0,0 +1,28 @@ +package com.sinch.sdk.domains.voice.models.v1.conferences.response; + +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.voice.models.v1.conferences.ConferenceParticipantTest; +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class ConferencesResponseDtoTest extends BaseTest { + + @GivenJsonResource("/domains/voice/v1/conferences/response/ConferenceGetResponseDto.json") + GetConferenceInfoResponse loadedGetConferenceInfoResponseDto; + + public static GetConferenceInfoResponse expectedGetConferenceInfoResponseDto = + GetConferenceInfoResponse.builder() + .setParticipants( + Arrays.asList(ConferenceParticipantTest.expectedGetConferenceInfoResponseDto)) + .build(); + + @Test + void deserializeGetConferenceInfoResponseDto() { + TestHelpers.recursiveEquals( + loadedGetConferenceInfoResponseDto, expectedGetConferenceInfoResponseDto); + } +} 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 new file mode 100644 index 000000000..f4d23db8b --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/destination/DestinationTest.java @@ -0,0 +1,92 @@ +package com.sinch.sdk.domains.voice.models.v1.destination; + +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.voice.adapters.VoiceBaseTest; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +class DestinationTest extends VoiceBaseTest { + + public static DestinationMxp userName = + DestinationMxp.builder().setEndpoint("user name value").build(); + + public static DestinationPstn number = + DestinationPstn.builder().setEndpoint("+123456789").build(); + + public static DestinationSip sip = DestinationSip.builder().setEndpoint("sip value").build(); + + public static DestinationDid did = DestinationDid.builder().setEndpoint("did value").build(); + + @GivenTextResource("/domains/voice/v1/destination/DestinationMxpDto.json") + String jsonUserName; + + @GivenTextResource("/domains/voice/v1/destination/DestinationPstnDto.json") + String jsonNumber; + + @GivenTextResource("/domains/voice/v1/destination/DestinationSipDto.json") + String jsonSip; + + @GivenTextResource("/domains/voice/v1/destination/DestinationDidDto.json") + String jsonDid; + + @Test + void serializeMxp() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(userName); + + JSONAssert.assertEquals(jsonUserName, serializedString, true); + } + + @Test + void deserializeMxp() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonUserName, Destination.class); + + TestHelpers.recursiveEquals(userName, expected); + } + + @Test + void serializePstn() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(number); + + JSONAssert.assertEquals(jsonNumber, serializedString, true); + } + + @Test + void deserializePstn() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonNumber, Destination.class); + + TestHelpers.recursiveEquals(number, expected); + } + + @Test + void serializeSIP() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(sip); + + JSONAssert.assertEquals(jsonSip, serializedString, true); + } + + @Test + void deserializeSIP() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonSip, Destination.class); + + TestHelpers.recursiveEquals(sip, expected); + } + + @Test + void serializeDID() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(did); + + JSONAssert.assertEquals(jsonDid, serializedString, true); + } + + @Test + void deserializeDID() throws JsonProcessingException { + Destination expected = objectMapper.readValue(jsonDid, Destination.class); + + TestHelpers.recursiveEquals(did, expected); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlTest.java new file mode 100644 index 000000000..b012cdea9 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/SvamlControlTest.java @@ -0,0 +1,50 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml; + +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.domains.voice.models.v1.svaml.action.SvamlActionConnectConference; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.StartRecordingOptions; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionStartRecording; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.TranscriptionOptions; +import java.util.Arrays; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlControlTest extends BaseTest { + + public static SvamlControl expectedSvamlControl = + SvamlControl.builder() + .setAction( + SvamlActionConnectConference.builder().setConferenceId("My Conference Id").build()) + .setInstructions( + Arrays.asList( + SvamlInstructionSay.builder().setText("Hello from instruction").build(), + SvamlInstructionStartRecording.builder() + .setOptions( + StartRecordingOptions.builder() + .setDestinationUrl("s3://my-bucket/") + .setCredentials( + "AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY:eu-central-1") + .setNotificationEvents(true) + .setTranscriptionOptions( + TranscriptionOptions.builder().setEnabled(true).build()) + .build()) + .build())) + .build(); + + @GivenTextResource("/domains/voice/v1/svaml/SvamlControlDto.json") + String jsonSvamlControlDto; + + @Test + void serializeSVAMLResponse() throws JsonProcessingException, JSONException { + + String serializedString = objectMapper.writeValueAsString(expectedSvamlControl); + + JSONAssert.assertEquals(jsonSvamlControlDto, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceTest.java new file mode 100644 index 000000000..f77002f61 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectConferenceTest.java @@ -0,0 +1,38 @@ +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 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.conferences.ConferenceDtmfOptions.ModeEnum; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlActionConnectConferenceTest extends BaseTest { + + public static SvamlActionConnectConference dto = + SvamlActionConnectConference.builder() + .setConferenceId("My Conference Id") + .setConferenceDtmfOptions( + ConferenceDtmfOptions.builder() + .setMode(ModeEnum.FORWARD) + .setMaxDigits(45) + .setTimeoutMills(456) + .build()) + .setMusicOnHold(MusicOnHold.MUSIC3) + .build(); + + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionConnectConferenceDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionPlayFilesDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpTest.java similarity index 50% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionPlayFilesDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpTest.java index f740c5d08..33b233ba5 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionPlayFilesDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectMxpTest.java @@ -1,26 +1,27 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; +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 com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionPlayFilesDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionPlayFilesDto.NameEnum; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationMxp; import java.util.Collections; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class InstructionPlayFilesDtoTest extends BaseTest { +public class SvamlActionConnectMxpTest extends BaseTest { - public static SvamlInstructionPlayFilesDto dto = - new SvamlInstructionPlayFilesDto() - .name(NameEnum.PLAYFILES.getValue()) - .ids(Collections.singletonList("[Welcome]")) - .locale("en"); + public static SvamlActionConnectMxp dto = + SvamlActionConnectMxp.builder() + .setDestination(DestinationMxp.from("a user string")) + .setCallheaders( + Collections.singletonList( + CallHeader.builder().setKey("left string").setValue("right string").build())) + .build(); - @GivenTextResource("/domains/voice/svaml/InstructionPlayFilesDto.json") + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionConnectMxpDto.json") String json; @Test 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 new file mode 100644 index 000000000..f5433cc76 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectPstnTest.java @@ -0,0 +1,38 @@ +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 com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn.IndicationsEnum; +import com.sinch.sdk.models.DualToneMultiFrequency; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlActionConnectPstnTest extends BaseTest { + + public static SvamlActionConnectPstn dto = + 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(); + + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionConnectPstnDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipTest.java new file mode 100644 index 000000000..7c4873012 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionConnectSipTest.java @@ -0,0 +1,40 @@ +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 com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationSip; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectSip.TransportEnum; +import java.util.Collections; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlActionConnectSipTest extends BaseTest { + + public static SvamlActionConnectSip dto = + SvamlActionConnectSip.builder() + .setDestination(DestinationSip.from("a sip string")) + .setMaxDuration(456) + .setCli("a cli value") + .setTransport(TransportEnum.TLS) + .setSuppressCallbacks(true) + .setCallHeaders( + Collections.singletonList( + CallHeader.builder().setKey("left string").setValue("right string").build())) + .setMusicOnHold(MusicOnHold.MUSIC2) + .build(); + + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionConnectSipDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionHangUpDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueTest.java similarity index 57% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionHangUpDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueTest.java index f2a0eb47e..5a584366b 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionHangUpDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionContinueTest.java @@ -1,22 +1,19 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; +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 com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionHangupDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionHangupDto.NameEnum; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class ActionHangUpDtoTest extends BaseTest { +public class SvamlActionContinueTest extends BaseTest { - public static SvamlActionHangupDto dto = - new SvamlActionHangupDto().name(NameEnum.HANGUP.getValue()); + public static SvamlActionContinue dto = SvamlActionContinue.DEFAULT; - @GivenTextResource("/domains/voice/svaml/ActionHangUpDto.json") + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionContinueDto.json") String json; @Test diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionContinueDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupTest.java similarity index 56% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionContinueDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupTest.java index 181059335..f9fa51857 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/ActionContinueDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionHangupTest.java @@ -1,22 +1,19 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; +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 com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionContinueDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlActionContinueDto.NameEnum; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class ActionContinueDtoTest extends BaseTest { +public class SvamlActionHangupTest extends BaseTest { - public static SvamlActionContinueDto dto = - new SvamlActionContinueDto().name(NameEnum.CONTINUE.getValue()); + public static SvamlActionHangup dto = SvamlActionHangup.DEFAULT; - @GivenTextResource("/domains/voice/svaml/ActionContinueDto.json") + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionHangupDto.json") String json; @Test diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionAnswerDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkTest.java similarity index 55% rename from openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionAnswerDtoTest.java rename to openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkTest.java index e83f65648..95d4584b2 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/dto/svaml/InstructionAnswerDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionParkTest.java @@ -1,22 +1,25 @@ -package com.sinch.sdk.domains.voice.models.dto.svaml; +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 com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionAnswerDto; -import com.sinch.sdk.domains.voice.models.dto.v1.SvamlInstructionAnswerDto.NameEnum; import org.json.JSONException; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; @TestWithResources -public class InstructionAnswerDtoTest extends BaseTest { +public class SvamlActionParkTest extends BaseTest { - public static SvamlInstructionAnswerDto dto = - new SvamlInstructionAnswerDto().name(NameEnum.ANSWER.getValue()); + public static SvamlActionPark dto = + SvamlActionPark.builder() + .setLocale("en") + .setIntroPrompt("intro prompt") + .setHoldPrompt("hold prompt") + .setMaxDuration(456) + .build(); - @GivenTextResource("/domains/voice/svaml/InstructionAnswerDto.json") + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionParkDto.json") String json; @Test diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuTest.java new file mode 100644 index 000000000..7538d2407 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/action/SvamlActionRunMenuTest.java @@ -0,0 +1,50 @@ +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 com.sinch.sdk.models.DualToneMultiFrequency; +import java.util.Collections; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlActionRunMenuTest extends BaseTest { + + public static SvamlActionRunMenu dto = + SvamlActionRunMenu.builder() + .setBarge(true) + .setLocale("fr") + .setMainMenu(" the main menu") + .setEnableVoice(false) + .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() + .setDtmf(DualToneMultiFrequency.valueOf("#w")) + .setAction("menu(foo)") + .build())) + .build())) + .build(); + + @GivenTextResource("/domains/voice/v1/svaml/action/SvamlActionRunMenuDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerTest.java new file mode 100644 index 000000000..b734e16c7 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionAnswerTest.java @@ -0,0 +1,25 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionAnswerTest extends BaseTest { + + public static SvamlInstructionAnswer dto = SvamlInstructionAnswer.DEFAULT; + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionAnswerDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesTest.java new file mode 100644 index 000000000..fd5357e8f --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionPlayFilesTest.java @@ -0,0 +1,30 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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.util.Collections; +import org.json.JSONException; +import org.junit.jupiter.api.Test; +import org.skyscreamer.jsonassert.JSONAssert; + +@TestWithResources +public class SvamlInstructionPlayFilesTest extends BaseTest { + + public static SvamlInstructionPlayFiles dto = + SvamlInstructionPlayFiles.builder() + .setIds(Collections.singletonList("[Welcome]")) + .setLocale("en") + .build(); + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionPlayFilesDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayTest.java new file mode 100644 index 000000000..65d3b16cb --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSayTest.java @@ -0,0 +1,26 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionSayTest extends BaseTest { + + public static SvamlInstructionSay dto = + SvamlInstructionSay.builder().setText("[Welcome]").setLocale("en").build(); + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionSayDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfDtoTest.java new file mode 100644 index 000000000..cf5024ac9 --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSendDtmfDtoTest.java @@ -0,0 +1,26 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionSendDtmfDtoTest extends BaseTest { + + public static SvamlInstructionSendDtmf dto = + SvamlInstructionSendDtmf.builder().setValue("ww123#").build(); + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionSendDtmfDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieTest.java new file mode 100644 index 000000000..e1cbac51b --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionSetCookieTest.java @@ -0,0 +1,26 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionSetCookieTest extends BaseTest { + + public static SvamlInstructionSetCookie dto = + SvamlInstructionSetCookie.builder().setKey("a key").setValue("a value").build(); + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionSetCookieDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingTest.java new file mode 100644 index 000000000..3b77ae75f --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStartRecordingTest.java @@ -0,0 +1,36 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionStartRecordingTest extends BaseTest { + + public static SvamlInstructionStartRecording dto = + SvamlInstructionStartRecording.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(); + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionStartRecordingDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingTest.java new file mode 100644 index 000000000..73869398b --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/svaml/instruction/SvamlInstructionStopRecordingTest.java @@ -0,0 +1,25 @@ +package com.sinch.sdk.domains.voice.models.v1.svaml.instruction; + +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 SvamlInstructionStopRecordingTest extends BaseTest { + + public static SvamlInstructionStopRecording dto = SvamlInstructionStopRecording.DEFAULT; + + @GivenTextResource("/domains/voice/v1/svaml/instruction/SvamlInstructionStopRecordingDto.json") + String json; + + @Test + void serialize() throws JsonProcessingException, JSONException { + String serializedString = objectMapper.writeValueAsString(dto); + + JSONAssert.assertEquals(json, serializedString, true); + } +} 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 new file mode 100644 index 000000000..8db50ea4b --- /dev/null +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/voice/models/v1/webhooks/VoiceWebhookEventTest.java @@ -0,0 +1,136 @@ +package com.sinch.sdk.domains.voice.models.v1.webhooks; + +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.voice.models.v1.Domain; +import com.sinch.sdk.domains.voice.models.v1.Price; +import com.sinch.sdk.domains.voice.models.v1.calls.response.CallResult; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.CallHeader; +import com.sinch.sdk.domains.voice.models.v1.webhooks.AnsweredCallEventAnsweringMachineDetection.StatusEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.DisconnectedCallEvent.ReasonEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.InputMethodEnum; +import com.sinch.sdk.domains.voice.models.v1.webhooks.MenuResult.TypeEnum; +import java.time.Instant; +import java.util.Collections; +import org.junit.jupiter.api.Test; + +@TestWithResources +public class VoiceWebhookEventTest extends BaseTest { + + @GivenJsonResource("/domains/voice/v1/webhooks/IncomingCallEventDto.json") + IncomingCallEvent loadedIceRequestDto; + + @GivenJsonResource("/domains/voice/v1/webhooks/DisconnectedCallEventDto.json") + DisconnectedCallEvent loadedDiceRequestDto; + + @GivenJsonResource("/domains/voice/v1/webhooks/AnsweredCallEventDto.json") + AnsweredCallEvent loadedAceRequestDto; + + @GivenJsonResource("/domains/voice/v1/webhooks/PromptInputEventDto.json") + PromptInputEvent loadedPieRequestDto; + + @GivenJsonResource("/domains/voice/v1/webhooks/NotificationEventDto.json") + NotificationEvent loadedNotifyRequestDto; + + public static IncomingCallEvent expectedIceRequestDto = + IncomingCallEvent.builder() + .setCallid("a call id") + .setVersion(1) + .setCallResourceUrl("https://calling-euc1.api.sinch.com/calling/v1/calls/id/a call id") + .setTimestamp(Instant.parse("2024-01-16T16:46:36Z")) + .setCustom("my custom") + .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.0F).build()) + .setCli("cli number") + .setTo(DestinationPstn.from("+123456879")) + .setDomain(Domain.MXP) + .setApplicationKey("an app key") + .setOriginationType(Domain.MXP2) + .setRdnis("rdnis value") + .setCallHeaders( + Collections.singletonList( + CallHeader.builder().setKey("the key").setValue("the value").build())) + .build(); + + public static DisconnectedCallEvent expectedDiceRequestDto = + DisconnectedCallEvent.builder() + .setCallid("a call id") + .setTimestamp(Instant.parse("2024-01-19T12:49:53Z")) + .setVersion(1) + .setCustom("my custom value") + .setTo(DestinationPstn.from("123456789")) + .setApplicationKey("an app key") + .setResult(CallResult.ANSWERED) + .setReason(ReasonEnum.MANAGERHANGUP) + .setFrom("private") + .setDuration(1) + .setDebit(Price.builder().setCurrencyId("EUR").setAmount(0.1758F).build()) + .setUserRate(Price.builder().setCurrencyId("USD").setAmount(0.345F).build()) + .build(); + + public static AnsweredCallEvent expectedAceRequestDto = + AnsweredCallEvent.builder() + .setCallid("a call id") + .setTimestamp(Instant.parse("2024-01-19T12:49:53Z")) + .setVersion(1) + .setCustom("my custom value") + .setApplicationKey("my application key") + .setAmd( + AnsweredCallEventAnsweringMachineDetection.builder() + .setStatus(StatusEnum.HUMAN) + .setReason(AnsweredCallEventAnsweringMachineDetection.ReasonEnum.LONGGREETING) + .setDuration(15) + .build()) + .build(); + + public static PromptInputEvent expectedPieRequestDto = + PromptInputEvent.builder() + .setCallid("a call id") + .setTimestamp(Instant.parse("2024-01-23T15:04:28Z")) + .setVersion(1) + .setCustom("my custom value") + .setApplicationKey("my application key") + .setMenuResult( + MenuResult.builder() + .setMenuId("confirm") + .setType(TypeEnum.SEQUENCE) + .setValue("1452") + .setInputMethod(InputMethodEnum.DTMF) + .build()) + .build(); + + public static NotificationEvent expectedNotifyRequestDto = + NotificationEvent.builder() + .setCallid("a call id") + .setVersion(1) + .setCustom("my custom value") + .setType("recording_finished") + .build(); + + @Test + void deserializeIceRequest() { + TestHelpers.recursiveEquals(loadedIceRequestDto, expectedIceRequestDto); + } + + @Test + void deserializeDiceRequest() { + TestHelpers.recursiveEquals(loadedDiceRequestDto, expectedDiceRequestDto); + } + + @Test + void deserializeAceRequest() { + TestHelpers.recursiveEquals(loadedAceRequestDto, expectedAceRequestDto); + } + + @Test + void deserializePieRequest() { + TestHelpers.recursiveEquals(loadedPieRequestDto, expectedPieRequestDto); + } + + @Test + void deserializeNotifyRequest() { + TestHelpers.recursiveEquals(loadedNotifyRequestDto, expectedNotifyRequestDto); + } +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/PriceDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/PriceDto.json new file mode 100644 index 000000000..5b039ee42 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/PriceDto.json @@ -0,0 +1,4 @@ + { + "amount": 0.123456, + "currencyId": "EUR" + } diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsUnassignNumberRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UnAssignNumberRequestDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsUnassignNumberRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UnAssignNumberRequestDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetCallbackUrlsRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UpdateCallbackUrlsRequestDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetCallbackUrlsRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UpdateCallbackUrlsRequestDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsUpdateNumbersRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UpdateNumbersRequestDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsUpdateNumbersRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/request/UpdateNumbersRequestDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetCallbackUrlsResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/response/GetCallbackUrlsResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetCallbackUrlsResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/response/GetCallbackUrlsResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetNumbersResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/response/OwnedNumbersResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsGetNumbersResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/response/OwnedNumbersResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsQueryNumberResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/applications/response/QueryNumberResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ApplicationsQueryNumberResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/applications/response/QueryNumberResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestConferenceDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestConferenceDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestConferenceDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestConferenceDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestCustomDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestCustomDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestCustomDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestCustomDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestTtsDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestTtsDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/CalloutRequestTtsDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutRequestTtsDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/CalloutResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/CalloutResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/callouts/CalloutResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/CallsGetInformationResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/calls/GetCallInformationResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/CallsGetInformationResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/calls/GetCallInformationResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/conferences/ConferenceParticipantDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/conferences/ConferenceParticipantDto.json new file mode 100644 index 000000000..5bc584cfd --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/conferences/ConferenceParticipantDto.json @@ -0,0 +1,8 @@ +{ + "cli": "a cli", + "id": "an id", + "duration": 5, + "muted": true, + "onhold": false +} + diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ConferenceManageParticipantRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/conferences/request/ConferenceManageParticipantRequestDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ConferenceManageParticipantRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/conferences/request/ConferenceManageParticipantRequestDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/ConferenceGetResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/conferences/response/ConferenceGetResponseDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/v1/ConferenceGetResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/conferences/response/ConferenceGetResponseDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationDidDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationDidDto.json new file mode 100644 index 000000000..6a434d34b --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationDidDto.json @@ -0,0 +1,4 @@ +{ + "type": "did", + "endpoint": "did value" +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpDto.json new file mode 100644 index 000000000..1029904ea --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationMxpDto.json @@ -0,0 +1,4 @@ +{ + "type": "username", + "endpoint": "user name value" +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnDto.json new file mode 100644 index 000000000..2af992112 --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationPstnDto.json @@ -0,0 +1,4 @@ +{ + "type": "number", + "endpoint": "+123456789" +} diff --git a/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationSipDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationSipDto.json new file mode 100644 index 000000000..6857d6f5e --- /dev/null +++ b/openapi-contracts/src/test/resources/domains/voice/v1/destination/DestinationSipDto.json @@ -0,0 +1,4 @@ +{ + "type": "sip", + "endpoint": "sip value" +} diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/SVAMLResponseDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/SvamlControlDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/SVAMLResponseDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/SvamlControlDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectConferenceDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectConferenceDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectConferenceDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectConferenceDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectMxpDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectMxpDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectMxpDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectMxpDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectPstnDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectPstnDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectPstnDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectPstnDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectSipDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectSipDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionConnectSipDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionConnectSipDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionContinueDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionContinueDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionContinueDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionContinueDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionHangUpDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionHangupDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionHangUpDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionHangupDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionParkDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionParkDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionParkDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionParkDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/ActionRunMenuDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionRunMenuDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/ActionRunMenuDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/action/SvamlActionRunMenuDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionAnswerDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionAnswerDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionAnswerDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionAnswerDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionPlayFilesDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionPlayFilesDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionPlayFilesDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionPlayFilesDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSayDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSayDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSayDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSayDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSendDtfmDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSendDtmfDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSendDtfmDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSendDtmfDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSetCookieDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSetCookieDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionSetCookieDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionSetCookieDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionStartRecordingDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionStartRecordingDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionStartRecordingDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionStartRecordingDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/svaml/InstructionStopRecordingDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionStopRecordingDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/svaml/InstructionStopRecordingDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/svaml/instruction/SvamlInstructionStopRecordingDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/AceRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/webhooks/AnsweredCallEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/AceRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/webhooks/AnsweredCallEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/DiceRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/webhooks/DisconnectedCallEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/DiceRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/webhooks/DisconnectedCallEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/IceRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/webhooks/IncomingCallEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/IceRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/webhooks/IncomingCallEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/NotifyRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/webhooks/NotificationEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/NotifyRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/webhooks/NotificationEventDto.json diff --git a/openapi-contracts/src/test/resources/domains/voice/webhooks/PieRequestDto.json b/openapi-contracts/src/test/resources/domains/voice/v1/webhooks/PromptInputEventDto.json similarity index 100% rename from openapi-contracts/src/test/resources/domains/voice/webhooks/PieRequestDto.json rename to openapi-contracts/src/test/resources/domains/voice/v1/webhooks/PromptInputEventDto.json diff --git a/pom.xml b/pom.xml index b95d3d34c..9719e6bdc 100644 --- a/pom.xml +++ b/pom.xml @@ -162,6 +162,16 @@ 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 + 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 @@ -309,6 +319,14 @@ integration-test verify + + + com.sinch.sdk.e2e.domains.conversation.ConversationIT + com.sinch.sdk.e2e.domains.voice.v0.VoiceIT + com.sinch.sdk.e2e.domains.voice.v1.VoiceIT + + + diff --git a/sample-app/src/main/java/com/sinch/sample/voice/ConferencesSampleFlow.java b/sample-app/src/main/java/com/sinch/sample/voice/ConferencesSampleFlow.java index c1bffbcc9..c432c587b 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/ConferencesSampleFlow.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/ConferencesSampleFlow.java @@ -8,14 +8,16 @@ import com.sinch.sample.Utils; import com.sinch.sdk.SinchClient; import com.sinch.sdk.core.exceptions.ApiException; -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.domains.voice.api.v1.CallsService; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; +import com.sinch.sdk.domains.voice.models.v1.conferences.ConferenceParticipant; +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 com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; import com.sinch.sdk.models.Configuration; -import com.sinch.sdk.models.E164PhoneNumber; import java.util.Collection; import java.util.Collections; import java.util.Optional; @@ -53,56 +55,59 @@ public void run(Configuration configuration, String conferenceId, String phoneNu SinchClient sinch = new SinchClient(configuration); + ConferencesService service = sinch.voice().v1().conferences(); + CallsService callsService = sinch.voice().v1().calls(); + int step = 0; // 1. Joining conference - var callId = joinConference(++step, sinch, conferenceId, phoneNumber); + var callId = joinConference(++step, service, conferenceId, phoneNumber); // 2. Waiting for participant to join the conference (trying during 1 minute) - waitForParticipant(++step, sinch, conferenceId, callId); + waitForParticipant(++step, service, conferenceId, callId); // 3. Get participant information - getCallInformation(++step, sinch, conferenceId, callId); + getCallInformation(++step, callsService, callId); // 4. Mute participant - muteParticipant(++step, sinch, conferenceId, callId); + muteParticipant(++step, service, conferenceId, callId); Thread.sleep(3000); // 5. Get conference information - getConferenceInfo(++step, sinch, conferenceId); + getConferenceInfo(++step, service, conferenceId); // 6. Get participant information - getCallInformation(++step, sinch, conferenceId, callId); + getCallInformation(++step, callsService, callId); // 7. Kick all participants - kickAllParticipants(++step, sinch, conferenceId); + kickAllParticipants(++step, service, conferenceId); Thread.sleep(3000); // 8. Get participant information - getCallInformation(++step, sinch, conferenceId, callId); + getCallInformation(++step, callsService, callId); // 9. Get conference information - getConferenceInfo(++step, sinch, conferenceId); + getConferenceInfo(++step, service, conferenceId); } String joinConference( - int step, SinchClient sinchClient, String conferenceId, String phoneNumber) { + int step, ConferencesService service, String conferenceId, String phoneNumber) { echoStep( step, "Join conference '%s' for phone number '%s'".formatted(conferenceId, phoneNumber)); // 1. Build the request payload var payload = - CalloutRequestParametersConference.builder() + CalloutRequestConference.builder() .setConferenceId(conferenceId) - .setDestination(DestinationNumber.valueOf(phoneNumber)) + .setDestination(DestinationPstn.from(phoneNumber)) .setGreeting("Hello from Sinch Conference sample with Jav SDK") - .setMusicOnHold(MusicOnHoldType.MUSIC1) - .setCli(E164PhoneNumber.valueOf("+1123456789")) + .setMusicOnHold(MusicOnHold.MUSIC1) + .setCli("+1123456789") .build(); // 2. Perform the request - var response = sinchClient.voice().conferences().call(payload); + var response = service.call(payload); echo("The callId for conference is '%s'\n".formatted(response)); @@ -110,7 +115,7 @@ String joinConference( return response; } - void waitForParticipant(int step, SinchClient sinchClient, String conferenceId, String callId) + void waitForParticipant(int step, ConferencesService service, String conferenceId, String callId) throws InterruptedException { echoStep(step, "Waiting for participant to join the conference'"); @@ -123,7 +128,7 @@ void waitForParticipant(int step, SinchClient sinchClient, String conferenceId, echo("Attempt: '%d'\n".formatted(i + 1)); // Get conference info - var participants = getConferenceInfo(++step, sinchClient, conferenceId); + var participants = getConferenceInfo(++step, service, conferenceId); // Looking for participant participant = participants.stream().filter(f -> f.getId().equals(callId)).findFirst(); } @@ -139,51 +144,49 @@ void waitForParticipant(int step, SinchClient sinchClient, String conferenceId, } Collection getConferenceInfo( - int step, SinchClient sinchClient, String conferenceId) { + int step, ConferencesService service, String conferenceId) { echoStep(step, "Getting information for conference '%s'".formatted(conferenceId)); // 1. Request for conference information - Collection response = Collections.emptyList(); + Collection list = Collections.emptyList(); try { - response = sinchClient.voice().conferences().get(conferenceId); + GetConferenceInfoResponse response = service.get(conferenceId); + list = response.getParticipants(); } catch (ApiException e) { // NOP } // 2. return the phone number echo("Conference participants are:"); - response.stream().iterator().forEachRemaining(f -> echo("- %s".formatted(f))); + list.stream().iterator().forEachRemaining(f -> echo("- %s".formatted(f))); - return response; + return list; } - void getCallInformation(int step, SinchClient sinchClient, String conferenceId, String callId) { + void getCallInformation(int step, CallsService service, String callId) { echoStep(step, "Get call information for participant '%s'".formatted(callId)); - var response = sinchClient.voice().calls().get(callId); + var response = service.get(callId); echo("Call information: %s".formatted(response)); } - void muteParticipant(int step, SinchClient sinchClient, String conferenceId, String callId) { + void muteParticipant(int step, ConferencesService service, String conferenceId, String callId) { echoStep(step, "Muting participant '%s'".formatted(callId)); - var payload = - ConferenceManageParticipantRequestParameters.builder() - .setCommand(ConferenceManageParticipantCommandType.MUTE) - .build(); + var payload = ManageConferenceParticipantRequest.builder().setCommand(CommandEnum.MUTE).build(); - sinchClient.voice().conferences().manageParticipant(conferenceId, callId, payload); + service.manageParticipant(conferenceId, callId, payload); echo("Conference participants muted\n"); } - void kickAllParticipants(int step, SinchClient sinchClient, String conferenceId) { + void kickAllParticipants(int step, ConferencesService service, String conferenceId) { echoStep(step, "Kicking all participants"); - sinchClient.voice().conferences().kickAll(conferenceId); + service.kickAll(conferenceId); echo("Done\n"); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/AssignNumbers.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/AssignNumbers.java index a0ce1f3a3..58aacdba8 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/AssignNumbers.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/AssignNumbers.java @@ -1,9 +1,9 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.CapabilityType; -import com.sinch.sdk.domains.voice.models.requests.ApplicationsAssignNumbersRequestParameters; -import com.sinch.sdk.models.E164PhoneNumber; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; +import com.sinch.sdk.domains.voice.models.v1.applications.Capability; +import com.sinch.sdk.domains.voice.models.v1.applications.request.UpdateNumbersRequest; import java.io.IOException; import java.util.List; import java.util.logging.Logger; @@ -25,16 +25,15 @@ public static void main(String[] args) { public void run() { - LOGGER.info("Update numbers '%s'".formatted(phoneNumber)); - - client - .voice() - .applications() - .assignNumbers( - ApplicationsAssignNumbersRequestParameters.builder() - .setNumbers(List.of(E164PhoneNumber.valueOf(phoneNumber))) - .setApplicationKey(applicationKey) - .setCapability(CapabilityType.VOICE) - .build()); + ApplicationsService service = client.voice().v1().applications(); + + LOGGER.info("Update numbers '%s'".formatted(virtualPhoneNumber)); + + service.assignNumbers( + UpdateNumbersRequest.builder() + .setNumbers(List.of(virtualPhoneNumber)) + .setApplicationKey(applicationKey) + .setCapability(Capability.VOICE) + .build()); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/GetCallbackUrls.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/GetCallbackUrls.java index 257550b58..7e564c8ad 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/GetCallbackUrls.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/GetCallbackUrls.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; import java.io.IOException; import java.util.logging.Logger; @@ -21,9 +22,11 @@ public static void main(String[] args) { public void run() { + ApplicationsService service = client.voice().v1().applications(); + LOGGER.info("Get callback URLs for application key '%s'".formatted(applicationKey)); - var response = client.voice().applications().getCallbackUrls(applicationKey); + var response = service.getCallbackUrls(applicationKey); LOGGER.info("Response: " + response); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/ListNumbers.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/ListNumbers.java index 256bfdd5d..1d18dc041 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/ListNumbers.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/ListNumbers.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; import java.io.IOException; import java.util.logging.Logger; @@ -21,9 +22,11 @@ public static void main(String[] args) { public void run() { + ApplicationsService service = client.voice().v1().applications(); + LOGGER.info("Get assigned numbers"); - var response = client.voice().applications().listNumbers(); + var response = service.listNumbers(); LOGGER.info("Response: " + response); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/QueryNumber.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/QueryNumber.java index c8b1f6b4d..e54b2c86c 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/QueryNumber.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/QueryNumber.java @@ -1,7 +1,7 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.models.E164PhoneNumber; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; import java.io.IOException; import java.util.logging.Logger; @@ -22,9 +22,11 @@ public static void main(String[] args) { public void run() { - LOGGER.info("Query number '%s'".formatted(phoneNumber)); + ApplicationsService service = client.voice().v1().applications(); - var response = client.voice().applications().queryNumber(E164PhoneNumber.valueOf(phoneNumber)); + LOGGER.info("Query number '%s'".formatted(virtualPhoneNumber)); + + var response = service.queryNumber(virtualPhoneNumber); LOGGER.info("Response: " + response); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/UnassignNumber.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/UnassignNumber.java index 8da94cbac..91278b45d 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/UnassignNumber.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/UnassignNumber.java @@ -1,7 +1,8 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.models.E164PhoneNumber; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; +import com.sinch.sdk.domains.voice.models.v1.applications.request.UnAssignNumberRequest; import java.io.IOException; import java.util.logging.Logger; @@ -22,12 +23,17 @@ public static void main(String[] args) { public void run() { - LOGGER.info( - "Un-assign number '%s' from application '%s'".formatted(phoneNumber, applicationKey)); + ApplicationsService service = client.voice().v1().applications(); - client - .voice() - .applications() - .unassignNumber(E164PhoneNumber.valueOf(phoneNumber), applicationKey); + LOGGER.info( + "Un-assign number '%s' from application '%s'" + .formatted(virtualPhoneNumber, applicationKey)); + + UnAssignNumberRequest request = + UnAssignNumberRequest.builder() + .setNumber(virtualPhoneNumber) + .setApplicationKey(applicationKey) + .build(); + service.unassignNumber(request); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/applications/UpdateCallbackUrls.java b/sample-app/src/main/java/com/sinch/sample/voice/applications/UpdateCallbackUrls.java index 5b8b8734f..04edc6603 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/applications/UpdateCallbackUrls.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/applications/UpdateCallbackUrls.java @@ -1,8 +1,9 @@ package com.sinch.sample.voice.applications; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.ApplicationURL; -import com.sinch.sdk.domains.voice.models.CallbackUrls; +import com.sinch.sdk.domains.voice.api.v1.ApplicationsService; +import com.sinch.sdk.domains.voice.models.v1.applications.Callbacks; +import com.sinch.sdk.domains.voice.models.v1.applications.CallbacksUrl; import java.io.IOException; import java.util.logging.Logger; @@ -23,17 +24,20 @@ public static void main(String[] args) { public void run() { + ApplicationsService service = client.voice().v1().applications(); + var urls = - CallbackUrls.builder() + Callbacks.builder() .setUrl( - ApplicationURL.builder() - .setPrimary("primary value") + CallbacksUrl.builder() + .setPrimary(webhooksVoicePath.get()) .setFallback("fallback value") .build()) .build(); + LOGGER.info( "Update callback URLs for application key '%s': '%s'".formatted(applicationKey, urls)); - client.voice().applications().updateCallbackUrls(applicationKey, urls); + service.updateCallbackUrls(applicationKey, urls); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/callouts/Call.java b/sample-app/src/main/java/com/sinch/sample/voice/callouts/Call.java index f98b414aa..b62384ecd 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/callouts/Call.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/callouts/Call.java @@ -1,23 +1,21 @@ package com.sinch.sample.voice.callouts; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.DomainType; -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.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.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.api.v1.CalloutsService; +import com.sinch.sdk.domains.voice.models.v1.Domain; +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.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.Menu; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOption; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.MenuOptionActionFactory; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionConnectPstn; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionRunMenu; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; import java.io.IOException; import java.util.Arrays; import java.util.logging.Logger; @@ -39,47 +37,50 @@ public static void main(String[] args) { public void run() { + CalloutsService service = client.voice().v1().callouts(); + LOGGER.info("Start call for: " + phoneNumber); - CalloutRequestParameters parameters = getTextToSpeechRequest(); - // getCalloutRequest(); - // getConferenceRequest(); + // CalloutRequestTTS parameters = getTextToSpeechRequest(); + // CalloutRequestCustom parameters = getCalloutRequest(); + CalloutRequestConference parameters = getConferenceRequest(); - var response = client.voice().callouts().call(parameters); + var response = service.call(parameters); LOGGER.info("Response: " + response); } - private CalloutRequestParametersTTS getTextToSpeechRequest() { - return CalloutRequestParametersTTS.builder() - .setDestination(DestinationNumber.valueOf(phoneNumber)) + private CalloutRequestTTS getTextToSpeechRequest() { + return CalloutRequestTTS.builder() + .setDestination(DestinationPstn.from(phoneNumber)) .setEnableAce(true) .setEnableDice(true) .setEnablePie(true) .setText("Hello") - .setDtfm(DualToneMultiFrequency.valueOf("w#1")) + .setDtmf(DualToneMultiFrequency.valueOf("w#1")) .build(); } - private CalloutRequestParametersCustom getCalloutRequest() { + private CalloutRequestCustom getCalloutRequest() { - CalloutRequestParametersCustom.Builder builder = - CalloutRequestParametersCustom.builder() + CalloutRequestCustom.Builder builder = + CalloutRequestCustom.builder() .setCustom("my custom value") .setIce( - SVAMLControl.builder() + SvamlControl.builder() .setAction( - ActionConnectPstn.builder() - .setNumber(E164PhoneNumber.valueOf(phoneNumber)) + SvamlActionConnectPstn.builder() + .setNumber(phoneNumber) .setCli("+123456789") .build()) .setInstructions( - Arrays.asList(InstructionSay.builder().setText("Hello from Sinch").build())) + Arrays.asList( + SvamlInstructionSay.builder().setText("Hello from Sinch").build())) .build()) .setAce( - SVAMLControl.builder() + SvamlControl.builder() .setAction( - ActionRunMenu.builder() + SvamlActionRunMenu.builder() .setLocale("Kimberly") .setEnableVoice(true) .setMenus( @@ -94,16 +95,16 @@ private CalloutRequestParametersCustom getCalloutRequest() { .setOptions( Arrays.asList( MenuOption.builder() - .setDtfm(DualToneMultiFrequency.valueOf("1")) + .setDtmf(DualToneMultiFrequency.valueOf("1")) .setAction( - MenuOptionAction.from( - MenuOptionActionType.MENU, "confirm")) + MenuOptionActionFactory.menuAction( + "confirm")) .build(), MenuOption.builder() - .setDtfm(DualToneMultiFrequency.valueOf("4")) + .setDtmf(DualToneMultiFrequency.valueOf("4")) .setAction( - MenuOptionAction.from( - MenuOptionActionType.RETURN, "cancel")) + MenuOptionActionFactory.returnAction( + "cancel")) .build())) .build(), Menu.builder() @@ -121,11 +122,11 @@ private CalloutRequestParametersCustom getCalloutRequest() { return builder.build(); } - private CalloutRequestParametersConference getConferenceRequest() { - return CalloutRequestParametersConference.builder() - .setDestination(DestinationNumber.valueOf(phoneNumber)) + private CalloutRequestConference getConferenceRequest() { + return CalloutRequestConference.builder() + .setDestination(DestinationPstn.from(phoneNumber)) .setConferenceId(conferenceId) - .setDomain(DomainType.PSTN) + .setDomain(Domain.PSTN) .setCustom("my custom value") .setEnableAce(true) .setEnableDice(true) diff --git a/sample-app/src/main/java/com/sinch/sample/voice/calls/Get.java b/sample-app/src/main/java/com/sinch/sample/voice/calls/Get.java index 69eae1834..710a50d1d 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/calls/Get.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/calls/Get.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.calls; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.CallsService; import java.io.IOException; import java.util.logging.Logger; @@ -21,9 +22,11 @@ public static void main(String[] args) { public void run() { + CallsService service = client.voice().v1().calls(); + LOGGER.info("Getting call information for '%s'".formatted(callId)); - var response = client.voice().calls().get(callId); + var response = service.get(callId); LOGGER.info("Response: " + response); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/calls/ManageWithCallLeg.java b/sample-app/src/main/java/com/sinch/sample/voice/calls/ManageWithCallLeg.java index 265c7225c..7960560f4 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/calls/ManageWithCallLeg.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/calls/ManageWithCallLeg.java @@ -1,12 +1,14 @@ package com.sinch.sample.voice.calls; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.CallLegType; -import com.sinch.sdk.domains.voice.models.svaml.ActionContinue; -import com.sinch.sdk.domains.voice.models.svaml.Instruction; -import com.sinch.sdk.domains.voice.models.svaml.InstructionSay; -import com.sinch.sdk.domains.voice.models.svaml.SVAMLControl; +import com.sinch.sdk.domains.voice.api.v1.CallsService; +import com.sinch.sdk.domains.voice.models.v1.calls.request.CallLeg; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionContinue; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionPlayFiles; import java.io.IOException; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.logging.Logger; @@ -28,16 +30,22 @@ public static void main(String[] args) { public void run() { + CallsService service = client.voice().v1().calls(); + LOGGER.info( "Updating call information for '%s' (conference '%s')".formatted(callId, conferenceId)); - var action = ActionContinue.builder().build(); + var action = SvamlActionContinue.DEFAULT; - Collection instructions = + Collection instructions = Collections.singletonList( - InstructionSay.builder().setText("Hello from sample app").setLocale("en").build()); + SvamlInstructionPlayFiles.builder() + .setIds( + Arrays.asList("https://samples-files.com/samples/Audio/mp3/sample-file-4.mp3")) + .build()); + + var parameters = SvamlControl.builder().setInstructions(instructions).setAction(action).build(); - var parameters = SVAMLControl.builder().setInstructions(instructions).setAction(action).build(); - client.voice().calls().manageWithCallLeg(callId, CallLegType.BOTH, parameters); + service.manageWithCallLeg(callId, CallLeg.CALLEE, parameters); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/calls/Update.java b/sample-app/src/main/java/com/sinch/sample/voice/calls/Update.java index e7b94799e..90338f496 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/calls/Update.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/calls/Update.java @@ -1,45 +1,15 @@ package com.sinch.sample.voice.calls; import com.sinch.sample.BaseApplication; -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.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.IndicationType; -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.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.domains.voice.models.svaml.TranscriptionOptions; -import com.sinch.sdk.models.DualToneMultiFrequency; -import com.sinch.sdk.models.E164PhoneNumber; +import com.sinch.sdk.domains.voice.api.v1.CallsService; +import com.sinch.sdk.domains.voice.models.v1.svaml.SvamlControl; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlAction; +import com.sinch.sdk.domains.voice.models.v1.svaml.action.SvamlActionHangup; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstruction; +import com.sinch.sdk.domains.voice.models.v1.svaml.instruction.SvamlInstructionSay; import java.io.IOException; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.logging.Logger; public class Update extends BaseApplication { @@ -59,123 +29,18 @@ public static void main(String[] args) { public void run() { + CallsService service = client.voice().v1().calls(); + LOGGER.info( "Updating call information for '%s' (conference '%s')".formatted(callId, conferenceId)); - var actionConnectConference = - ActionConnectConference.builder() - .setConferenceId(conferenceId) - .setDtfmOptions( - ConferenceDtfmOptions.builder() - .setMode(DtfmModeType.FORWARD) - .setMaxDigits(45) - .setTimeoutMills(456) - .build()) - .setMusicOnHold(MusicOnHoldType.MUSIC3) - .build(); - - var 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")) - .build())) - .build())) - .build(); - - var actionConnectMxp = - ActionConnectMxp.builder() - .setDestination(DestinationUser.valueOf("a user string")) - .setCallheaders(List.of(new Pair<>("left string", "right string"))) - .build(); - - var 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(); - - var actionConnectSip = - ActionConnectSip.builder() - .setDestination(DestinationSip.valueOf("a sip string")) - .setMaxDuration(456) - .setCli("a cli value") - .setTransport(TransportType.TLS) - .setSuppressCallbacks(true) - .setCallHeaders(List.of(new Pair<>("left string", "right string"))) - .setMusicOnHold(MusicOnHoldType.MUSIC2) - .build(); - - var actionContinue = ActionContinue.builder().build(); - - var actionHanghup = ActionHangUp.builder().build(); - - var actionPark = - ActionPark.builder() - .setLocale("en") - .setIntroPrompt("intro prompt") - .setHoldPrompt("hold prompt") - .setMaxDuration(456) - .build(); - - var instructionAnswer = InstructionAnswer.builder().build(); - - var instructionPlayFile = - InstructionPlayFiles.builder().setIds(List.of("[Welcome]")).setLocale("en").build(); - - var instructionSay = InstructionSay.builder().setText("[Welcome]").setLocale("en").build(); - - var instructionDtfm = - InstructionSendDtfm.builder().setDtfm(DualToneMultiFrequency.valueOf("ww123#")).build(); - - var instructionSetCookie = - InstructionSetCookie.builder().setKey("a key").setValue("a value").build(); - - var instructionStartRecording = - InstructionStartRecording.builder() - .setOptions( - StartRecordingOptions.builder() - .setCredentials("foo") - .setDestinationUrl("foo") - .setFormat("mp3") - .setNotificationEvents(true) - .setTranscriptionOptions( - TranscriptionOptions.builder().setEnabled(true).setLocale("en-US").build()) - .build()) - .build(); - - var instructionStopRecording = InstructionStopRecording.builder().build(); + SvamlAction action = SvamlActionHangup.DEFAULT; + SvamlInstruction instruction = SvamlInstructionSay.builder().setText("Good bye").build(); - Action action = actionConnectPstn; - Instruction instruction = instructionStartRecording; + Collection instructions = Collections.singletonList(instruction); - Collection instructions = Collections.singletonList(instruction); + var parameters = SvamlControl.builder().setInstructions(instructions).setAction(action).build(); - var parameters = SVAMLControl.builder().setInstructions(instructions).setAction(action).build(); - client.voice().calls().update(callId, parameters); + service.update(callId, parameters); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/conferences/Call.java b/sample-app/src/main/java/com/sinch/sample/voice/conferences/Call.java index c95e8659e..ca1d4429b 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/conferences/Call.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/conferences/Call.java @@ -1,9 +1,9 @@ package com.sinch.sample.voice.conferences; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.DestinationNumber; -import com.sinch.sdk.domains.voice.models.requests.CalloutRequestParametersConference; -import com.sinch.sdk.models.E164PhoneNumber; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; +import com.sinch.sdk.domains.voice.models.v1.callouts.request.CalloutRequestConference; +import com.sinch.sdk.domains.voice.models.v1.destination.DestinationPstn; import java.io.IOException; import java.util.logging.Logger; @@ -24,17 +24,20 @@ public static void main(String[] args) { public void run() { + ConferencesService service = client.voice().v1().conferences(); + LOGGER.info( "Joining conference '%s' for phone number '%s'".formatted(conferenceId, phoneNumber)); - var parameters = - CalloutRequestParametersConference.builder() - .setDestination(DestinationNumber.valueOf(phoneNumber)) - .setCli(E164PhoneNumber.valueOf("+123456789")) + CalloutRequestConference parameters = + CalloutRequestConference.builder() + .setDestination(DestinationPstn.from(phoneNumber)) + .setCli(virtualPhoneNumber) .setConferenceId(conferenceId) .setCustom("my custom value") .build(); - var response = client.voice().callouts().call(parameters); + + var response = service.call(parameters); LOGGER.info("Response: '%s'".formatted(response)); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/conferences/Get.java b/sample-app/src/main/java/com/sinch/sample/voice/conferences/Get.java index 5a05ac266..af5ebde0b 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/conferences/Get.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/conferences/Get.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.conferences; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; import java.io.IOException; import java.util.logging.Logger; @@ -21,9 +22,11 @@ public static void main(String[] args) { public void run() { + ConferencesService service = client.voice().v1().conferences(); + LOGGER.info("Get conference info for conference '%s'".formatted(conferenceId)); - var response = client.voice().conferences().get(conferenceId); + var response = service.get(conferenceId); LOGGER.info("Response: " + response); } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickAll.java b/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickAll.java index 83d73b17b..ca2ffe422 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickAll.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickAll.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.conferences; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; import java.io.IOException; import java.util.logging.Logger; @@ -21,8 +22,10 @@ public static void main(String[] args) { public void run() { + ConferencesService service = client.voice().v1().conferences(); + LOGGER.info("Kill all participant from conference '%s'".formatted(conferenceId)); - client.voice().conferences().kickAll(conferenceId); + service.kickAll(conferenceId); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickParticipant.java b/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickParticipant.java index 72d3916fc..687a76969 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickParticipant.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/conferences/KickParticipant.java @@ -1,6 +1,7 @@ package com.sinch.sample.voice.conferences; import com.sinch.sample.BaseApplication; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; import java.io.IOException; import java.util.logging.Logger; @@ -21,8 +22,10 @@ public static void main(String[] args) { public void run() { + ConferencesService service = client.voice().v1().conferences(); + LOGGER.info("Kick participant '%s' for conference '%s".formatted(callId, conferenceId)); - client.voice().conferences().kickParticipant(conferenceId, callId); + service.kickParticipant(conferenceId, callId); } } diff --git a/sample-app/src/main/java/com/sinch/sample/voice/conferences/ManageParticipant.java b/sample-app/src/main/java/com/sinch/sample/voice/conferences/ManageParticipant.java index 7be45cb3f..bfdb29b69 100644 --- a/sample-app/src/main/java/com/sinch/sample/voice/conferences/ManageParticipant.java +++ b/sample-app/src/main/java/com/sinch/sample/voice/conferences/ManageParticipant.java @@ -1,9 +1,9 @@ package com.sinch.sample.voice.conferences; import com.sinch.sample.BaseApplication; -import com.sinch.sdk.domains.voice.models.MusicOnHoldType; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantCommandType; -import com.sinch.sdk.domains.voice.models.requests.ConferenceManageParticipantRequestParameters; +import com.sinch.sdk.domains.voice.api.v1.ConferencesService; +import com.sinch.sdk.domains.voice.models.v1.MusicOnHold; +import com.sinch.sdk.domains.voice.models.v1.conferences.request.ManageConferenceParticipantRequest; import java.io.IOException; import java.util.logging.Logger; @@ -24,22 +24,21 @@ public static void main(String[] args) { public void run() { - var command = ConferenceManageParticipantCommandType.MUTE; - var moh = MusicOnHoldType.MUSIC1; + ConferencesService service = client.voice().v1().conferences(); + + var command = ManageConferenceParticipantRequest.CommandEnum.MUTE; + var moh = MusicOnHold.MUSIC1; LOGGER.info( "Manage participant '%s' for conference '%s'. Setting command to '%s' and moh to '%s'" .formatted(callId, conferenceId, command, moh)); - client - .voice() - .conferences() - .manageParticipant( - conferenceId, - callId, - ConferenceManageParticipantRequestParameters.builder() - .setCommand(command) - .setMusicOnHold(moh) - .build()); + service.manageParticipant( + conferenceId, + callId, + ManageConferenceParticipantRequest.builder() + .setCommand(command) + .setMusicOnHold(moh) + .build()); } }