com.sinch.sdk.domains.numbers.adapters.converters.AvailableRentRequestParametersDtoConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.numbers.adapters.converters;
import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberRentRequestParameters;
import com.sinch.sdk.domains.numbers.models.v1.SmsConfiguration;
import com.sinch.sdk.domains.numbers.models.v1.VoiceConfigurationRTC;
import com.sinch.sdk.domains.numbers.models.v1.request.AvailableNumberRentRequest;
public class AvailableRentRequestParametersDtoConverter {
public static AvailableNumberRentRequest convert(
AvailableNumberRentRequestParameters parameters) {
AvailableNumberRentRequest.Builder dto = AvailableNumberRentRequest.builder();
parameters
.getSmsConfiguration()
.ifPresent(
value -> {
SmsConfiguration.Builder config = SmsConfiguration.builder();
value.getServicePlanId().ifPresent(config::setServicePlanId);
value.getCampaignId().ifPresent(config::setCampaignId);
dto.setSmsConfiguration(config.build());
});
parameters
.getVoiceConfiguration()
.ifPresent(
value -> {
VoiceConfigurationRTC.Builder config = VoiceConfigurationRTC.builder();
value.getAppId().ifPresent(config::setAppId);
dto.setVoiceConfiguration(config.build());
});
parameters.getCallBackUrl().ifPresent(dto::setCallbackUrl);
return dto.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy