Skip to content

Commit 0ee5917

Browse files
authored
Merge pull request #67 from Bandwidth/SWI-2790
SWI-2790 Add `StartTranscription` and `StopTranscription`
2 parents 76fd4f5 + 5659990 commit 0ee5917

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Xml.Serialization;
2+
3+
namespace Bandwidth.Standard.Voice.Bxml
4+
{
5+
public class CustomParam : IVerb
6+
{
7+
public CustomParam()
8+
{
9+
}
10+
11+
[XmlAttribute("name")]
12+
public string Name { get; set; }
13+
14+
[XmlAttribute("value")]
15+
public string Value { get; set; }
16+
17+
}
18+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections.Generic;
2+
using System.Xml.Serialization;
3+
4+
namespace Bandwidth.Standard.Voice.Bxml
5+
{
6+
public class StartTranscription : IVerb
7+
{
8+
public StartTranscription()
9+
{
10+
Stabilized = true;
11+
}
12+
13+
[XmlAttribute("name")]
14+
public string Name { get; set; }
15+
16+
[XmlAttribute("tracks")]
17+
public string Tracks { get; set; }
18+
19+
[XmlAttribute("transcriptionEventUrl")]
20+
public string TranscriptionEventUrl { get; set; }
21+
22+
[XmlAttribute("transcriptionEventMethod")]
23+
public string TranscriptionEventMethod { get; set; }
24+
25+
[XmlAttribute("username")]
26+
public string Username { get; set; }
27+
28+
[XmlAttribute("password")]
29+
public string Password { get; set; }
30+
31+
[XmlAttribute("destination")]
32+
public string Destination { get; set; }
33+
34+
[XmlAttribute("stabilized")]
35+
public bool Stabilized { get; set; }
36+
37+
[XmlElement("CustomParam")]
38+
public List<CustomParam> CustomParams { get; set; }
39+
40+
}
41+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Xml.Serialization;
2+
3+
namespace Bandwidth.Standard.Voice.Bxml
4+
{
5+
public class StopTranscription : IVerb
6+
{
7+
public StopTranscription()
8+
{
9+
}
10+
11+
[XmlAttribute("name")]
12+
public string Name { get; set; }
13+
14+
}
15+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System.Collections.Generic;
2+
using System.Diagnostics.Contracts;
3+
using Bandwidth.Standard.Voice.Bxml;
4+
using Xunit;
5+
6+
namespace Bandwidth.StandardTests.Voice.Bxml
7+
{
8+
public class StartStopTranscriptionTests
9+
{
10+
11+
[Fact]
12+
public void StartTranscriptionBxmlVerbTest()
13+
{
14+
var expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Response> <StartTranscription name=\"test_transcription\" stabilized=\"true\"> <CustomParam name=\"name1\" value=\"value1\" /> <CustomParam name=\"name2\" value=\"value2\" /> </StartTranscription></Response>";
15+
16+
var customParam1 = new CustomParam();
17+
customParam1.Name = "name1";
18+
customParam1.Value = "value1";
19+
20+
var customParam2 = new CustomParam();
21+
customParam2.Name = "name2";
22+
customParam2.Value = "value2";
23+
24+
var startTranscription = new StartTranscription();
25+
startTranscription.Name = "test_transcription";
26+
startTranscription.CustomParams = new List<CustomParam>()
27+
{
28+
customParam1,
29+
customParam2
30+
};
31+
32+
var response = new Response(startTranscription);
33+
var actual = response.ToBXML();
34+
35+
Assert.Equal(expected, actual.Replace("\n", "").Replace("\r", ""));
36+
}
37+
38+
[Fact]
39+
public void StopTranscriptionmBxmlVerbTest()
40+
{
41+
var expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Response> <StopTranscription name=\"test_transcription\" /></Response>";
42+
var stopTranscription = new StopTranscription();
43+
stopTranscription.Name = "test_transcription";
44+
45+
var response = new Response(stopTranscription);
46+
var actual = response.ToBXML();
47+
48+
Assert.Equal(expected, actual.Replace("\n", "").Replace("\r", ""));
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)