|
5 | 5 | package com.azure.communication.callautomation.implementation; |
6 | 6 |
|
7 | 7 | import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException; |
| 8 | +import com.azure.communication.callautomation.implementation.models.RecordingResultResponse; |
8 | 9 | import com.azure.communication.callautomation.implementation.models.RecordingStateResponseInternal; |
9 | 10 | import com.azure.communication.callautomation.implementation.models.StartCallRecordingRequestInternal; |
10 | 11 | import com.azure.core.annotation.BodyParam; |
@@ -63,7 +64,7 @@ public final class CallRecordingsImpl { |
63 | 64 | @ServiceInterface(name = "AzureCommunicationCa") |
64 | 65 | public interface CallRecordingsService { |
65 | 66 | @Post("/calling/recordings") |
66 | | - @ExpectedResponses({ 200, 202 }) |
| 67 | + @ExpectedResponses({ 200 }) |
67 | 68 | @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) |
68 | 69 | Mono<Response<RecordingStateResponseInternal>> startRecording(@HostParam("endpoint") String endpoint, |
69 | 70 | @QueryParam("api-version") String apiVersion, |
@@ -99,6 +100,13 @@ Mono<Response<Void>> pauseRecording(@HostParam("endpoint") String endpoint, |
99 | 100 | Mono<Response<Void>> resumeRecording(@HostParam("endpoint") String endpoint, |
100 | 101 | @PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion, |
101 | 102 | @HeaderParam("Accept") String accept, Context context); |
| 103 | + |
| 104 | + @Get("/calling/recordings/{recordingId}/result") |
| 105 | + @ExpectedResponses({ 200 }) |
| 106 | + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) |
| 107 | + Mono<Response<RecordingResultResponse>> getRecordingResult(@HostParam("endpoint") String endpoint, |
| 108 | + @PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion, |
| 109 | + @HeaderParam("Accept") String accept, Context context); |
102 | 110 | } |
103 | 111 |
|
104 | 112 | /** |
@@ -566,4 +574,97 @@ public Response<Void> resumeRecordingWithResponse(String recordingId, Context co |
566 | 574 | public void resumeRecording(String recordingId) { |
567 | 575 | resumeRecordingWithResponse(recordingId, Context.NONE); |
568 | 576 | } |
| 577 | + |
| 578 | + /** |
| 579 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 580 | + * |
| 581 | + * @param recordingId The recording id. |
| 582 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 583 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 584 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 585 | + * @return recording result along with {@link Response} on successful completion of {@link Mono}. |
| 586 | + */ |
| 587 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 588 | + public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId) { |
| 589 | + final String accept = "application/json"; |
| 590 | + return FluxUtil.withContext(context -> service.getRecordingResult(this.client.getEndpoint(), recordingId, |
| 591 | + this.client.getApiVersion(), accept, context)); |
| 592 | + } |
| 593 | + |
| 594 | + /** |
| 595 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 596 | + * |
| 597 | + * @param recordingId The recording id. |
| 598 | + * @param context The context to associate with this operation. |
| 599 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 600 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 601 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 602 | + * @return recording result along with {@link Response} on successful completion of {@link Mono}. |
| 603 | + */ |
| 604 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 605 | + public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId, |
| 606 | + Context context) { |
| 607 | + final String accept = "application/json"; |
| 608 | + return service.getRecordingResult(this.client.getEndpoint(), recordingId, this.client.getApiVersion(), accept, |
| 609 | + context); |
| 610 | + } |
| 611 | + |
| 612 | + /** |
| 613 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 614 | + * |
| 615 | + * @param recordingId The recording id. |
| 616 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 617 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 618 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 619 | + * @return recording result on successful completion of {@link Mono}. |
| 620 | + */ |
| 621 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 622 | + public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId) { |
| 623 | + return getRecordingResultWithResponseAsync(recordingId).flatMap(res -> Mono.justOrEmpty(res.getValue())); |
| 624 | + } |
| 625 | + |
| 626 | + /** |
| 627 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 628 | + * |
| 629 | + * @param recordingId The recording id. |
| 630 | + * @param context The context to associate with this operation. |
| 631 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 632 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 633 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 634 | + * @return recording result on successful completion of {@link Mono}. |
| 635 | + */ |
| 636 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 637 | + public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId, Context context) { |
| 638 | + return getRecordingResultWithResponseAsync(recordingId, context) |
| 639 | + .flatMap(res -> Mono.justOrEmpty(res.getValue())); |
| 640 | + } |
| 641 | + |
| 642 | + /** |
| 643 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 644 | + * |
| 645 | + * @param recordingId The recording id. |
| 646 | + * @param context The context to associate with this operation. |
| 647 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 648 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 649 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 650 | + * @return recording result along with {@link Response}. |
| 651 | + */ |
| 652 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 653 | + public Response<RecordingResultResponse> getRecordingResultWithResponse(String recordingId, Context context) { |
| 654 | + return getRecordingResultWithResponseAsync(recordingId, context).block(); |
| 655 | + } |
| 656 | + |
| 657 | + /** |
| 658 | + * Get recording result. This includes the download URLs for the recording chunks. |
| 659 | + * |
| 660 | + * @param recordingId The recording id. |
| 661 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 662 | + * @throws CommunicationErrorResponseException thrown if the request is rejected by server. |
| 663 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 664 | + * @return recording result. |
| 665 | + */ |
| 666 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 667 | + public RecordingResultResponse getRecordingResult(String recordingId) { |
| 668 | + return getRecordingResultWithResponse(recordingId, Context.NONE).getValue(); |
| 669 | + } |
569 | 670 | } |
0 commit comments