Skip to content

Commit

Permalink
Adding Language and style, marking VoiceName as obsolete, also removi…
Browse files Browse the repository at this point in the history
…ng some unnecessary usings
  • Loading branch information
slorello89 committed Oct 7, 2020
1 parent b445e0c commit 6070d98
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 26 deletions.
11 changes: 4 additions & 7 deletions Vonage.Test.Unit/NccoTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using Newtonsoft.Json;
using Vonage.Voice.Nccos;
using Vonage.Voice.Nccos.Endpoints;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Vonage.Test.Unit
Expand Down Expand Up @@ -86,14 +81,16 @@ public void TestConnect()
[Fact]
public void TestTalk()
{
var expectedJson = @"[{""text"":""Hello World"",""bargeIn"":""true"",""loop"":""2"",""level"":""0"",""voiceName"":""kimberly"",""action"":""talk""}]";
var expectedJson = @"[{""text"":""Hello World"",""bargeIn"":""true"",""loop"":""2"",""level"":""0"",""voiceName"":""kimberly"",""language"":""en-US"",""style"":0,""action"":""talk""}]";
var talkAction = new TalkAction
{
Text = "Hello World",
BargeIn = "true",
Loop = "2",
Level = "0",
VoiceName = "kimberly"
VoiceName = "kimberly",
Language="en-US",
Style = 0
};
var ncco = new Ncco(talkAction);
Assert.Equal(expectedJson, ncco.ToString());
Expand Down
16 changes: 7 additions & 9 deletions Vonage.Test.Unit/VoiceClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Vonage.Voice;
using System.Web;
using System.Globalization;
using System.Web;
using Vonage.Voice;
using Xunit;

namespace Vonage.Test.Unit
{
Expand Down Expand Up @@ -389,13 +385,15 @@ public void TestStartTalk(bool passCreds, bool kitchenSink)
TalkCommand command;
if (kitchenSink)
{
expectedRequestContent = @"{""text"":""Hello. How are you today?"",""voice_name"":""salli"",""loop"":0,""level"":""0.4""}";
expectedRequestContent = @"{""text"":""Hello. How are you today?"",""voice_name"":""salli"",""loop"":0,""level"":""0.4"",""language"":""en-US"",""style"":1}";
command = new TalkCommand
{
Text = "Hello. How are you today?",
Loop = 0,
Level = "0.4",
VoiceName="salli"
VoiceName="salli",
Language="en-US",
Style=1
};
}
else
Expand Down
21 changes: 15 additions & 6 deletions Vonage/Voice/Nccos/TalkAction.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;

namespace Vonage.Voice.Nccos
{
Expand Down Expand Up @@ -48,8 +44,21 @@ public class TalkAction : NccoAction
/// American accent (en-US). Possible values are listed in the Text-To-Speech guide.
/// </summary>
[JsonProperty("voiceName")]
[Obsolete("This parameter has been made obsolete by the language and style fields. Please see https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#locale for more details")]
public string VoiceName { get; set; }

/// <summary>
/// The language (<see href="https://tools.ietf.org/html/bcp47">BCP-47</see>format) for the message you are sending. Default: en-US. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
/// </summary>
[JsonProperty("language")]
public string Language { get; set; }

/// <summary>
/// The vocal style (vocal range, tessitura and timbre). Default: 0. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
/// </summary>
[JsonProperty("style")]
public int? Style { get; set; }

public TalkAction()
{
Action = ActionType.talk;
Expand Down
17 changes: 13 additions & 4 deletions Vonage/Voice/TalkCommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Vonage.Voice
{
Expand All @@ -25,6 +21,7 @@ public class TalkCommand
/// Possible values for voice_name are listed at https://docs.nexmo.com/voice/voice-api/api-reference#talk_put
/// </summary>
[JsonProperty("voice_name")]
[Obsolete("This parameter has been made obsolete by the language and style fields. Please see https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#locale for more details")]
public string VoiceName { get; set; }

/// <summary>
Expand All @@ -38,5 +35,17 @@ public class TalkCommand
/// </summary>
[JsonProperty("level")]
public string Level { get; set; }

/// <summary>
/// The language (<see href="https://tools.ietf.org/html/bcp47">BCP-47</see>format) for the message you are sending. Default: en-US. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
/// </summary>
[JsonProperty("language")]
public string Language { get; set; }

/// <summary>
/// The vocal style (vocal range, tessitura and timbre). Default: 0. Possible values are listed in the <see href="https://developer.nexmo.com/voice/voice-api/guides/text-to-speech#supported-languages">Text-To-Speech guide</see>.
/// </summary>
[JsonProperty("style")]
public int? Style { get; set; }
}
}

0 comments on commit 6070d98

Please sign in to comment.