Skip to content

Commit 9e07476

Browse files
authored
Merge pull request #489 from watson-developer-cloud/5964-5969-update-assistant-v1-v2
Update Assistant V1 and V2 for missing fields
2 parents 0c641b7 + bd9ce0b commit 9e07476

24 files changed

+98
-1331
lines changed

Scripts/Services/Assistant/v1/Models/CreateDialogNode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ public enum EventNameEnum
176176
[fsProperty("context")]
177177
public object Context { get; set; }
178178
/// <summary>
179+
/// Whether to consider the dialog node during runtime evaluation. Set to `true` to ignore the
180+
/// dialog node.
181+
/// </summary>
182+
[fsProperty("disabled")]
183+
public bool Disabled { get; set; }
184+
/// <summary>
179185
/// The metadata for the dialog node.
180186
/// </summary>
181187
/// <value>The metadata for the dialog node.</value>

Scripts/Services/Assistant/v2/Models/MessageOutput.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public class MessageOutput
5252
/// </summary>
5353
[fsProperty("debug")]
5454
public MessageOutputDebug Debug { get; set; }
55+
/// <summary>
56+
/// Arbitrary variables that can be read and written to by a particular skill within the Assistant.
57+
/// </summary>
58+
[fsProperty("user_defined")]
59+
public dynamic UserDefined { get; set; }
5560
}
5661

5762
}

Scripts/UnitTests/TestAssistantCF.cs

Lines changed: 0 additions & 800 deletions
This file was deleted.

Scripts/UnitTests/TestAssistantRC.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Scripts/UnitTests/TestAssistantRC.cs renamed to Scripts/UnitTests/TestAssistantV1.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*
1616
*/
17-
// Uncomment to test RC
18-
//#define TEST_RC
1917

2018
using System.Collections;
2119
using System.Collections.Generic;
@@ -29,11 +27,8 @@
2927

3028
namespace Assets.Watson.Scripts.UnitTests
3129
{
32-
#if TEST_RC
33-
class TestAssistantRC : UnitTest
30+
class TestAssistantV1 : UnitTest
3431
{
35-
private string _username = null;
36-
private string _password = null;
3732
private string _workspaceId = null;
3833
private string _createdWorkspaceId;
3934

@@ -43,9 +38,9 @@ class TestAssistantRC : UnitTest
4338
private fsSerializer _serializer = new fsSerializer();
4439

4540
private string _inputString = "Hello";
46-
private string _conversationString0 = "unlock the door";
47-
private string _conversationString1 = "turn on the ac";
48-
private string _conversationString2 = "turn down the radio";
41+
private string _conversationString0 = "Are you open on christmas?";
42+
private string _conversationString1 = "Can you connect me to a real person?";
43+
private string _conversationString2 = "goodbye";
4944
private static string _lastIntent = null;
5045

5146
private static string _createdWorkspaceName = "unity-sdk-example-workspace-delete";
@@ -141,12 +136,11 @@ public override IEnumerator RunTest()
141136
throw new WatsonException(r.FormattedMessages);
142137

143138
// Set credentials from imported credntials
144-
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk-iam")[0].Credentials;
139+
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk")[0].Credentials;
145140
// Create credential and instantiate service
146141
TokenOptions tokenOptions = new TokenOptions()
147142
{
148143
IamApiKey = credential.IamApikey,
149-
IamUrl = "https://iam.stage1.bluemix.net/identity/token"
150144
};
151145

152146
Credentials credentials = new Credentials(tokenOptions, credential.Url);
@@ -794,5 +788,4 @@ private void OnFail(RESTConnector.Error error, Dictionary<string, object> custom
794788
Log.Error("TestAssistant.OnFail()", "Error received: {0}", error.ToString());
795789
}
796790
}
797-
#endif
798791
}

Scripts/UnitTests/TestAssistantCF.cs.meta renamed to Scripts/UnitTests/TestAssistantV1.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/UnitTests/TestAssistantV2.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ namespace Assets.Watson.Scripts.UnitTests
3131
{
3232
public class TestAssistantV2 : UnitTest
3333
{
34-
private string _username;
35-
private string _password;
3634
private fsSerializer _serializer = new fsSerializer();
3735

3836
private Assistant _service;
@@ -81,13 +79,19 @@ public override IEnumerator RunTest()
8179

8280
// Set credentials from imported credntials
8381
Credential credential = vcapCredentials.GetCredentialByname("assistant-sdk")[0].Credentials;
84-
_username = credential.Username.ToString();
85-
_password = credential.Password.ToString();
86-
_url = credential.Url.ToString();
82+
// Create credential and instantiate service
83+
TokenOptions tokenOptions = new TokenOptions()
84+
{
85+
IamApiKey = credential.IamApikey,
86+
};
8787
_assistantId = credential.AssistantId.ToString();
8888

8989
// Create credential and instantiate service
90-
Credentials credentials = new Credentials(_username, _password, _url);
90+
Credentials credentials = new Credentials(tokenOptions, _url);
91+
92+
// Wait for tokendata
93+
while (!credentials.HasIamTokenData())
94+
yield return null;
9195

9296
_service = new Assistant(credentials);
9397
_service.VersionDate = _assistantVersionDate;

Scripts/UnitTests/TestConversation.cs

Lines changed: 0 additions & 208 deletions
This file was deleted.

Scripts/UnitTests/TestConversation.cs.meta

Lines changed: 0 additions & 12 deletions
This file was deleted.

Scripts/UnitTests/TestDiscovery.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ namespace IBM.Watson.DeveloperCloud.UnitTests
3131
{
3232
public class TestDiscovery : UnitTest
3333
{
34-
private string _username = null;
35-
private string _password = null;
3634
private fsSerializer _serializer = new fsSerializer();
3735

3836
private Discovery _discovery;
@@ -128,12 +126,18 @@ public override IEnumerator RunTest()
128126

129127
// Set credentials from imported credntials
130128
Credential credential = vcapCredentials.GetCredentialByname("discovery-sdk")[0].Credentials;
131-
_username = credential.Username.ToString();
132-
_password = credential.Password.ToString();
133-
_url = credential.Url.ToString();
129+
// Create credential and instantiate service
130+
TokenOptions tokenOptions = new TokenOptions()
131+
{
132+
IamApiKey = credential.IamApikey,
133+
};
134134

135135
// Create credential and instantiate service
136-
Credentials credentials = new Credentials(_username, _password, _url);
136+
Credentials credentials = new Credentials(tokenOptions, credential.Url);
137+
138+
// Wait for tokendata
139+
while (!credentials.HasIamTokenData())
140+
yield return null;
137141

138142
_discovery = new Discovery(credentials);
139143
_discovery.VersionDate = _discoveryVersionDate;

0 commit comments

Comments
 (0)