-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/DEVEXP-470: Voice V1 design (#164)
- Loading branch information
Showing
393 changed files
with
25,071 additions
and
16,929 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 9 additions & 31 deletions
40
client/src/main/com/sinch/sdk/domains/voice/adapters/ApplicationsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, AuthManager> 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)); | ||
} | ||
} |
30 changes: 10 additions & 20 deletions
30
client/src/main/com/sinch/sdk/domains/voice/adapters/CalloutsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, AuthManager> 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)); | ||
} | ||
} |
29 changes: 9 additions & 20 deletions
29
client/src/main/com/sinch/sdk/domains/voice/adapters/CallsService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, AuthManager> 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)); | ||
} | ||
} |
32 changes: 9 additions & 23 deletions
32
client/src/main/com/sinch/sdk/domains/voice/adapters/ConferencesService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, AuthManager> 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<ConferenceParticipant> 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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.