Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Added backupCognitiveServicesEndpoint to CallIntelligenceOptions #43826

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ private CreateCallRequestInternal getCreateCallRequestInternal(CreateCallOptions
callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
createCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());

if (createCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
createCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
}
}

CreateCallRequestInternal request = new CreateCallRequestInternal()
Expand Down Expand Up @@ -279,6 +284,11 @@ private CreateCallRequestInternal getCreateCallRequestInternal(CreateGroupCallOp
callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
createCallGroupOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());

if (createCallGroupOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
createCallGroupOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
}
}

CreateCallRequestInternal request = new CreateCallRequestInternal()
Expand Down Expand Up @@ -384,6 +394,12 @@ Mono<Response<AnswerCallResult>> answerCallWithResponseInternal(AnswerCallOption
CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
answerCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());

if (answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
}

request.setCallIntelligenceOptions(callIntelligenceOptionsInternal);
}

Expand Down Expand Up @@ -582,6 +598,12 @@ Mono<Response<ConnectCallResult>> connectCallWithResponseInternal(ConnectCallOpt
CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
connectCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());

if (connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
}

request.setCallIntelligenceOptions(callIntelligenceOptionsInternal);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package com.azure.communication.callautomation.implementation;

import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException;
import com.azure.communication.callautomation.implementation.models.RecordingResultResponse;
import com.azure.communication.callautomation.implementation.models.RecordingStateResponseInternal;
import com.azure.communication.callautomation.implementation.models.StartCallRecordingRequestInternal;
import com.azure.core.annotation.BodyParam;
Expand Down Expand Up @@ -63,7 +64,7 @@ public final class CallRecordingsImpl {
@ServiceInterface(name = "AzureCommunicationCa")
public interface CallRecordingsService {
@Post("/calling/recordings")
@ExpectedResponses({ 200, 202 })
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<RecordingStateResponseInternal>> startRecording(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion,
Expand Down Expand Up @@ -99,6 +100,13 @@ Mono<Response<Void>> pauseRecording(@HostParam("endpoint") String endpoint,
Mono<Response<Void>> resumeRecording(@HostParam("endpoint") String endpoint,
@PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);

@Get("/calling/recordings/{recordingId}/result")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
Mono<Response<RecordingResultResponse>> getRecordingResult(@HostParam("endpoint") String endpoint,
@PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
}

/**
Expand Down Expand Up @@ -566,4 +574,97 @@ public Response<Void> resumeRecordingWithResponse(String recordingId, Context co
public void resumeRecording(String recordingId) {
resumeRecordingWithResponse(recordingId, Context.NONE);
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId) {
final String accept = "application/json";
return FluxUtil.withContext(context -> service.getRecordingResult(this.client.getEndpoint(), recordingId,
this.client.getApiVersion(), accept, context));
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId,
Context context) {
final String accept = "application/json";
return service.getRecordingResult(this.client.getEndpoint(), recordingId, this.client.getApiVersion(), accept,
context);
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId) {
return getRecordingResultWithResponseAsync(recordingId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId, Context context) {
return getRecordingResultWithResponseAsync(recordingId, context)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<RecordingResultResponse> getRecordingResultWithResponse(String recordingId, Context context) {
return getRecordingResultWithResponseAsync(recordingId, context).block();
}

/**
* Get recording result. This includes the download URLs for the recording chunks.
*
* @param recordingId The recording id.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return recording result.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordingResultResponse getRecordingResult(String recordingId) {
return getRecordingResultWithResponse(recordingId, Context.NONE).getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public final class CallIntelligenceOptionsInternal implements JsonSerializable<C
*/
private String cognitiveServicesEndpoint;

/*
* A backup identifier of the Cognitive Service resource assigned to this call.
*/
private String backupCognitiveServicesEndpoint;

/**
* Creates an instance of CallIntelligenceOptionsInternal class.
*/
Expand Down Expand Up @@ -49,13 +54,36 @@ public CallIntelligenceOptionsInternal setCognitiveServicesEndpoint(String cogni
return this;
}

/**
* Get the backupCognitiveServicesEndpoint property: A backup identifier of the Cognitive Service resource assigned
* to this call.
*
* @return the backupCognitiveServicesEndpoint value.
*/
public String getBackupCognitiveServicesEndpoint() {
return this.backupCognitiveServicesEndpoint;
}

/**
* Set the backupCognitiveServicesEndpoint property: A backup identifier of the Cognitive Service resource assigned
* to this call.
*
* @param backupCognitiveServicesEndpoint the backupCognitiveServicesEndpoint value to set.
* @return the CallIntelligenceOptionsInternal object itself.
*/
public CallIntelligenceOptionsInternal setBackupCognitiveServicesEndpoint(String backupCognitiveServicesEndpoint) {
this.backupCognitiveServicesEndpoint = backupCognitiveServicesEndpoint;
return this;
}

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("cognitiveServicesEndpoint", this.cognitiveServicesEndpoint);
jsonWriter.writeStringField("backupCognitiveServicesEndpoint", this.backupCognitiveServicesEndpoint);
return jsonWriter.writeEndObject();
}

Expand All @@ -77,6 +105,8 @@ public static CallIntelligenceOptionsInternal fromJson(JsonReader jsonReader) th

if ("cognitiveServicesEndpoint".equals(fieldName)) {
deserializedCallIntelligenceOptionsInternal.cognitiveServicesEndpoint = reader.getString();
} else if ("backupCognitiveServicesEndpoint".equals(fieldName)) {
deserializedCallIntelligenceOptionsInternal.backupCognitiveServicesEndpoint = reader.getString();
} else {
reader.skipChildren();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class CallLocatorInternal implements JsonSerializable<CallLocatorIn
private String serverCallId;

/*
* The Acs room id
* The Acs room id. (Not supported for Start Recording)
*/
private String roomId;

Expand Down Expand Up @@ -83,7 +83,7 @@ public CallLocatorInternal setServerCallId(String serverCallId) {
}

/**
* Get the roomId property: The Acs room id.
* Get the roomId property: The Acs room id. (Not supported for Start Recording).
*
* @return the roomId value.
*/
Expand All @@ -92,7 +92,7 @@ public String getRoomId() {
}

/**
* Set the roomId property: The Acs room id.
* Set the roomId property: The Acs room id. (Not supported for Start Recording).
*
* @param roomId the roomId value to set.
* @return the CallLocatorInternal object itself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
* The call locator kind.
*/
public final class CallLocatorKindInternal extends ExpandableStringEnum<CallLocatorKindInternal> {
/**
* Static value unknown for CallLocatorKindInternal.
*/
public static final CallLocatorKindInternal UNKNOWN = fromString("unknown");

/**
* Static value groupCallLocator for CallLocatorKindInternal.
*/
Expand Down
Loading
Loading