Skip to content

Commit

Permalink
pr review fix (#22108)
Browse files Browse the repository at this point in the history
* PR review fixes

* PR review fixes
  • Loading branch information
arifsaikat-microsoft authored and chrwhit committed Jun 10, 2021
1 parent 4b58902 commit b977eee
Show file tree
Hide file tree
Showing 21 changed files with 848 additions and 375 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Licensed under the MIT License.
package com.azure.communication.callingserver;

import com.azure.communication.callingserver.implementation.converters.PlayAudioConverter;
import com.azure.communication.callingserver.implementation.models.PlayAudioRequest;
import com.azure.communication.callingserver.models.CancelAllMediaOperationsResponse;
import com.azure.communication.callingserver.models.CreateCallOptions;
import com.azure.communication.callingserver.models.CreateCallResponse;
import com.azure.communication.callingserver.models.PlayAudioOptions;
import com.azure.communication.callingserver.models.PlayAudioResponse;
import com.azure.communication.common.CommunicationIdentifier;
import com.azure.core.annotation.ReturnType;
Expand All @@ -19,6 +21,7 @@
*/
@ServiceClient(builder = CallClientBuilder.class)
public final class CallClient {

private final CallAsyncClient callAsyncClient;

CallClient(CallAsyncClient callAsyncClient) {
Expand All @@ -34,7 +37,9 @@ public final class CallClient {
* @return response for a successful CreateCall request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CreateCallResponse createCall(CommunicationIdentifier source, Iterable<CommunicationIdentifier> targets, CreateCallOptions createCallOptions) {
public CreateCallResponse createCall(CommunicationIdentifier source,
CommunicationIdentifier[] targets,
CreateCallOptions createCallOptions) {
return callAsyncClient.createCall(source, targets, createCallOptions).block();
}

Expand All @@ -48,7 +53,10 @@ public CreateCallResponse createCall(CommunicationIdentifier source, Iterable<Co
* @return response for a successful CreateCall request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CreateCallResponse> createCallWithResponse(CommunicationIdentifier source, Iterable<CommunicationIdentifier> targets, CreateCallOptions createCallOptions, Context context) {
public Response<CreateCallResponse> createCallWithResponse(CommunicationIdentifier source,
CommunicationIdentifier[] targets,
CreateCallOptions createCallOptions,
Context context) {
return callAsyncClient.createCallWithResponse(source, targets, createCallOptions, context).block();
}

Expand All @@ -59,13 +67,19 @@ public Response<CreateCallResponse> createCallWithResponse(CommunicationIdentifi
* @param audioFileUri The media resource uri of the play audio request.
* @param loop The flag indicating whether audio file needs to be played in loop or not.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri call back uri to receive notifications.
* @param operationContext The value to identify context of the operation.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PlayAudioResponse playAudio(String callId, String audioFileUri, boolean loop, String audioFileId, String operationContext) {
PlayAudioRequest playAudioRequest = new PlayAudioRequest().
setAudioFileUri(audioFileUri).setLoop(loop).setAudioFileId(audioFileId).setOperationContext(operationContext);
public PlayAudioResponse playAudio(String callId,
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext) {
PlayAudioRequest playAudioRequest =
PlayAudioConverter.convert(audioFileUri, loop, audioFileId, callbackUri, operationContext);
return callAsyncClient.playAudio(callId, playAudioRequest).block();
}

Expand All @@ -76,14 +90,53 @@ public PlayAudioResponse playAudio(String callId, String audioFileUri, boolean l
* @param audioFileUri The media resource uri of the play audio request.
* @param loop The flag indicating whether audio file needs to be played in loop or not.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri call back uri to receive notifications.
* @param operationContext The value to identify context of the operation.
* @param context A {@link Context} representing the request context.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResponse> playAudioWithResponse(String callId, String audioFileUri, boolean loop, String audioFileId, String operationContext, Context context) {
PlayAudioRequest playAudioRequest = new PlayAudioRequest().
setAudioFileUri(audioFileUri).setLoop(loop).setAudioFileId(audioFileId).setOperationContext(operationContext);
public Response<PlayAudioResponse> playAudioWithResponse(String callId,
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext,
Context context) {
PlayAudioRequest playAudioRequest =
PlayAudioConverter.convert(audioFileUri, loop, audioFileId, callbackUri, operationContext);
return callAsyncClient.playAudioWithResponse(callId, playAudioRequest, context).block();
}

/**
* Play audio in a call.
*
* @param callId The call id.
* @param audioFileUri The media resource uri of the play audio request.
* @param playAudioOptions Options for play audio.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PlayAudioResponse playAudio(String callId, String audioFileUri, PlayAudioOptions playAudioOptions) {
PlayAudioRequest playAudioRequest = PlayAudioConverter.convert(audioFileUri, playAudioOptions);
return callAsyncClient.playAudio(callId, playAudioRequest).block();
}

/**
* Play audio in a call.
*
* @param callId The call id.
* @param audioFileUri The media resource uri of the play audio request.
* @param playAudioOptions Options for play audio.
* @param context A {@link Context} representing the request context.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResponse> playAudioWithResponse(String callId,
String audioFileUri,
PlayAudioOptions playAudioOptions,
Context context) {
PlayAudioRequest playAudioRequest = PlayAudioConverter.convert(audioFileUri, playAudioOptions);
return callAsyncClient.playAudioWithResponse(callId, playAudioRequest, context).block();
}

Expand Down Expand Up @@ -154,8 +207,12 @@ public CancelAllMediaOperationsResponse cancelAllMediaOperations(String callId,
* @return response for a successful CancelMediaOperations request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CancelAllMediaOperationsResponse> cancelAllMediaOperationsWithResponse(String callId, String operationContext, Context context) {
return callAsyncClient.cancelAllMediaOperationsWithResponse(callId, operationContext, context).block();
public Response<CancelAllMediaOperationsResponse> cancelAllMediaOperationsWithResponse(String callId,
String operationContext,
Context context) {
return callAsyncClient.cancelAllMediaOperationsWithResponse(callId,
operationContext,
context).block();
}

/**
Expand All @@ -168,8 +225,14 @@ public Response<CancelAllMediaOperationsResponse> cancelAllMediaOperationsWithRe
* @return response for a successful inviteParticipants request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void addParticipant(String callId, CommunicationIdentifier participant, String alternateCallerId, String operationContext) {
return callAsyncClient.addParticipant(callId, participant, alternateCallerId, operationContext).block();
public Void addParticipant(String callId,
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext) {
return callAsyncClient.addParticipant(callId,
participant,
alternateCallerId,
operationContext).block();
}

/**
Expand All @@ -183,8 +246,16 @@ public Void addParticipant(String callId, CommunicationIdentifier participant, S
* @return response for a successful inviteParticipants request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> addParticipantWithResponse(String callId, CommunicationIdentifier participant, String alternateCallerId, String operationContext, Context context) {
return callAsyncClient.addParticipantWithResponse(callId, participant, alternateCallerId, operationContext, context).block();
public Response<Void> addParticipantWithResponse(String callId,
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
Context context) {
return callAsyncClient.addParticipantWithResponse(callId,
participant,
alternateCallerId,
operationContext,
context).block();
}

/**
Expand Down
Loading

0 comments on commit b977eee

Please sign in to comment.