Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK with latest swagger schema. #25560

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CallConnection callConnection = callingServerClient.createCallConnection(source,
```java readme-sample-addParticipant
CommunicationIdentifier thirdCallee = new CommunicationUserIdentifier("<acs-user-identity-3>");
String callbackUri = "<callback-uri-for-notification>";
callConnection.addParticipant(thirdCallee, "ACS User 3", "<string-for-tracing-responses>", URI.create(callbackUri));
callConnection.addParticipant(thirdCallee, "ACS User 3", "<string-for-tracing-responses>");
```

#### Hangup a Call:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public Response<Void> cancelAllMediaOperationsWithResponse(
* @param alternateCallerId Phone number to use when adding a phone number participant.
* @param operationContext Value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param callbackUri callBackUri to get notifications.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Response for a successful add participant request.
Expand All @@ -170,9 +169,8 @@ public Response<Void> cancelAllMediaOperationsWithResponse(
public AddParticipantResult addParticipant(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri) {
return callConnectionAsync.addParticipant(participant, alternateCallerId, operationContext, callbackUri).block();
String operationContext) {
return callConnectionAsync.addParticipant(participant, alternateCallerId, operationContext).block();
}

/**
Expand All @@ -182,7 +180,6 @@ public AddParticipantResult addParticipant(
* @param alternateCallerId Phone number to use when adding a phone number participant.
* @param operationContext Value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param callbackUri callBackUri to get notifications.
* @param context {@link Context} representing the request context.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
Expand All @@ -193,10 +190,9 @@ public Response<AddParticipantResult> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri,
Context context) {
return callConnectionAsync
.addParticipantWithResponse(participant, alternateCallerId, operationContext, callbackUri, context).block();
.addParticipantWithResponse(participant, alternateCallerId, operationContext, context).block();
}

/**
Expand Down Expand Up @@ -315,7 +311,7 @@ public Response<List<CallParticipant>> getParticipantsWithResponse(Context conte
* @return Response for a successful get participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public List<CallParticipant> getParticipant(CommunicationIdentifier participant) {
public CallParticipant getParticipant(CommunicationIdentifier participant) {
return callConnectionAsync.getParticipant(participant).block();
}

Expand All @@ -329,7 +325,7 @@ public List<CallParticipant> getParticipant(CommunicationIdentifier participant)
* @return Response for a successful get participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<List<CallParticipant>> getParticipantWithResponse(CommunicationIdentifier participant, Context context) {
public Response<CallParticipant> getParticipantWithResponse(CommunicationIdentifier participant, Context context) {
return callConnectionAsync.getParticipantWithResponse(participant, context).block();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ Mono<PlayAudioResult> playAudioInternal(URI audioFileUri, PlayAudioOptions playA
request
.setLoop(playAudioOptions.isLoop())
.setOperationContext(playAudioOptions.getOperationContext())
.setAudioFileId(playAudioOptions.getAudioFileId())
.setCallbackUri(playAudioOptions.getCallbackUri().toString());
.setAudioFileId(playAudioOptions.getAudioFileId());
}
return playAudioInternal(request);
} catch (RuntimeException ex) {
Expand Down Expand Up @@ -151,8 +150,7 @@ Mono<Response<PlayAudioResult>> playAudioWithResponseInternal(
request
.setLoop(playAudioOptions.isLoop())
.setOperationContext(playAudioOptions.getOperationContext())
.setAudioFileId(playAudioOptions.getAudioFileId())
.setCallbackUri(playAudioOptions.getCallbackUri().toString());
.setAudioFileId(playAudioOptions.getAudioFileId());
}
return playAudioWithResponseInternal(request, context);
} catch (RuntimeException ex) {
Expand Down Expand Up @@ -312,7 +310,6 @@ Mono<Response<Void>> cancelAllMediaOperationsWithResponse(
* @param alternateCallerId The phone number to use when adding a phone number participant.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param callbackUri callBackUri to get notifications.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Response for a successful add participant request.
Expand All @@ -321,13 +318,12 @@ Mono<Response<Void>> cancelAllMediaOperationsWithResponse(
public Mono<AddParticipantResult> addParticipant(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri) {
String operationContext) {
try {
AddParticipantRequest request = getAddParticipantRequest(participant,
alternateCallerId,
operationContext,
callbackUri);
operationContext
);
return callConnectionInternal.addParticipantAsync(callConnectionId, request)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.just(new AddParticipantResult(result.getParticipantId())));
Expand All @@ -343,7 +339,6 @@ public Mono<AddParticipantResult> addParticipant(
* @param alternateCallerId The phone number to use when adding a phone number participant.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param callbackUri callBackUri to get notifications.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Response for a successful add participant request.
Expand All @@ -352,22 +347,19 @@ public Mono<AddParticipantResult> addParticipant(
public Mono<Response<AddParticipantResult>> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri) {
return addParticipantWithResponse(participant, alternateCallerId, operationContext, callbackUri, Context.NONE);
String operationContext) {
return addParticipantWithResponse(participant, alternateCallerId, operationContext, Context.NONE);
}

Mono<Response<AddParticipantResult>> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri,
Context context) {
try {
AddParticipantRequest request = getAddParticipantRequest(participant,
alternateCallerId,
operationContext,
callbackUri);
operationContext);
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return callConnectionInternal
Expand Down Expand Up @@ -585,13 +577,12 @@ Mono<Response<List<CallParticipant>>> getParticipantsWithResponse(Context contex
* @return Response for a successful get participant request.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<List<CallParticipant>> getParticipant(CommunicationIdentifier participant) {
public Mono<CallParticipant> getParticipant(CommunicationIdentifier participant) {
try {
GetParticipantRequest request = new GetParticipantRequest().setIdentifier(CommunicationIdentifierConverter.convert(participant));
return callConnectionInternal.getParticipantAsync(callConnectionId, request)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.just(
result.stream().map(CallParticipantConverter::convert).collect(Collectors.toList())));
.flatMap(result -> Mono.just(CallParticipantConverter.convert(result)));
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand All @@ -606,11 +597,11 @@ public Mono<List<CallParticipant>> getParticipant(CommunicationIdentifier partic
* @return Response for a successful get participant request.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<Response<List<CallParticipant>>> getParticipantWithResponse(CommunicationIdentifier participant) {
public Mono<Response<CallParticipant>> getParticipantWithResponse(CommunicationIdentifier participant) {
return getParticipantWithResponse(participant, Context.NONE);
}

Mono<Response<List<CallParticipant>>> getParticipantWithResponse(CommunicationIdentifier participant, Context context) {
Mono<Response<CallParticipant>> getParticipantWithResponse(CommunicationIdentifier participant, Context context) {
try {
GetParticipantRequest request = new GetParticipantRequest().setIdentifier(CommunicationIdentifierConverter.convert(participant));
return withContext(contextValue -> {
Expand All @@ -619,13 +610,7 @@ Mono<Response<List<CallParticipant>>> getParticipantWithResponse(CommunicationId
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.map(response ->
new SimpleResponse<>(response,
response.getValue()
.stream()
.map(CallParticipantConverter::convert)
.collect(Collectors.toList()
)
)
);
CallParticipantConverter.convert(response.getValue())));
});
} catch (RuntimeException ex) {
return monoError(logger, ex);
Expand Down Expand Up @@ -707,8 +692,7 @@ Mono<PlayAudioResult> playAudioToParticipantInternal(CommunicationIdentifier par
playAudioToParticipantRequest
.setLoop(playAudioOptions.isLoop())
.setOperationContext(playAudioOptions.getOperationContext())
.setAudioFileId(playAudioOptions.getAudioFileId())
.setCallbackUri(playAudioOptions.getCallbackUri().toString());
.setAudioFileId(playAudioOptions.getAudioFileId());
}

return callConnectionInternal.participantPlayAudioAsync(callConnectionId, playAudioToParticipantRequest, context)
Expand Down Expand Up @@ -752,8 +736,7 @@ Mono<Response<PlayAudioResult>> playAudioToParticipantWithResponseInternal(Commu
playAudioToParticipantRequest
.setLoop(playAudioOptions.isLoop())
.setOperationContext(playAudioOptions.getOperationContext())
.setAudioFileId(playAudioOptions.getAudioFileId())
.setCallbackUri(playAudioOptions.getCallbackUri().toString());
.setAudioFileId(playAudioOptions.getAudioFileId());
}

return withContext(contextValue -> {
Expand Down Expand Up @@ -1266,13 +1249,11 @@ Mono<Response<Void>> deleteAudioRoutingGroupWithResponseInternal(String audioRou
private AddParticipantRequest getAddParticipantRequest(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
URI callbackUri) {
String operationContext) {
AddParticipantRequest request = new AddParticipantRequest()
.setParticipant(CommunicationIdentifierConverter.convert(participant))
.setAlternateCallerId(PhoneNumberIdentifierConverter.convert(alternateCallerId))
.setOperationContext(operationContext)
.setCallbackUri(callbackUri.toString());
.setOperationContext(operationContext);
return request;
}

Expand Down
Loading