Skip to content

Commit db98958

Browse files
Added get recording result api. (Azure#45825)
* init commit * Changelog
1 parent a6fd991 commit db98958

File tree

60 files changed

+3451
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3451
-79
lines changed

sdk/communication/azure-communication-callautomation/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Features Added
66

7+
- Support for recording result api.
8+
79
### Breaking Changes
810

911
### Bugs Fixed

sdk/communication/azure-communication-callautomation/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/communication/azure-communication-callautomation",
5-
"Tag": "java/communication/azure-communication-callautomation_3945e42447"
5+
"Tag": "java/communication/azure-communication-callautomation_d495ba2a2c"
66
}

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ private TranscriptionOptionsInternal getTranscriptionOptionsInternal(Transcripti
346346
.setLocale(transcriptionOptions.getLocale())
347347
.setStartTranscription(transcriptionOptions.getStartTranscription())
348348
.setEnableIntermediateResults(transcriptionOptions.isIntermediateResultsEnabled())
349-
.setSpeechRecognitionModelEndpointId(transcriptionOptions.getSpeechRecognitionModelEndpointId());
349+
.setSpeechModelEndpointId(transcriptionOptions.getSpeechRecognitionModelEndpointId());
350350
}
351351

352352
/**

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallMediaAsync.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ Mono<Response<Void>> startTranscriptionWithResponseInternal(StartTranscriptionOp
840840
if (options != null) {
841841
request.setLocale(options.getLocale());
842842
request.setOperationContext(options.getOperationContext());
843-
request.setSpeechRecognitionModelEndpointId(options.getSpeechRecognitionModelEndpointId());
843+
request.setSpeechModelEndpointId(options.getSpeechRecognitionModelEndpointId());
844844
}
845845
return contentsInternal.startTranscriptionWithResponseAsync(callConnectionId, request, context);
846846
} catch (RuntimeException ex) {
@@ -936,7 +936,7 @@ Mono<Response<Void>> updateTranscriptionWithResponseInternal(String locale, Stri
936936
context = context == null ? Context.NONE : context;
937937
UpdateTranscriptionRequestInternal request = new UpdateTranscriptionRequestInternal();
938938
request.setLocale(locale);
939-
request.setSpeechRecognitionModelEndpointId(speechRecognitionModelEndpointId);
939+
request.setSpeechModelEndpointId(speechRecognitionModelEndpointId);
940940
request.setOperationContext(operationContext);
941941
return contentsInternal.updateTranscriptionWithResponseAsync(callConnectionId, request, context);
942942
} catch (RuntimeException ex) {

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallRecording.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.security.InvalidParameterException;
2020
import java.util.Objects;
2121

22+
import com.azure.communication.callautomation.models.RecordingResult;
23+
2224
/**
2325
* CallRecording.
2426
*/
@@ -163,6 +165,33 @@ public Response<RecordingStateResult> getStateWithResponse(String recordingId, C
163165
return callRecordingAsync.getStateWithResponseInternal(recordingId, context).block();
164166
}
165167

168+
/**
169+
* Get the recording result by recording id.
170+
*
171+
* @param recordingId The recording id to stop.
172+
* @throws HttpResponseException thrown if the request is rejected by server.
173+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
174+
* @return Response for a successful get recording state request.
175+
*/
176+
@ServiceMethod(returns = ReturnType.SINGLE)
177+
public RecordingResult getRecordingResult(String recordingId) {
178+
return callRecordingAsync.getRecordingResult(recordingId).block();
179+
}
180+
181+
/**
182+
* Get the recording result by recording id.
183+
*
184+
* @param recordingId The recording id to stop.
185+
* @param context A {@link Context} representing the request context.
186+
* @throws HttpResponseException thrown if the request is rejected by server.
187+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
188+
* @return Response for a successful get recording state request.
189+
*/
190+
@ServiceMethod(returns = ReturnType.SINGLE)
191+
public Response<RecordingResult> getRecordingResult(String recordingId, Context context) {
192+
return callRecordingAsync.getRecordingResultResponseInternal(recordingId, context).block();
193+
}
194+
166195
/**
167196
* Download the recording content, e.g. Recording's metadata, Recording video, etc., from
168197
* {@code endpoint} and write it in the {@link OutputStream} passed as parameter.

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallRecordingAsync.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.stream.Collectors;
2121

2222
import com.azure.communication.callautomation.implementation.CallRecordingsImpl;
23+
import com.azure.communication.callautomation.implementation.accesshelpers.RecordingResultResponseConstructorProxy;
2324
import com.azure.communication.callautomation.implementation.accesshelpers.RecordingStateResponseConstructorProxy;
2425
import com.azure.communication.callautomation.implementation.converters.CommunicationIdentifierConverter;
2526
import com.azure.communication.callautomation.implementation.models.CallLocatorInternal;
@@ -39,6 +40,7 @@
3940
import com.azure.communication.callautomation.models.DownloadToFileOptions;
4041
import com.azure.communication.callautomation.models.GroupCallLocator;
4142
import com.azure.communication.callautomation.models.ParallelDownloadOptions;
43+
import com.azure.communication.callautomation.models.RecordingResult;
4244
import com.azure.communication.callautomation.models.RecordingStateResult;
4345
import com.azure.communication.callautomation.models.RoomCallLocator;
4446
import com.azure.communication.callautomation.models.ServerCallLocator;
@@ -342,6 +344,45 @@ Mono<Response<RecordingStateResult>> getStateWithResponseInternal(String recordi
342344
}
343345
}
344346

347+
/**
348+
* Get recording result by recording id.
349+
*
350+
* @param recordingId Recording id to stop.
351+
* @throws HttpResponseException thrown if the request is rejected by server.
352+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
353+
* @return Response for a successful get recording state request.
354+
*/
355+
@ServiceMethod(returns = ReturnType.SINGLE)
356+
public Mono<RecordingResult> getRecordingResult(String recordingId) {
357+
return getRecordingResultResponse(recordingId).flatMap(response -> Mono.just(response.getValue()));
358+
}
359+
360+
/**
361+
* Get recording result by recording id.
362+
*
363+
* @param recordingId Recording id to stop.
364+
* @throws HttpResponseException thrown if the request is rejected by server.
365+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
366+
* @return Response for a successful get recording state request.
367+
*/
368+
@ServiceMethod(returns = ReturnType.SINGLE)
369+
public Mono<Response<RecordingResult>> getRecordingResultResponse(String recordingId) {
370+
return getRecordingResultResponseInternal(recordingId, null);
371+
}
372+
373+
Mono<Response<RecordingResult>> getRecordingResultResponseInternal(String recordingId, Context context) {
374+
try {
375+
return withContext(contextValue -> {
376+
contextValue = context == null ? contextValue : context;
377+
return callRecordingsInternal.getRecordingResultWithResponseAsync(recordingId, contextValue)
378+
.map(response -> new SimpleResponse<>(response,
379+
RecordingResultResponseConstructorProxy.create(response.getValue())));
380+
});
381+
} catch (RuntimeException ex) {
382+
return monoError(logger, ex);
383+
}
384+
}
385+
345386
/**
346387
* Download the recording content, e.g. Recording's metadata, Recording video, from the ACS endpoint
347388
* passed as parameter.

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallConnectionsImpl.java

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import com.azure.communication.callautomation.implementation.models.CancelAddParticipantResponse;
1313
import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException;
1414
import com.azure.communication.callautomation.implementation.models.GetParticipantsResponseInternal;
15+
import com.azure.communication.callautomation.implementation.models.MoveParticipantsRequest;
16+
import com.azure.communication.callautomation.implementation.models.MoveParticipantsResponse;
1517
import com.azure.communication.callautomation.implementation.models.MuteParticipantsRequestInternal;
1618
import com.azure.communication.callautomation.implementation.models.MuteParticipantsResultInternal;
1719
import com.azure.communication.callautomation.implementation.models.RemoveParticipantRequestInternal;
@@ -169,6 +171,16 @@ Mono<Response<CancelAddParticipantResponse>> cancelAddParticipant(@HostParam("en
169171
@HeaderParam("repeatability-request-id") String repeatabilityRequestId,
170172
@HeaderParam("repeatability-first-sent") String repeatabilityFirstSent, Context context);
171173

174+
@Post("/calling/callConnections/{callConnectionId}/participants:moveHere")
175+
@ExpectedResponses({ 202 })
176+
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
177+
Mono<Response<MoveParticipantsResponse>> moveParticipants(@HostParam("endpoint") String endpoint,
178+
@PathParam("callConnectionId") String callConnectionId, @QueryParam("api-version") String apiVersion,
179+
@BodyParam("application/json") MoveParticipantsRequest moveParticipantRequest,
180+
@HeaderParam("Accept") String accept,
181+
@HeaderParam("repeatability-request-id") String repeatabilityRequestId,
182+
@HeaderParam("repeatability-first-sent") String repeatabilityFirstSent, Context context);
183+
172184
@Get("/calling/callConnections/{callConnectionId}/participants/{participantRawId}")
173185
@ExpectedResponses({ 200 })
174186
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
@@ -1230,6 +1242,113 @@ public CancelAddParticipantResponse cancelAddParticipant(String callConnectionId
12301242
return cancelAddParticipantWithResponse(callConnectionId, cancelAddParticipantRequest, Context.NONE).getValue();
12311243
}
12321244

1245+
/**
1246+
* Add a participant to the call.
1247+
*
1248+
* @param callConnectionId The call connection Id.
1249+
* @param moveParticipantRequest The move participants request.
1250+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1251+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1252+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1253+
* @return the response payload for moving participants to the call along with {@link Response} on successful
1254+
* completion of {@link Mono}.
1255+
*/
1256+
@ServiceMethod(returns = ReturnType.SINGLE)
1257+
public Mono<Response<MoveParticipantsResponse>> moveParticipantsWithResponseAsync(String callConnectionId,
1258+
MoveParticipantsRequest moveParticipantRequest) {
1259+
return FluxUtil.withContext(
1260+
context -> moveParticipantsWithResponseAsync(callConnectionId, moveParticipantRequest, context));
1261+
}
1262+
1263+
/**
1264+
* Add a participant to the call.
1265+
*
1266+
* @param callConnectionId The call connection Id.
1267+
* @param moveParticipantRequest The move participants request.
1268+
* @param context The context to associate with this operation.
1269+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1270+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1271+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1272+
* @return the response payload for moving participants to the call along with {@link Response} on successful
1273+
* completion of {@link Mono}.
1274+
*/
1275+
@ServiceMethod(returns = ReturnType.SINGLE)
1276+
public Mono<Response<MoveParticipantsResponse>> moveParticipantsWithResponseAsync(String callConnectionId,
1277+
MoveParticipantsRequest moveParticipantRequest, Context context) {
1278+
final String accept = "application/json";
1279+
return service.moveParticipants(this.client.getEndpoint(), callConnectionId, this.client.getApiVersion(),
1280+
moveParticipantRequest, accept, CoreUtils.randomUuid().toString(),
1281+
DateTimeRfc1123.toRfc1123String(OffsetDateTime.now()), context);
1282+
}
1283+
1284+
/**
1285+
* Add a participant to the call.
1286+
*
1287+
* @param callConnectionId The call connection Id.
1288+
* @param moveParticipantRequest The move participants request.
1289+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1290+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1291+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1292+
* @return the response payload for moving participants to the call on successful completion of {@link Mono}.
1293+
*/
1294+
@ServiceMethod(returns = ReturnType.SINGLE)
1295+
public Mono<MoveParticipantsResponse> moveParticipantsAsync(String callConnectionId,
1296+
MoveParticipantsRequest moveParticipantRequest) {
1297+
return moveParticipantsWithResponseAsync(callConnectionId, moveParticipantRequest)
1298+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
1299+
}
1300+
1301+
/**
1302+
* Add a participant to the call.
1303+
*
1304+
* @param callConnectionId The call connection Id.
1305+
* @param moveParticipantRequest The move participants request.
1306+
* @param context The context to associate with this operation.
1307+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1308+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1309+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1310+
* @return the response payload for moving participants to the call on successful completion of {@link Mono}.
1311+
*/
1312+
@ServiceMethod(returns = ReturnType.SINGLE)
1313+
public Mono<MoveParticipantsResponse> moveParticipantsAsync(String callConnectionId,
1314+
MoveParticipantsRequest moveParticipantRequest, Context context) {
1315+
return moveParticipantsWithResponseAsync(callConnectionId, moveParticipantRequest, context)
1316+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
1317+
}
1318+
1319+
/**
1320+
* Add a participant to the call.
1321+
*
1322+
* @param callConnectionId The call connection Id.
1323+
* @param moveParticipantRequest The move participants request.
1324+
* @param context The context to associate with this operation.
1325+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1326+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1327+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1328+
* @return the response payload for moving participants to the call along with {@link Response}.
1329+
*/
1330+
@ServiceMethod(returns = ReturnType.SINGLE)
1331+
public Response<MoveParticipantsResponse> moveParticipantsWithResponse(String callConnectionId,
1332+
MoveParticipantsRequest moveParticipantRequest, Context context) {
1333+
return moveParticipantsWithResponseAsync(callConnectionId, moveParticipantRequest, context).block();
1334+
}
1335+
1336+
/**
1337+
* Add a participant to the call.
1338+
*
1339+
* @param callConnectionId The call connection Id.
1340+
* @param moveParticipantRequest The move participants request.
1341+
* @throws IllegalArgumentException thrown if parameters fail the validation.
1342+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
1343+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
1344+
* @return the response payload for moving participants to the call.
1345+
*/
1346+
@ServiceMethod(returns = ReturnType.SINGLE)
1347+
public MoveParticipantsResponse moveParticipants(String callConnectionId,
1348+
MoveParticipantsRequest moveParticipantRequest) {
1349+
return moveParticipantsWithResponse(callConnectionId, moveParticipantRequest, Context.NONE).getValue();
1350+
}
1351+
12331352
/**
12341353
* Get participant from a call.
12351354
*

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public final class CallRecordingsImpl {
6464
@ServiceInterface(name = "AzureCommunicationCallAutomationServiceCallRecordings")
6565
public interface CallRecordingsService {
6666
@Post("/calling/recordings")
67-
@ExpectedResponses({ 200 })
67+
@ExpectedResponses({ 200, 202 })
6868
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
6969
Mono<Response<RecordingStateResponseInternal>> startRecording(@HostParam("endpoint") String endpoint,
7070
@QueryParam("api-version") String apiVersion,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package com.azure.communication.callautomation.implementation.accesshelpers;
5+
6+
import com.azure.communication.callautomation.implementation.models.RecordingResultResponse;
7+
import com.azure.communication.callautomation.models.RecordingResult;
8+
9+
/**
10+
* Helper class to access private values of {@link RecordingResult} across package boundaries.
11+
*/
12+
public final class RecordingResultResponseConstructorProxy {
13+
private static RecordingResultResponseConstructorAccessor accessor;
14+
15+
private RecordingResultResponseConstructorProxy() {
16+
}
17+
18+
/**
19+
* Type defining the methods to set the non-public properties of a {@link RecordingResultResponseConstructorAccessor}
20+
* instance.
21+
*/
22+
public interface RecordingResultResponseConstructorAccessor {
23+
/**
24+
* Creates a new instance of {@link RecordingResult} backed by an internal instance of
25+
* {@link RecordingResultResponse}.
26+
*
27+
* @param internalResponse The internal response.
28+
* @return A new instance of {@link RecordingResult}.
29+
*/
30+
RecordingResult create(RecordingResultResponse internalResponse);
31+
}
32+
33+
/**
34+
* The method called from {@link RecordingResult} to set it's accessor.
35+
*
36+
* @param accessor The accessor.
37+
*/
38+
public static void setAccessor(final RecordingResultResponseConstructorAccessor accessor) {
39+
RecordingResultResponseConstructorProxy.accessor = accessor;
40+
}
41+
42+
/**
43+
* Creates a new instance of {@link RecordingResult} backed by an internal instance of
44+
* {@link RecordingResultResponse}.
45+
*
46+
* @param internalResponse The internal response.
47+
* @return A new instance of {@link RecordingResult}.
48+
*/
49+
public static RecordingResult create(RecordingResultResponse internalResponse) {
50+
if (accessor == null) {
51+
new RecordingResult();
52+
}
53+
54+
assert accessor != null;
55+
return accessor.create(internalResponse);
56+
}
57+
}

0 commit comments

Comments
 (0)