public async Task <IActionResult> DeleteConference(Guid hearingRefId, Guid conferenceId) { _logger.LogDebug("DeleteConference {conferenceId}", conferenceId); try { await _videoApiClient.RemoveConferenceAsync(conferenceId); } catch (VideoApiException e) { return(StatusCode(e.StatusCode, e.Response)); } try { await _videoApiClient.DeleteAudioApplicationAsync(hearingRefId); _logger.LogInformation("Successfully deleted audio application with hearing id {hearingRefId}", hearingRefId); } catch (VideoApiException e) { if (e.StatusCode != (int)HttpStatusCode.NotFound) { return(StatusCode(e.StatusCode, e.Response)); } _logger.LogInformation("No audio application found to delete with hearing id {hearingRefId}", hearingRefId); } return(NoContent()); }
public async Task <ActionResult> StopAudioRecordingAsync(Guid hearingId) { try { await _videoApiClient.DeleteAudioApplicationAsync(hearingId); return(Ok()); } catch (VideoApiException e) { _logger.LogError(e, $"Unable to stop audio recording for hearingId: {hearingId}"); return(StatusCode(e.StatusCode, e.Response)); } }
public async Task <IActionResult> DeleteTestDataByPartialCaseText(DeleteTestHearingDataRequest request) { _logger.LogDebug($"DeleteHearingsByPartialCaseText"); List <Guid> hearingIds; try { hearingIds = await _bookingsApiService.DeleteHearingsByPartialCaseText(request); } catch (BookingsApiException e) { return(StatusCode(e.StatusCode, e.Response)); } try { foreach (var hearingId in hearingIds) { await _videoApiClient.DeleteAudioApplicationAsync(hearingId); _logger.LogInformation("Successfully deleted audio application with hearing id {hearingId}", hearingId); } } catch (VideoApiException e) { if (e.StatusCode != (int)HttpStatusCode.NotFound) { _logger.LogError(e, "Failed to delete audio application with error {message}", e.Message); return(StatusCode(e.StatusCode, e.Response)); } } var response = new DeletedResponse() { NumberOfDeletedHearings = hearingIds.Count }; return(Ok(response)); }
public async Task <int> DeleteAudiorecordingApplicationsAsync() { var conferences = await _videoApiClient.GetExpiredAudiorecordingConferencesAsync(); var conferencesCount = 0; if (conferences != null && conferences.Any()) { conferencesCount = conferences.Count; foreach (var conference in conferences) { try { await _videoApiClient.DeleteAudioApplicationAsync(conference.HearingId); } catch (Exception) { conferencesCount--; } } } return(conferencesCount); }