Skip to content

Commit

Permalink
apiview review fix (#22304)
Browse files Browse the repository at this point in the history
  • Loading branch information
arifsaikat-microsoft authored Jun 16, 2021
1 parent 1a259c1 commit acb491b
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Response<PlayAudioResult> playAudioWithResponse(
String audioFileId,
String callbackUri,
String operationContext,
Context context) {
final Context context) {
return callConnectionAsync
.playAudioWithResponseInternal(
audioFileUri,
Expand All @@ -119,20 +119,18 @@ public Response<PlayAudioResult> playAudioWithResponse(
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
PlayAudioOptions playAudioOptions,
Context context) {
final Context context) {
return callConnectionAsync
.playAudioWithResponseInternal(audioFileUri, playAudioOptions, context)
.block();
}

/**
* Disconnect the current caller in a group-call or end a p2p-call.
*
* @return response for a successful hangup request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void hangup() {
return callConnectionAsync.hangup().block();
public void hangup() {
callConnectionAsync.hangup().block();
}

/**
Expand All @@ -142,7 +140,7 @@ public Void hangup() {
* @return response for a successful hangup request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> hangupWithResponse(Context context) {
public Response<Void> hangupWithResponse(final Context context) {
return callConnectionAsync.hangupWithResponse(context).block();
}

Expand All @@ -169,7 +167,7 @@ public CancelAllMediaOperationsResult cancelAllMediaOperations(String operationC
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsWithResponse(
String operationContext,
Context context) {
final Context context) {
return callConnectionAsync.cancelAllMediaOperationsWithResponse(operationContext, context).block();
}

Expand Down Expand Up @@ -205,7 +203,7 @@ public Response<AddParticipantResult> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
Context context) {
final Context context) {
return callConnectionAsync
.addParticipantWithResponse(participant, alternateCallerId, operationContext, context).block();
}
Expand All @@ -214,11 +212,10 @@ public Response<AddParticipantResult> addParticipantWithResponse(
* Remove a participant from the call.
*
* @param participantId Participant id.
* @return response for a successful remove participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void removeParticipant(String participantId) {
return callConnectionAsync.removeParticipant(participantId).block();
public void removeParticipant(String participantId) {
callConnectionAsync.removeParticipant(participantId).block();
}

/**
Expand All @@ -229,7 +226,7 @@ public Void removeParticipant(String participantId) {
* @return response for a successful remove participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> removeParticipantWithResponse(String participantId, Context context) {
public Response<Void> removeParticipantWithResponse(String participantId, final Context context) {
return callConnectionAsync.removeParticipantWithResponse(participantId, context).block();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ Mono<Response<PlayAudioResult>> playAudioWithResponseInternal(
public Mono<Void> hangup() {
try {
return callConnectionInternal.hangupCallAsync(callConnectionId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down Expand Up @@ -411,7 +412,8 @@ Mono<Response<AddParticipantResult>> addParticipantWithResponse(
public Mono<Void> removeParticipant(String participantId) {
try {
return callConnectionInternal.removeParticipantAsync(callConnectionId, participantId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Response<CallConnection> createCallConnectionWithResponse(
CommunicationIdentifier source,
CommunicationIdentifier[] targets,
CreateCallOptions createCallOptions,
Context context) {
final Context context) {
return callingServerAsyncClient
.createCallConnectionWithResponseInternal(source, targets, createCallOptions, context).block();
}
Expand Down Expand Up @@ -105,7 +105,7 @@ public Response<CallConnection> joinWithResponse(
String serverCallId,
CommunicationIdentifier source,
JoinCallOptions joinCallOptions,
Context context) {
final Context context) {
return callingServerAsyncClient.joinWithResponseInternal(serverCallId, source, joinCallOptions, context).block();
}

Expand Down Expand Up @@ -156,7 +156,7 @@ public void downloadTo(String sourceEndpoint, OutputStream destinationStream, Ht
public Response<Void> downloadToWithResponse(String sourceEndpoint,
OutputStream destinationStream,
HttpRange httpRange,
Context context) {
final Context context) {
Objects.requireNonNull(sourceEndpoint, "'sourceEndpoint' cannot be null");
Objects.requireNonNull(destinationStream, "'destinationStream' cannot be null");
return callingServerAsyncClient
Expand Down Expand Up @@ -197,7 +197,7 @@ public Response<Void> downloadToWithResponse(String sourceEndpoint,
Path destinationPath,
ParallelDownloadOptions parallelDownloadOptions,
boolean overwrite,
Context context) {
final Context context) {
Objects.requireNonNull(sourceEndpoint, "'sourceEndpoint' cannot be null");
Objects.requireNonNull(destinationPath, "'destinationPath' cannot be null");
return callingServerAsyncClient.downloadToWithResponse(sourceEndpoint, destinationPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,18 @@ public CallingServerClientBuilder httpLogOptions(HttpLogOptions logOptions) {
}

/**
* Sets the {@link CallingServerClientBuilder} that is used when making API requests.
* Sets the {@link CallingServerServiceVersion} that is used when making API requests.
* <p>
* If a service version is not provided, the service version that will be used
* will be the latest known service version based on the version of the client
* library being used. If no service version is specified, updating to a newer
* version of the client library will have the result of potentially moving to a
* newer service version.
* If a service version is not provided, the service version that will be used will be the latest known service
* version based on the version of the client library being used. If no service version is specified, updating to a
* newer version of the client library will have the result of potentially moving to a newer service version.
* <p>
* Targeting a specific service version may also mean that the service will
* return an error for newer APIs.
* Targeting a specific service version may also mean that the service will return an error for newer APIs.
*
* @param version {@link CallingServerClientBuilder} of the service to be used when
* making requests.
* @param version {@link CallingServerServiceVersion} of the service to be used when making requests.
* @return the updated CallingServerClientBuilder object
*/
public CallingServerClientBuilder serviceVersion(CallingServerClientBuilder version) {
public CallingServerClientBuilder serviceVersion(CallingServerServiceVersion version) {
return this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.communication.callingserver;

import com.azure.core.util.ServiceVersion;

/**
* The versions of CallingServer Service supported by this client library.
*/
public enum CallingServerServiceVersion implements ServiceVersion {
V2021_06_015("2021-06-15"),
V2021_06_15_preview("2021-06-15-preview");

private final String version;

CallingServerServiceVersion(String version) {
this.version = version;
}

/**
* {@inheritDoc}
*/
@Override
public String getVersion() {
return this.version;
}

/**
* Gets the latest service version supported by this client library
*
* @return the latest {@link CallingServerServiceVersion}
*/
public static CallingServerServiceVersion getLatest() {
return V2021_06_15_preview;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Response<AddParticipantResult> addParticipantWithResponse(
String callBackUri,
String alternateCallerId,
String operationContext,
Context context) {
final Context context) {
return serverCallAsync.addParticipantWithResponse(
participant,
callBackUri,
Expand All @@ -82,11 +82,10 @@ public Response<AddParticipantResult> addParticipantWithResponse(
* Remove a participant from the call.
*
* @param participantId Participant id.
* @return response for a successful remove participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void removeParticipant(String participantId) {
return serverCallAsync.removeParticipant(participantId).block();
public void removeParticipant(String participantId) {
serverCallAsync.removeParticipant(participantId).block();
}

/**
Expand All @@ -97,7 +96,7 @@ public Void removeParticipant(String participantId) {
* @return response for a successful remove participant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> removeParticipantWithResponse(String participantId, Context context) {
public Response<Void> removeParticipantWithResponse(String participantId, final Context context) {
return serverCallAsync.removeParticipantWithResponse(participantId, context).block();
}

Expand All @@ -122,19 +121,18 @@ public StartCallRecordingResult startRecording(String recordingStateCallbackUri)
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<StartCallRecordingResult> startRecordingWithResponse(
String recordingStateCallbackUri,
Context context) {
final Context context) {
return serverCallAsync.startRecordingWithResponse(recordingStateCallbackUri, context).block();
}

/**
* Stop recording
*
* @param recordingId The recording id to stop.
* @return response for a successful stop recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void stopRecording(String recordingId) {
return serverCallAsync.stopRecording(recordingId).block();
public void stopRecording(String recordingId) {
serverCallAsync.stopRecording(recordingId).block();
}

/**
Expand All @@ -145,19 +143,18 @@ public Void stopRecording(String recordingId) {
* @return response for a successful stop recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> stopRecordingWithResponse(String recordingId, Context context) {
public Response<Void> stopRecordingWithResponse(String recordingId, final Context context) {
return serverCallAsync.stopRecordingWithResponse(recordingId, context).block();
}

/**
* Pause recording
*
* @param recordingId The recording id to stop.
* @return response for a successful pause recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void pauseRecording(String recordingId) {
return serverCallAsync.pauseRecording(recordingId).block();
public void pauseRecording(String recordingId) {
serverCallAsync.pauseRecording(recordingId).block();
}

/**
Expand All @@ -168,19 +165,18 @@ public Void pauseRecording(String recordingId) {
* @return response for a successful pause recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> pauseRecordingWithResponse(String recordingId, Context context) {
public Response<Void> pauseRecordingWithResponse(String recordingId, final Context context) {
return serverCallAsync.pauseRecordingWithResponse(recordingId, context).block();
}

/**
* Resume recording
*
* @param recordingId The recording id to stop.
* @return response for a successful resume recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void resumeRecording(String recordingId) {
return serverCallAsync.resumeRecording(recordingId).block();
public void resumeRecording(String recordingId) {
serverCallAsync.resumeRecording(recordingId).block();
}

/**
Expand All @@ -191,7 +187,7 @@ public Void resumeRecording(String recordingId) {
* @return response for a successful resume recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> resumeRecordingWithResponse(String recordingId, Context context) {
public Response<Void> resumeRecordingWithResponse(String recordingId, final Context context) {
return serverCallAsync.resumeRecordingWithResponse(recordingId, context).block();
}

Expand All @@ -214,7 +210,7 @@ public CallRecordingProperties getRecordingState(String recordingId) {
* @return response for a successful get recording state request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CallRecordingProperties> getRecordingStateWithResponse(String recordingId, Context context) {
public Response<CallRecordingProperties> getRecordingStateWithResponse(String recordingId, final Context context) {
return serverCallAsync.getRecordingStateWithResponse(recordingId, context).block();
}

Expand Down Expand Up @@ -272,7 +268,7 @@ public Response<PlayAudioResult> playAudioWithResponse(
String audioFileId,
String callbackUri,
String operationContext,
Context context) {
final Context context) {
return serverCallAsync
.playAudioWithResponseInternal(
audioFileUri,
Expand All @@ -296,7 +292,7 @@ public Response<PlayAudioResult> playAudioWithResponse(
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
PlayAudioOptions playAudioOptions,
Context context) {
final Context context) {
return serverCallAsync.playAudioWithResponseInternal(audioFileUri, playAudioOptions, context).block();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ Mono<Response<AddParticipantResult>> addParticipantWithResponse(
public Mono<Void> removeParticipant(String participantId) {
try {
return serverCallInternal.removeParticipantAsync(serverCallId, participantId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down Expand Up @@ -248,7 +249,8 @@ Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(
public Mono<Void> stopRecording(String recordingId) {
try {
return serverCallInternal.stopRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down Expand Up @@ -288,7 +290,8 @@ Mono<Response<Void>> stopRecordingWithResponse(String recordingId, Context conte
public Mono<Void> pauseRecording(String recordingId) {
try {
return serverCallInternal.pauseRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down Expand Up @@ -328,7 +331,8 @@ Mono<Response<Void>> pauseRecordingWithResponse(String recordingId, Context cont
public Mono<Void> resumeRecording(String recordingId) {
try {
return serverCallInternal.resumeRecordingAsync(serverCallId, recordingId)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException);
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.empty());
} catch (RuntimeException ex) {
return monoError(logger, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class CallingServerEventType extends ExpandableStringEnum<CallingSe
public static final CallingServerEventType CALL_CONNECTION_STATE_CHANGED_EVENT = fromString("Microsoft.Communication.CallConnectionStateChanged");

/** The invited participants result event type. */
public static final CallingServerEventType INVITE_PARTICIPANT_RESULT_EVENT = fromString("Microsoft.Communication.InviteParticipantResult");
public static final CallingServerEventType ADD_PARTICIPANT_RESULT_EVENT = fromString("Microsoft.Communication.AddParticipantResult");

/** The call recording state change event type. */
public static final CallingServerEventType CALL_RECORDING_STATE_CHANGED_EVENT = fromString("Microsoft.Communication.CallRecordingStateChanged");
Expand Down

0 comments on commit acb491b

Please sign in to comment.