diff --git a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs index 35e2b38cdb3c3..5ff468e1ac1bf 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/api/Azure.Communication.CallAutomation.netstandard2.0.cs @@ -1535,4 +1535,23 @@ public enum TextFormat { Display = 0, } + public partial class TranscriptionData : Azure.Communication.CallAutomation.TranscriptionPackageBase + { + internal TranscriptionData() { } + public double Confidence { get { throw null; } set { } } + public Azure.Communication.CallAutomation.Models.Transcription.TextFormat Format { get { throw null; } set { } } + public ulong Offset { get { throw null; } set { } } + public Azure.Communication.CommunicationUserIdentifier Participant { get { throw null; } set { } } + public Azure.Communication.CallAutomation.Models.Transcription.ResultStatus ResultStatus { get { throw null; } set { } } + public string Text { get { throw null; } set { } } + public System.Collections.Generic.IEnumerable Words { get { throw null; } set { } } + } + public partial class WordData + { + public WordData() { } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("offset")] + public ulong Offset { get { throw null; } set { } } + [System.Text.Json.Serialization.JsonPropertyNameAttribute("text")] + public string Text { get { throw null; } set { } } + } } diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionData.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionData.cs index c59841900cb1e..0cbf7ba34fa52 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionData.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionData.cs @@ -10,9 +10,9 @@ namespace Azure.Communication.CallAutomation.Models.Transcription /// /// Streaming Transcription. /// - internal class TranscriptionData : TranscriptionPackageBase + public class TranscriptionData : TranscriptionPackageBase { - internal TranscriptionData(string text, string format, double confidence, ulong offset, IEnumerable words, string participantRawID, string resultStatus) + internal TranscriptionData(string text, string format, double confidence, ulong offset, IEnumerable words, string participantRawID, string resultStatus) { Text = text; Format = ConvertToTextFormatEnum(format); @@ -50,7 +50,7 @@ internal TranscriptionData(string text, string format, double confidence, ulong /// /// The result for each word of the phrase /// - public IEnumerable Words { get; set; } + public IEnumerable Words { get; set; } /// /// The identified speaker based on participant raw ID diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionDataInternal.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionDataInternal.cs index e4351402df224..510133f065e06 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionDataInternal.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionDataInternal.cs @@ -40,7 +40,7 @@ internal class TranscriptionDataInternal /// The result for each word of the phrase /// [JsonPropertyName("words")] - public IEnumerable Words { get; set; } + public IEnumerable Words { get; set; } /// /// The identified speaker based on participant raw ID diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionPackageParser.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionPackageParser.cs index d0e55e5742705..4663c7d7c76f1 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionPackageParser.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/TranscriptionPackageParser.cs @@ -43,11 +43,14 @@ public static TranscriptionPackageBase Parse(byte[] receivedBytes) public static TranscriptionPackageBase Parse(string stringJson) { JsonElement package = JsonDocument.Parse(stringJson).RootElement; - if (package.GetProperty("kind").ToString() == "TranscriptionMetadata") + + string kind = package.GetProperty("kind").ToString(); + + if (kind == "TranscriptionMetadata") { return JsonSerializer.Deserialize(package.GetProperty("transcriptionMetadata").ToString()); } - else if (package.GetProperty("kind").ToString() == "TranscriptionData") + else if (kind == "TranscriptionData") { TranscriptionDataInternal transcriptionDataInternal = JsonSerializer.Deserialize( package.GetProperty("transcriptionData").ToString() diff --git a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/Word.cs b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/WordData.cs similarity index 83% rename from sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/Word.cs rename to sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/WordData.cs index fa3af8844d9bf..816ea137563a4 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/Word.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/src/Models/Transcription/WordData.cs @@ -5,7 +5,10 @@ namespace Azure.Communication.CallAutomation.Models.Transcription { - internal class Word + /// + /// The result for each word of the phrase + /// + public class WordData { /// /// Text in the phrase. diff --git a/sdk/communication/Azure.Communication.CallAutomation/tests/Transcription/TranscriptionPackageParserTests.cs b/sdk/communication/Azure.Communication.CallAutomation/tests/Transcription/TranscriptionPackageParserTests.cs index cce2f591f9afb..a0ff4ad669e6b 100644 --- a/sdk/communication/Azure.Communication.CallAutomation/tests/Transcription/TranscriptionPackageParserTests.cs +++ b/sdk/communication/Azure.Communication.CallAutomation/tests/Transcription/TranscriptionPackageParserTests.cs @@ -159,7 +159,7 @@ private static void ValidateTranscriptionData(TranscriptionData transcription) Assert.AreEqual(1, transcription.Offset); // validate individual words - IList words = transcription.Words.ToList(); + IList words = transcription.Words.ToList(); Assert.AreEqual(2, words.Count); Assert.AreEqual("Hello", words[0].Text); Assert.AreEqual(1, words[0].Offset);