Skip to content

Commit 76fd4f5

Browse files
authored
Merge pull request #66 from Bandwidth/SWI-2564
SWI-2564
2 parents 9828ac8 + a236a49 commit 76fd4f5

File tree

6 files changed

+118
-2
lines changed

6 files changed

+118
-2
lines changed

Bandwidth.Standard/Voice/Bxml/Recording.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ namespace Bandwidth.Standard.Voice.Bxml
1010
public class Record : IVerb
1111
{
1212

13+
/// <summary>
14+
/// (optional) A boolean value. Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish.
15+
/// </summary>
16+
[XmlAttribute("detectLanguage")]
17+
public bool DetectLanguage { get; set; }
18+
1319
/// <summary>
1420
/// (optional) A boolean value. If true, the recording will be submitted for transcription upon completion. Defaults to false.
1521
/// </summary>

Bandwidth.Standard/Voice/Bxml/StartRecording.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ namespace Bandwidth.Standard.Voice.Bxml
99
public class StartRecording : IVerb
1010
{
1111

12+
/// <summary>
13+
/// (optional) A boolean value. Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish.
14+
/// </summary>
15+
[XmlAttribute("detectLanguage")]
16+
public bool DetectLanguage { get; set; }
17+
1218
/// <summary>
1319
/// (optional) A boolean value. If true, the recording will be submitted for transcription upon completion. Defaults to false.
1420
/// </summary>

Bandwidth.Standard/Voice/Models/TranscribeRecordingRequest.cs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ namespace Bandwidth.Standard.Voice.Models
2020
/// </summary>
2121
public class TranscribeRecordingRequest
2222
{
23+
private bool? detectLanguage;
2324
private Models.CallbackMethodEnum? callbackMethod;
2425
private string username;
2526
private string password;
2627
private string tag;
2728
private double? callbackTimeout;
2829
private Dictionary<string, bool> shouldSerialize = new Dictionary<string, bool>
2930
{
31+
{ "detectLanguage", false },
3032
{ "callbackMethod", false },
3133
{ "username", false },
3234
{ "password", false },
@@ -44,21 +46,30 @@ public TranscribeRecordingRequest()
4446
/// <summary>
4547
/// Initializes a new instance of the <see cref="TranscribeRecordingRequest"/> class.
4648
/// </summary>
49+
/// <param name="detectLanguage">detectLanguage.</param>
4750
/// <param name="callbackUrl">callbackUrl.</param>
4851
/// <param name="callbackMethod">callbackMethod.</param>
4952
/// <param name="username">username.</param>
5053
/// <param name="password">password.</param>
5154
/// <param name="tag">tag.</param>
5255
/// <param name="callbackTimeout">callbackTimeout.</param>
5356
public TranscribeRecordingRequest(
57+
bool? detectLanguage = null,
5458
string callbackUrl = null,
5559
Models.CallbackMethodEnum? callbackMethod = null,
5660
string username = null,
5761
string password = null,
5862
string tag = null,
5963
double? callbackTimeout = null)
6064
{
65+
6166
this.CallbackUrl = callbackUrl;
67+
68+
if (detectLanguage != null)
69+
{
70+
this.DetectLanguage = detectLanguage;
71+
}
72+
6273
if (callbackMethod != null)
6374
{
6475
this.CallbackMethod = callbackMethod;
@@ -92,6 +103,22 @@ public TranscribeRecordingRequest(
92103
[JsonProperty("callbackUrl", NullValueHandling = NullValueHandling.Ignore)]
93104
public string CallbackUrl { get; set; }
94105

106+
/// <summary>
107+
/// Gets or sets DetectLanguage
108+
/// </summary>
109+
[JsonProperty("detectLanguage")]
110+
public bool? DetectLanguage {
111+
get
112+
{
113+
return this.detectLanguage;
114+
}
115+
set
116+
{
117+
this.shouldSerialize["detectLanguage"] = true;
118+
this.detectLanguage = value;
119+
}
120+
}
121+
95122
/// <summary>
96123
/// Gets or sets CallbackMethod.
97124
/// </summary>
@@ -192,6 +219,14 @@ public override string ToString()
192219
return $"TranscribeRecordingRequest : ({string.Join(", ", toStringOutput)})";
193220
}
194221

222+
/// <summary>
223+
/// Marks the field to not be serialized.
224+
/// </summary>
225+
public void UnsetDetectLanguage()
226+
{
227+
this.shouldSerialize["detectLanguage"] = false;
228+
}
229+
195230
/// <summary>
196231
/// Marks the field to not be serailized.
197232
/// </summary>
@@ -232,6 +267,15 @@ public void UnsetCallbackTimeout()
232267
this.shouldSerialize["callbackTimeout"] = false;
233268
}
234269

270+
/// <summary>
271+
/// Checks if the field should be serialized or not.
272+
/// </summary>
273+
/// <returns>A boolean weather the field should be serialized or not.</returns>
274+
public bool ShouldSerializeDetectLanguage()
275+
{
276+
return this.shouldSerialize["detectLanguage"];
277+
}
278+
235279
/// <summary>
236280
/// Checks if the field should be serialized or not.
237281
/// </summary>
@@ -291,6 +335,7 @@ public override bool Equals(object obj)
291335
}
292336

293337
return obj is TranscribeRecordingRequest other &&
338+
((this.DetectLanguage == null && other.DetectLanguage == null) || (this.DetectLanguage?.Equals(other.DetectLanguage) == true)) &&
294339
((this.CallbackUrl == null && other.CallbackUrl == null) || (this.CallbackUrl?.Equals(other.CallbackUrl) == true)) &&
295340
((this.CallbackMethod == null && other.CallbackMethod == null) || (this.CallbackMethod?.Equals(other.CallbackMethod) == true)) &&
296341
((this.Username == null && other.Username == null) || (this.Username?.Equals(other.Username) == true)) &&
@@ -304,6 +349,11 @@ public override int GetHashCode()
304349
{
305350
int hashCode = -2127634834;
306351

352+
if(this.detectLanguage != null)
353+
{
354+
hashCode += this.detectLanguage.GetHashCode();
355+
}
356+
307357
if (this.CallbackUrl != null)
308358
{
309359
hashCode += this.CallbackUrl.GetHashCode();
@@ -343,6 +393,7 @@ public override int GetHashCode()
343393
/// <param name="toStringOutput">List of strings.</param>
344394
protected void ToString(List<string> toStringOutput)
345395
{
396+
toStringOutput.Add($"this.DetectLanguage = {(this.DetectLanguage == null ? "null" : this.DetectLanguage.ToString())}");
346397
toStringOutput.Add($"this.CallbackUrl = {(this.CallbackUrl == null ? "null" : this.CallbackUrl == string.Empty ? "" : this.CallbackUrl)}");
347398
toStringOutput.Add($"this.CallbackMethod = {(this.CallbackMethod == null ? "null" : this.CallbackMethod.ToString())}");
348399
toStringOutput.Add($"this.Username = {(this.Username == null ? "null" : this.Username == string.Empty ? "" : this.Username)}");
@@ -351,4 +402,4 @@ protected void ToString(List<string> toStringOutput)
351402
toStringOutput.Add($"this.CallbackTimeout = {(this.CallbackTimeout == null ? "null" : this.CallbackTimeout.ToString())}");
352403
}
353404
}
354-
}
405+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Bandwidth.Standard.Voice.Bxml;
2+
using Xunit;
3+
4+
namespace Bandwidth.StandardTests.Voice.Bxml
5+
{
6+
public class RecordingTests
7+
{
8+
9+
[Fact]
10+
public void RecordingShouldHaveDetectLanguage()
11+
{
12+
var recording = new Bandwidth.Standard.Voice.Bxml.Record();
13+
recording.DetectLanguage = true;
14+
15+
16+
var bxml = new BXML(recording);
17+
18+
Assert.Equal("<?xml version=\"1.0\" encoding=\"utf-8\"?><Bxml> <Record detectLanguage=\"true\" transcribe=\"false\" /></Bxml>", bxml.ToBXML().Replace("\n", "").Replace("\r", ""));
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Bandwidth.Standard.Voice.Bxml;
2+
using Xunit;
3+
4+
namespace Bandwidth.StandardTests.Voice.Bxml
5+
{
6+
public class StartRecordingTests
7+
{
8+
9+
[Fact]
10+
public void RecordingShouldHaveDetectLanguage()
11+
{
12+
var recording = new StartRecording();
13+
recording.DetectLanguage = true;
14+
15+
16+
var bxml = new BXML(recording);
17+
18+
Assert.Equal("<?xml version=\"1.0\" encoding=\"utf-8\"?><Bxml> <StartRecording detectLanguage=\"true\" transcribe=\"false\" multiChannel=\"false\" /></Bxml>", bxml.ToBXML().Replace("\n", "").Replace("\r", ""));
19+
}
20+
}
21+
}

Bandwidth.StandardTests/Voice/ModelTests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ public void CheckModifyCallRequestCallStateStatus()
105105
};
106106

107107
Assert.Equal(StateEnum.Active, modifyCallRequest.State);
108-
}
108+
}
109+
110+
[Fact]
111+
public void CheckTranscribeRecordingRequestDetectLanguage()
112+
{
113+
var transcribeCallRequest = new TranscribeRecordingRequest
114+
{
115+
DetectLanguage = true
116+
};
117+
118+
Assert.Equal(true, transcribeCallRequest.DetectLanguage);
119+
}
109120
}
110121
}

0 commit comments

Comments
 (0)