diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java index ab277b6c9987..d4ea1b66d28b 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java @@ -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() @@ -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() @@ -384,6 +394,12 @@ Mono> answerCallWithResponseInternal(AnswerCallOption CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal(); callIntelligenceOptionsInternal.setCognitiveServicesEndpoint( answerCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint()); + + if (answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) { + callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint( + answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint()); + } + request.setCallIntelligenceOptions(callIntelligenceOptionsInternal); } @@ -582,6 +598,12 @@ Mono> connectCallWithResponseInternal(ConnectCallOpt CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal(); callIntelligenceOptionsInternal.setCognitiveServicesEndpoint( connectCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint()); + + if (connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) { + callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint( + connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint()); + } + request.setCallIntelligenceOptions(callIntelligenceOptionsInternal); } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java index ef6a1ac8638e..574d7c291acd 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java @@ -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; @@ -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> startRecording(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @@ -99,6 +100,13 @@ Mono> pauseRecording(@HostParam("endpoint") String endpoint, Mono> 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> getRecordingResult(@HostParam("endpoint") String endpoint, + @PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); } /** @@ -566,4 +574,97 @@ public Response 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> 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> 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 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 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 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(); + } } diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallIntelligenceOptionsInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallIntelligenceOptionsInternal.java index 3ee92c645bb8..a5f84949726e 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallIntelligenceOptionsInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallIntelligenceOptionsInternal.java @@ -21,6 +21,11 @@ public final class CallIntelligenceOptionsInternal implements JsonSerializable { - /** - * Static value unknown for CallLocatorKindInternal. - */ - public static final CallLocatorKindInternal UNKNOWN = fromString("unknown"); - /** * Static value groupCallLocator for CallLocatorKindInternal. */ diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallSessionEndReason.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallSessionEndReason.java new file mode 100644 index 000000000000..f2f426200c5a --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallSessionEndReason.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for CallSessionEndReason. + */ +public final class CallSessionEndReason extends ExpandableStringEnum { + /** + * Static value sessionStillOngoing for CallSessionEndReason. + */ + public static final CallSessionEndReason SESSION_STILL_ONGOING = fromString("sessionStillOngoing"); + + /** + * Static value callEnded for CallSessionEndReason. + */ + public static final CallSessionEndReason CALL_ENDED = fromString("callEnded"); + + /** + * Static value initiatorLeft for CallSessionEndReason. + */ + public static final CallSessionEndReason INITIATOR_LEFT = fromString("initiatorLeft"); + + /** + * Static value handedOverOrTransfered for CallSessionEndReason. + */ + public static final CallSessionEndReason HANDED_OVER_OR_TRANSFERED = fromString("handedOverOrTransfered"); + + /** + * Static value maximumSessionTimeReached for CallSessionEndReason. + */ + public static final CallSessionEndReason MAXIMUM_SESSION_TIME_REACHED = fromString("maximumSessionTimeReached"); + + /** + * Static value callStartTimeout for CallSessionEndReason. + */ + public static final CallSessionEndReason CALL_START_TIMEOUT = fromString("callStartTimeout"); + + /** + * Static value mediaTimeout for CallSessionEndReason. + */ + public static final CallSessionEndReason MEDIA_TIMEOUT = fromString("mediaTimeout"); + + /** + * Static value audioStreamFailure for CallSessionEndReason. + */ + public static final CallSessionEndReason AUDIO_STREAM_FAILURE = fromString("audioStreamFailure"); + + /** + * Static value allInstancesBusy for CallSessionEndReason. + */ + public static final CallSessionEndReason ALL_INSTANCES_BUSY = fromString("allInstancesBusy"); + + /** + * Static value teamsTokenConversionFailed for CallSessionEndReason. + */ + public static final CallSessionEndReason TEAMS_TOKEN_CONVERSION_FAILED = fromString("teamsTokenConversionFailed"); + + /** + * Static value reportCallStateFailed for CallSessionEndReason. + */ + public static final CallSessionEndReason REPORT_CALL_STATE_FAILED = fromString("reportCallStateFailed"); + + /** + * Static value reportCallStateFailedAndSessionMustBeDiscarded for CallSessionEndReason. + */ + public static final CallSessionEndReason REPORT_CALL_STATE_FAILED_AND_SESSION_MUST_BE_DISCARDED + = fromString("reportCallStateFailedAndSessionMustBeDiscarded"); + + /** + * Static value couldNotRejoinCall for CallSessionEndReason. + */ + public static final CallSessionEndReason COULD_NOT_REJOIN_CALL = fromString("couldNotRejoinCall"); + + /** + * Static value invalidBotData for CallSessionEndReason. + */ + public static final CallSessionEndReason INVALID_BOT_DATA = fromString("invalidBotData"); + + /** + * Static value couldNotStart for CallSessionEndReason. + */ + public static final CallSessionEndReason COULD_NOT_START = fromString("couldNotStart"); + + /** + * Static value appHostedMediaFailureOutcomeWithError for CallSessionEndReason. + */ + public static final CallSessionEndReason APP_HOSTED_MEDIA_FAILURE_OUTCOME_WITH_ERROR + = fromString("appHostedMediaFailureOutcomeWithError"); + + /** + * Static value appHostedMediaFailureOutcomeGracefully for CallSessionEndReason. + */ + public static final CallSessionEndReason APP_HOSTED_MEDIA_FAILURE_OUTCOME_GRACEFULLY + = fromString("appHostedMediaFailureOutcomeGracefully"); + + /** + * Static value handedOverDueToMediaTimeout for CallSessionEndReason. + */ + public static final CallSessionEndReason HANDED_OVER_DUE_TO_MEDIA_TIMEOUT + = fromString("handedOverDueToMediaTimeout"); + + /** + * Static value handedOverDueToAudioStreamFailure for CallSessionEndReason. + */ + public static final CallSessionEndReason HANDED_OVER_DUE_TO_AUDIO_STREAM_FAILURE + = fromString("handedOverDueToAudioStreamFailure"); + + /** + * Static value speechRecognitionSessionNonRetriableError for CallSessionEndReason. + */ + public static final CallSessionEndReason SPEECH_RECOGNITION_SESSION_NON_RETRIABLE_ERROR + = fromString("speechRecognitionSessionNonRetriableError"); + + /** + * Static value speechRecognitionSessionRetriableErrorMaxRetryCountReached for CallSessionEndReason. + */ + public static final CallSessionEndReason SPEECH_RECOGNITION_SESSION_RETRIABLE_ERROR_MAX_RETRY_COUNT_REACHED + = fromString("speechRecognitionSessionRetriableErrorMaxRetryCountReached"); + + /** + * Static value handedOverDueToChunkCreationFailure for CallSessionEndReason. + */ + public static final CallSessionEndReason HANDED_OVER_DUE_TO_CHUNK_CREATION_FAILURE + = fromString("handedOverDueToChunkCreationFailure"); + + /** + * Static value chunkCreationFailed for CallSessionEndReason. + */ + public static final CallSessionEndReason CHUNK_CREATION_FAILED = fromString("chunkCreationFailed"); + + /** + * Static value handedOverDueToProcessingTimeout for CallSessionEndReason. + */ + public static final CallSessionEndReason HANDED_OVER_DUE_TO_PROCESSING_TIMEOUT + = fromString("handedOverDueToProcessingTimeout"); + + /** + * Static value processingTimeout for CallSessionEndReason. + */ + public static final CallSessionEndReason PROCESSING_TIMEOUT = fromString("processingTimeout"); + + /** + * Static value transcriptObjectCreationFailed for CallSessionEndReason. + */ + public static final CallSessionEndReason TRANSCRIPT_OBJECT_CREATION_FAILED + = fromString("transcriptObjectCreationFailed"); + + /** + * Creates a new instance of CallSessionEndReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CallSessionEndReason() { + } + + /** + * Creates or finds a CallSessionEndReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CallSessionEndReason. + */ + public static CallSessionEndReason fromString(String name) { + return fromString(name, CallSessionEndReason.class); + } + + /** + * Gets known CallSessionEndReason values. + * + * @return known CallSessionEndReason values. + */ + public static Collection values() { + return values(CallSessionEndReason.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/ChunkEndReason.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/ChunkEndReason.java new file mode 100644 index 000000000000..de4b5cfc84d7 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/ChunkEndReason.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Reason this chunk ended. + */ +public final class ChunkEndReason extends ExpandableStringEnum { + /** + * Static value chunkIsBeingRecorded for ChunkEndReason. + */ + public static final ChunkEndReason CHUNK_IS_BEING_RECORDED = fromString("chunkIsBeingRecorded"); + + /** + * Static value sessionEnded for ChunkEndReason. + */ + public static final ChunkEndReason SESSION_ENDED = fromString("sessionEnded"); + + /** + * Static value chunkMaximumSizeExceeded for ChunkEndReason. + */ + public static final ChunkEndReason CHUNK_MAXIMUM_SIZE_EXCEEDED = fromString("chunkMaximumSizeExceeded"); + + /** + * Static value chunkMaximumTimeExceeded for ChunkEndReason. + */ + public static final ChunkEndReason CHUNK_MAXIMUM_TIME_EXCEEDED = fromString("chunkMaximumTimeExceeded"); + + /** + * Static value chunkUploadFailure for ChunkEndReason. + */ + public static final ChunkEndReason CHUNK_UPLOAD_FAILURE = fromString("chunkUploadFailure"); + + /** + * Creates a new instance of ChunkEndReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ChunkEndReason() { + } + + /** + * Creates or finds a ChunkEndReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChunkEndReason. + */ + public static ChunkEndReason fromString(String name) { + return fromString(name, ChunkEndReason.class); + } + + /** + * Gets known ChunkEndReason values. + * + * @return known ChunkEndReason values. + */ + public static Collection values() { + return values(ChunkEndReason.class); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/Error.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/Error.java new file mode 100644 index 000000000000..7fd4d787da01 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/Error.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Error details. + */ +@Fluent +public final class Error implements JsonSerializable { + /* + * Error code + */ + private String code; + + /* + * Error message + */ + private String message; + + /* + * Inner error details + */ + private Error innerError; + + /** + * Creates an instance of Error class. + */ + public Error() { + } + + /** + * Get the code property: Error code. + * + * @return the code value. + */ + public String getCode() { + return this.code; + } + + /** + * Set the code property: Error code. + * + * @param code the code value to set. + * @return the Error object itself. + */ + public Error setCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: Error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: Error message. + * + * @param message the message value to set. + * @return the Error object itself. + */ + public Error setMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the innerError property: Inner error details. + * + * @return the innerError value. + */ + public Error getInnerError() { + return this.innerError; + } + + /** + * Set the innerError property: Inner error details. + * + * @param innerError the innerError value to set. + * @return the Error object itself. + */ + public Error setInnerError(Error innerError) { + this.innerError = innerError; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeJsonField("innerError", this.innerError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Error from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Error if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Error. + */ + public static Error fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Error deserializedError = new Error(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedError.message = reader.getString(); + } else if ("innerError".equals(fieldName)) { + deserializedError.innerError = Error.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedError; + }); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldAudioCompleted.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldAudioCompleted.java index ad5dd13f01a1..d4a3a740d3ae 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldAudioCompleted.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/HoldAudioCompleted.java @@ -12,7 +12,7 @@ import java.io.IOException; /** - * The HoldAudioCompleted model. + * Hold Audio Completed event. */ @Fluent public final class HoldAudioCompleted implements JsonSerializable { diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/PlayOptionsInternal.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/PlayOptionsInternal.java index f5060c8ee2b4..3270d9e10960 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/PlayOptionsInternal.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/PlayOptionsInternal.java @@ -26,6 +26,11 @@ public final class PlayOptionsInternal implements JsonSerializable { + /* + * Chunk document id + */ + private String documentId; + + /* + * Chunks order in a multi chunk recording + */ + private Integer index; + + /* + * Reason this chunk ended + */ + private ChunkEndReason endReason; + + /* + * Location of the chunk + */ + private String contentLocation; + + /* + * Location of chunk metadata + */ + private String metadataLocation; + + /* + * Callback for deleting chunk + */ + private String deleteLocation; + + /** + * Creates an instance of RecordingChunkStorageInfo class. + */ + public RecordingChunkStorageInfo() { + } + + /** + * Get the documentId property: Chunk document id. + * + * @return the documentId value. + */ + public String getDocumentId() { + return this.documentId; + } + + /** + * Set the documentId property: Chunk document id. + * + * @param documentId the documentId value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setDocumentId(String documentId) { + this.documentId = documentId; + return this; + } + + /** + * Get the index property: Chunks order in a multi chunk recording. + * + * @return the index value. + */ + public Integer getIndex() { + return this.index; + } + + /** + * Set the index property: Chunks order in a multi chunk recording. + * + * @param index the index value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setIndex(Integer index) { + this.index = index; + return this; + } + + /** + * Get the endReason property: Reason this chunk ended. + * + * @return the endReason value. + */ + public ChunkEndReason getEndReason() { + return this.endReason; + } + + /** + * Set the endReason property: Reason this chunk ended. + * + * @param endReason the endReason value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setEndReason(ChunkEndReason endReason) { + this.endReason = endReason; + return this; + } + + /** + * Get the contentLocation property: Location of the chunk. + * + * @return the contentLocation value. + */ + public String getContentLocation() { + return this.contentLocation; + } + + /** + * Set the contentLocation property: Location of the chunk. + * + * @param contentLocation the contentLocation value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setContentLocation(String contentLocation) { + this.contentLocation = contentLocation; + return this; + } + + /** + * Get the metadataLocation property: Location of chunk metadata. + * + * @return the metadataLocation value. + */ + public String getMetadataLocation() { + return this.metadataLocation; + } + + /** + * Set the metadataLocation property: Location of chunk metadata. + * + * @param metadataLocation the metadataLocation value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setMetadataLocation(String metadataLocation) { + this.metadataLocation = metadataLocation; + return this; + } + + /** + * Get the deleteLocation property: Callback for deleting chunk. + * + * @return the deleteLocation value. + */ + public String getDeleteLocation() { + return this.deleteLocation; + } + + /** + * Set the deleteLocation property: Callback for deleting chunk. + * + * @param deleteLocation the deleteLocation value to set. + * @return the RecordingChunkStorageInfo object itself. + */ + public RecordingChunkStorageInfo setDeleteLocation(String deleteLocation) { + this.deleteLocation = deleteLocation; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("documentId", this.documentId); + jsonWriter.writeNumberField("index", this.index); + jsonWriter.writeStringField("endReason", this.endReason == null ? null : this.endReason.toString()); + jsonWriter.writeStringField("contentLocation", this.contentLocation); + jsonWriter.writeStringField("metadataLocation", this.metadataLocation); + jsonWriter.writeStringField("deleteLocation", this.deleteLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecordingChunkStorageInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecordingChunkStorageInfo if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecordingChunkStorageInfo. + */ + public static RecordingChunkStorageInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecordingChunkStorageInfo deserializedRecordingChunkStorageInfo = new RecordingChunkStorageInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("documentId".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.documentId = reader.getString(); + } else if ("index".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.index = reader.getNullable(JsonReader::getInt); + } else if ("endReason".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.endReason = ChunkEndReason.fromString(reader.getString()); + } else if ("contentLocation".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.contentLocation = reader.getString(); + } else if ("metadataLocation".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.metadataLocation = reader.getString(); + } else if ("deleteLocation".equals(fieldName)) { + deserializedRecordingChunkStorageInfo.deleteLocation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecordingChunkStorageInfo; + }); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingResultResponse.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingResultResponse.java new file mode 100644 index 000000000000..a76635d792f3 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingResultResponse.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Recording result data. + */ +@Immutable +public final class RecordingResultResponse implements JsonSerializable { + /* + * The recordingId property. + */ + private String recordingId; + + /* + * Container for chunks + */ + private RecordingStorageInfo recordingStorageInfo; + + /* + * The errors property. + */ + private List errors; + + /* + * The recordingStartTime property. + */ + private OffsetDateTime recordingStartTime; + + /* + * The recordingDurationMs property. + */ + private Long recordingDurationMs; + + /* + * The sessionEndReason property. + */ + private CallSessionEndReason sessionEndReason; + + /* + * The recordingExpirationTime property. + */ + private OffsetDateTime recordingExpirationTime; + + /** + * Creates an instance of RecordingResultResponse class. + */ + public RecordingResultResponse() { + } + + /** + * Get the recordingId property: The recordingId property. + * + * @return the recordingId value. + */ + public String getRecordingId() { + return this.recordingId; + } + + /** + * Get the recordingStorageInfo property: Container for chunks. + * + * @return the recordingStorageInfo value. + */ + public RecordingStorageInfo getRecordingStorageInfo() { + return this.recordingStorageInfo; + } + + /** + * Get the errors property: The errors property. + * + * @return the errors value. + */ + public List getErrors() { + return this.errors; + } + + /** + * Get the recordingStartTime property: The recordingStartTime property. + * + * @return the recordingStartTime value. + */ + public OffsetDateTime getRecordingStartTime() { + return this.recordingStartTime; + } + + /** + * Get the recordingDurationMs property: The recordingDurationMs property. + * + * @return the recordingDurationMs value. + */ + public Long getRecordingDurationMs() { + return this.recordingDurationMs; + } + + /** + * Get the sessionEndReason property: The sessionEndReason property. + * + * @return the sessionEndReason value. + */ + public CallSessionEndReason getSessionEndReason() { + return this.sessionEndReason; + } + + /** + * Get the recordingExpirationTime property: The recordingExpirationTime property. + * + * @return the recordingExpirationTime value. + */ + public OffsetDateTime getRecordingExpirationTime() { + return this.recordingExpirationTime; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecordingResultResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecordingResultResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecordingResultResponse. + */ + public static RecordingResultResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecordingResultResponse deserializedRecordingResultResponse = new RecordingResultResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recordingId".equals(fieldName)) { + deserializedRecordingResultResponse.recordingId = reader.getString(); + } else if ("recordingStorageInfo".equals(fieldName)) { + deserializedRecordingResultResponse.recordingStorageInfo = RecordingStorageInfo.fromJson(reader); + } else if ("errors".equals(fieldName)) { + List errors = reader.readArray(reader1 -> Error.fromJson(reader1)); + deserializedRecordingResultResponse.errors = errors; + } else if ("recordingStartTime".equals(fieldName)) { + deserializedRecordingResultResponse.recordingStartTime + = reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString())); + } else if ("recordingDurationMs".equals(fieldName)) { + deserializedRecordingResultResponse.recordingDurationMs = reader.getNullable(JsonReader::getLong); + } else if ("sessionEndReason".equals(fieldName)) { + deserializedRecordingResultResponse.sessionEndReason + = CallSessionEndReason.fromString(reader.getString()); + } else if ("recordingExpirationTime".equals(fieldName)) { + deserializedRecordingResultResponse.recordingExpirationTime + = reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedRecordingResultResponse; + }); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStorageInfo.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStorageInfo.java new file mode 100644 index 000000000000..581e9e8bfdd4 --- /dev/null +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/RecordingStorageInfo.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.callautomation.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Container for chunks. + */ +@Fluent +public final class RecordingStorageInfo implements JsonSerializable { + /* + * Collection of {Microsoft.Skype.Platform.ExecutionAgent.Azure.Communication.Service.ServerCalling.Content.Contracts.ALPHA4_2024_09_01_preview.Models.RecordingChunkStorageInfo} + */ + private List recordingChunks; + + /** + * Creates an instance of RecordingStorageInfo class. + */ + public RecordingStorageInfo() { + } + + /** + * Get the recordingChunks property: Collection of + * {Microsoft.Skype.Platform.ExecutionAgent.Azure.Communication.Service.ServerCalling.Content.Contracts.ALPHA4_2024_09_01_preview.Models.RecordingChunkStorageInfo}. + * + * @return the recordingChunks value. + */ + public List getRecordingChunks() { + return this.recordingChunks; + } + + /** + * Set the recordingChunks property: Collection of + * {Microsoft.Skype.Platform.ExecutionAgent.Azure.Communication.Service.ServerCalling.Content.Contracts.ALPHA4_2024_09_01_preview.Models.RecordingChunkStorageInfo}. + * + * @param recordingChunks the recordingChunks value to set. + * @return the RecordingStorageInfo object itself. + */ + public RecordingStorageInfo setRecordingChunks(List recordingChunks) { + this.recordingChunks = recordingChunks; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("recordingChunks", this.recordingChunks, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecordingStorageInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecordingStorageInfo if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecordingStorageInfo. + */ + public static RecordingStorageInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecordingStorageInfo deserializedRecordingStorageInfo = new RecordingStorageInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recordingChunks".equals(fieldName)) { + List recordingChunks + = reader.readArray(reader1 -> RecordingChunkStorageInfo.fromJson(reader1)); + deserializedRecordingStorageInfo.recordingChunks = recordingChunks; + } else { + reader.skipChildren(); + } + } + + return deserializedRecordingStorageInfo; + }); + } +} diff --git a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CallIntelligenceOptions.java b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CallIntelligenceOptions.java index 8a17215b4930..49b91b15fd26 100644 --- a/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CallIntelligenceOptions.java +++ b/sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/models/CallIntelligenceOptions.java @@ -16,6 +16,11 @@ public final class CallIntelligenceOptions { */ private String cognitiveServicesEndpoint; + /** + * A backup endpoint URL of the Azure Cognitive Services resource attached + */ + private String backupCognitiveServicesEndpoint; + /** * Creates an instance of {@link CallIntelligenceOptions}. */ @@ -37,11 +42,32 @@ public String getCognitiveServicesEndpoint() { * attached. * * @param cognitiveServicesEndpoint the cognitiveServicesEndpoint value to set. - * @return the CreateGroupCallOptions object itself. + * @return the CallIntelligenceOptions object itself. */ public CallIntelligenceOptions setCognitiveServicesEndpoint(String cognitiveServicesEndpoint) { this.cognitiveServicesEndpoint = cognitiveServicesEndpoint; return this; } + /** + * Get the backupCognitiveServicesEndpoint property: A backup endpoint URL of the Azure Cognitive Services resource + * attached. + * + * @return the backupCognitiveServicesEndpoint value. + */ + public String getBackupCognitiveServicesEndpoint() { + return this.backupCognitiveServicesEndpoint; + } + + /** + * Set the backupCognitiveServicesEndpoint property: A backup endpoint URL of the Azure Cognitive Services resource + * attached. + * + * @param backupCognitiveServicesEndpoint the backupCognitiveServicesEndpoint value to set. + * @return the CallIntelligenceOptions object itself. + */ + public CallIntelligenceOptions setBackupCognitiveServicesEndpoint(String backupCognitiveServicesEndpoint) { + this.backupCognitiveServicesEndpoint = backupCognitiveServicesEndpoint; + return this; + } } diff --git a/sdk/communication/azure-communication-callautomation/swagger/README.md b/sdk/communication/azure-communication-callautomation/swagger/README.md index 671f69250d3a..2f586f56dbc7 100644 --- a/sdk/communication/azure-communication-callautomation/swagger/README.md +++ b/sdk/communication/azure-communication-callautomation/swagger/README.md @@ -32,7 +32,7 @@ autorest README.md --java --v4 tag: package-2024-09-01-preview use: '@autorest/java@4.1.29' require: - - https://github.com/Azure/azure-rest-api-specs/blob/691fea3efb9ff22b20904e92d5116223f452a3b1/specification/communication/data-plane/CallAutomation/readme.md + - https://github.com/Azure/azure-rest-api-specs/blob/d1bedfa9c084a2e3f9cbeb075c532d691c3c0095/specification/communication/data-plane/CallAutomation/readme.md java: true output-folder: ../ license-header: MICROSOFT_MIT_SMALL