-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from Bandwidth/SWI-2790
SWI-2790 Add `StartTranscription` and `StopTranscription`
- Loading branch information
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<CustomParam> CustomParams { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; } | ||
|
||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
Bandwidth.StandardTests/Voice/Bxml/StartStopTranscriptionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "<?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>"; | ||
|
||
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<CustomParam>() | ||
{ | ||
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 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Response> <StopTranscription name=\"test_transcription\" /></Response>"; | ||
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", "")); | ||
} | ||
} | ||
} |