Skip to content

Commit

Permalink
apiview feedback fix (#22337)
Browse files Browse the repository at this point in the history
* apiview feedback fixes

* apiview feedback fixes
  • Loading branch information
arifsaikat-microsoft authored Jun 17, 2021
1 parent d4174e3 commit 54d4194
Show file tree
Hide file tree
Showing 20 changed files with 181 additions and 295 deletions.
17 changes: 8 additions & 9 deletions sdk/communication/azure-communication-callingserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Based on if the Contoso app join a call or not, APIs can be divided into two cat


You can provide the connection string using the connectionString() function of `CallingServerClientBuilder`. Once you initialized a `CallingServerClient` class, you can do the different server calling operations.
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L28-L34 -->
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L31-L37 -->
```java
// Your connectionString retrieved from your Azure Communication Service
String connectionString = "endpoint=https://<resource-name>.communication.azure.com/;accesskey=<access-key>";
Expand All @@ -60,22 +60,21 @@ CallingServerClient callingServerClient = builder.buildClient();
### Create call, Add participant and Hangup a call

#### Create a Call:
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L46-L66 -->
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L49-L68 -->
```java
CommunicationIdentifier source = new CommunicationUserIdentifier("<acs-user-identity>");
CommunicationIdentifier firstCallee = new CommunicationUserIdentifier("<acs-user-identity-1>");
CommunicationIdentifier secondCallee = new CommunicationUserIdentifier("<acs-user-identity-2>");

CommunicationIdentifier[] targets = new CommunicationIdentifier[] { firstCallee, secondCallee };
List<CommunicationIdentifier> targets = Arrays.asList(firstCallee, secondCallee);

String callbackUri = "<callback-uri-for-notification>";

MediaType[] requestedMediaTypes = new MediaType[] { MediaType.AUDIO, MediaType.VIDEO };
List<MediaType> requestedMediaTypes = Arrays.asList(MediaType.AUDIO, MediaType.VIDEO);

EventSubscriptionType[] requestedCallEvents = new EventSubscriptionType[] {
List<EventSubscriptionType> requestedCallEvents = Arrays.asList(
EventSubscriptionType.DTMF_RECEIVED,
EventSubscriptionType.PARTICIPANTS_UPDATED
};
EventSubscriptionType.PARTICIPANTS_UPDATED);

CreateCallOptions createCallOptions = new CreateCallOptions(
callbackUri,
Expand All @@ -86,14 +85,14 @@ CallConnection callConnection = callingServerClient.createCallConnection(source,
```

#### Add a participant to a Call:
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L86-L87 -->
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L88-L89 -->
```java
CommunicationIdentifier thirdCallee = new CommunicationUserIdentifier("<acs-user-identity-3>");
callConnection.addParticipant(thirdCallee, "ACS User 3", "<string-for-tracing-responses>");
```

#### Hangup a Call:
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L76-L76 -->
<!-- embedme src/samples/java/com/azure/communication/callingserver/ReadmeSamples.java#L78-L78 -->
```java
callConnection.hangup();
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,39 +72,6 @@ public PlayAudioResult playAudio(String audioFileUri, PlayAudioOptions playAudio
return callConnectionAsync.playAudioInternal(audioFileUri, playAudioOptions).block();
}

/**
* Play audio in a call.
*
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @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. This is used to co-relate other
* communications related to this operation
* @param context A {@link Context} representing the request context.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext,
final Context context) {
return callConnectionAsync
.playAudioWithResponseInternal(
audioFileUri,
loop,
audioFileId,
callbackUri,
operationContext,
context)
.block();
}

/**
* Play audio in a call.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,35 +139,6 @@ Mono<PlayAudioResult> playAudioInternal(PlayAudioRequest playAudioRequest) {
}
}

/**
* Play audio in a call.
*
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @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. This is used to co-relate other
* communications related to this operation
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<PlayAudioResult>> playAudioWithResponse(
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext) {
return playAudioWithResponseInternal(
audioFileUri,
loop,
audioFileId,
callbackUri,
operationContext,
null);
}

/**
* Play audio in a call.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;

Expand Down Expand Up @@ -82,7 +83,7 @@ public final class CallingServerAsyncClient {
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CallConnectionAsync> createCallConnection(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions) {
try {
Objects.requireNonNull(source, "'source' cannot be null.");
Expand All @@ -108,7 +109,7 @@ public Mono<CallConnectionAsync> createCallConnection(
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CallConnectionAsync>> createCallConnectionWithResponse(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions) {
try {
Objects.requireNonNull(source, "'source' cannot be null.");
Expand All @@ -125,7 +126,7 @@ public Mono<Response<CallConnectionAsync>> createCallConnectionWithResponse(

Mono<CallConnection> createCallConnectionInternal(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions) {
try {
Objects.requireNonNull(source, "'source' cannot be null.");
Expand All @@ -142,7 +143,7 @@ Mono<CallConnection> createCallConnectionInternal(

Mono<Response<CallConnection>> createCallConnectionWithResponseInternal(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions,
Context context) {
try {
Expand Down Expand Up @@ -171,7 +172,7 @@ Mono<Response<CallConnection>> createCallConnectionWithResponseInternal(
* @return response for a successful join request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<CallConnectionAsync> join(
public Mono<CallConnectionAsync> joinCall(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
Expand All @@ -196,7 +197,7 @@ public Mono<CallConnectionAsync> join(
* @return response for a successful join request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<CallConnectionAsync>>joinWithResponse(
public Mono<Response<CallConnectionAsync>> joinCallWithResponse(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.OutputStream;
import java.nio.file.Path;
import java.util.List;
import java.util.Objects;


Expand Down Expand Up @@ -51,7 +52,7 @@ public final class CallingServerClient {
@ServiceMethod(returns = ReturnType.SINGLE)
public CallConnection createCallConnection(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions) {
return callingServerAsyncClient.createCallConnectionInternal(source, targets, createCallOptions).block();
}
Expand All @@ -68,7 +69,7 @@ public CallConnection createCallConnection(
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CallConnection> createCallConnectionWithResponse(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions,
final Context context) {
return callingServerAsyncClient
Expand All @@ -84,7 +85,7 @@ public Response<CallConnection> createCallConnectionWithResponse(
* @return CallConnection for a successful Join request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CallConnection join(
public CallConnection joinCall(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions) {
Expand All @@ -101,7 +102,7 @@ public CallConnection join(
* @return response for a successful Join request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CallConnection> joinWithResponse(
public Response<CallConnection> joinCallWithResponse(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,35 +249,6 @@ public PlayAudioResult playAudio(String audioFileUri, PlayAudioOptions playAudio
return serverCallAsync.playAudioInternal(audioFileUri, playAudioOptions).block();
}

/**
* Play audio in a call.
*
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri The callback Uri to receive PlayAudio status notifications.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param context A {@link Context} representing the request context.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
String audioFileId,
String callbackUri,
String operationContext,
final Context context) {
return serverCallAsync
.playAudioWithResponseInternal(
audioFileUri,
audioFileId,
callbackUri,
operationContext,
context).block();
}

/**
* Play audio in a call.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,27 +492,6 @@ Mono<PlayAudioResult> playAudioInternal(PlayAudioRequest playAudioRequest) {
}
}

/**
* Play audio in a call.
*
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @param audioFileId Tne id for the media in the AudioFileUri, using which we cache the media resource.
* @param callbackUri The callback Uri to receive PlayAudio status notifications.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<PlayAudioResult>> playAudioWithResponse(
String audioFileUri,
String audioFileId,
String callbackUri,
String operationContext) {
return playAudioWithResponseInternal(audioFileUri, audioFileId, callbackUri, operationContext, null);
}

/**
* Play audio in a call.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import com.azure.communication.callingserver.models.MediaType;
import com.azure.communication.common.CommunicationIdentifier;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -26,16 +24,16 @@ public final class CallConnectionRequestConverter {
*/
public static CreateCallRequest convert(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
List<CommunicationIdentifier> targets,
CreateCallOptions createCallOptions) {
if (source == null || targets == null || targets.length == 0) {
if (source == null || targets == null || targets.size() == 0) {
return null;
}

CreateCallRequest createCallRequest =
new CreateCallRequest()
.setSource(CommunicationIdentifierConverter.convert(source))
.setTargets(new ArrayList<>(Arrays.asList(targets))
.setTargets(targets
.stream()
.map(CommunicationIdentifierConverter::convert)
.collect(Collectors.toList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
package com.azure.communication.callingserver.implementation.converters;

import com.azure.communication.callingserver.implementation.models.JoinCallRequest;
import com.azure.communication.callingserver.models.EventSubscriptionType;
import com.azure.communication.callingserver.models.JoinCallOptions;
import com.azure.communication.callingserver.models.MediaType;
import com.azure.communication.common.CommunicationIdentifier;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* A converter for {@link JoinCallRequest}
Expand All @@ -35,15 +31,8 @@ public static JoinCallRequest convert(CommunicationIdentifier source, JoinCallOp

joinCallRequest.setSubject(joinCallOptions.getSubject());
joinCallRequest.setCallbackUri(joinCallOptions.getCallbackUri());

List<MediaType> requestedModalities = new ArrayList<>();
Collections.addAll(requestedModalities, joinCallOptions.getRequestedMediaTypes());
joinCallRequest.setRequestedMediaTypes(requestedModalities);

List<EventSubscriptionType> requestedCallEvents = new ArrayList<>();
Collections.addAll(requestedCallEvents, joinCallOptions.getRequestedCallEvents());
joinCallRequest.setRequestedCallEvents(requestedCallEvents);

joinCallRequest.setRequestedMediaTypes(new ArrayList<>(joinCallOptions.getRequestedMediaTypes()));
joinCallRequest.setRequestedCallEvents(new ArrayList<>(joinCallOptions.getRequestedCallEvents()));
return joinCallRequest;
}

Expand Down
Loading

0 comments on commit 54d4194

Please sign in to comment.