From 5659990c261555d54ca927f7e117804b8aed7dac Mon Sep 17 00:00:00 2001 From: AJ Rice <53190766+ajrice6713@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:57:01 -0400 Subject: [PATCH] SWI-2790 Add `StartTranscription` and `StopTranscription` --- Bandwidth.Standard/Voice/Bxml/CustomParam.cs | 18 +++++++ .../Voice/Bxml/StartTranscription.cs | 41 +++++++++++++++ .../Voice/Bxml/StopTranscription.cs | 15 ++++++ .../Voice/Bxml/StartStopTranscriptionTests.cs | 51 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 Bandwidth.Standard/Voice/Bxml/CustomParam.cs create mode 100644 Bandwidth.Standard/Voice/Bxml/StartTranscription.cs create mode 100644 Bandwidth.Standard/Voice/Bxml/StopTranscription.cs create mode 100644 Bandwidth.StandardTests/Voice/Bxml/StartStopTranscriptionTests.cs diff --git a/Bandwidth.Standard/Voice/Bxml/CustomParam.cs b/Bandwidth.Standard/Voice/Bxml/CustomParam.cs new file mode 100644 index 00000000..7b03b7f4 --- /dev/null +++ b/Bandwidth.Standard/Voice/Bxml/CustomParam.cs @@ -0,0 +1,18 @@ +using System.Xml.Serialization; + +namespace Bandwidth.Standard.Voice.Bxml +{ + public class CustomParam : IVerb + { + public CustomParam() + { + } + + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlAttribute("value")] + public string Value { get; set; } + + } +} diff --git a/Bandwidth.Standard/Voice/Bxml/StartTranscription.cs b/Bandwidth.Standard/Voice/Bxml/StartTranscription.cs new file mode 100644 index 00000000..a7b2fdaf --- /dev/null +++ b/Bandwidth.Standard/Voice/Bxml/StartTranscription.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace Bandwidth.Standard.Voice.Bxml +{ + public class StartTranscription : IVerb + { + public StartTranscription() + { + Stabilized = true; + } + + [XmlAttribute("name")] + public string Name { get; set; } + + [XmlAttribute("tracks")] + public string Tracks { get; set; } + + [XmlAttribute("transcriptionEventUrl")] + public string TranscriptionEventUrl { get; set; } + + [XmlAttribute("transcriptionEventMethod")] + public string TranscriptionEventMethod { get; set; } + + [XmlAttribute("username")] + public string Username { get; set; } + + [XmlAttribute("password")] + public string Password { get; set; } + + [XmlAttribute("destination")] + public string Destination { get; set; } + + [XmlAttribute("stabilized")] + public bool Stabilized { get; set; } + + [XmlElement("CustomParam")] + public List CustomParams { get; set; } + + } +} diff --git a/Bandwidth.Standard/Voice/Bxml/StopTranscription.cs b/Bandwidth.Standard/Voice/Bxml/StopTranscription.cs new file mode 100644 index 00000000..97f967fc --- /dev/null +++ b/Bandwidth.Standard/Voice/Bxml/StopTranscription.cs @@ -0,0 +1,15 @@ +using System.Xml.Serialization; + +namespace Bandwidth.Standard.Voice.Bxml +{ + public class StopTranscription : IVerb + { + public StopTranscription() + { + } + + [XmlAttribute("name")] + public string Name { get; set; } + + } +} diff --git a/Bandwidth.StandardTests/Voice/Bxml/StartStopTranscriptionTests.cs b/Bandwidth.StandardTests/Voice/Bxml/StartStopTranscriptionTests.cs new file mode 100644 index 00000000..37f93877 --- /dev/null +++ b/Bandwidth.StandardTests/Voice/Bxml/StartStopTranscriptionTests.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using Bandwidth.Standard.Voice.Bxml; +using Xunit; + +namespace Bandwidth.StandardTests.Voice.Bxml +{ + public class StartStopTranscriptionTests + { + + [Fact] + public void StartTranscriptionBxmlVerbTest() + { + var expected = " "; + + var customParam1 = new CustomParam(); + customParam1.Name = "name1"; + customParam1.Value = "value1"; + + var customParam2 = new CustomParam(); + customParam2.Name = "name2"; + customParam2.Value = "value2"; + + var startTranscription = new StartTranscription(); + startTranscription.Name = "test_transcription"; + startTranscription.CustomParams = new List() + { + customParam1, + customParam2 + }; + + var response = new Response(startTranscription); + var actual = response.ToBXML(); + + Assert.Equal(expected, actual.Replace("\n", "").Replace("\r", "")); + } + + [Fact] + public void StopTranscriptionmBxmlVerbTest() + { + var expected = " "; + var stopTranscription = new StopTranscription(); + stopTranscription.Name = "test_transcription"; + + var response = new Response(stopTranscription); + var actual = response.ToBXML(); + + Assert.Equal(expected, actual.Replace("\n", "").Replace("\r", "")); + } + } +}