Skip to content

Commit 1655c4f

Browse files
authored
Merge pull request #446 from watson-developer-cloud/5341-sdk-updates
SDK Updates
2 parents dd1fd8d + 700e198 commit 1655c4f

File tree

6 files changed

+32
-21
lines changed

6 files changed

+32
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,4 @@ Docs/publishing-release.md.meta
7777
**/.swagger-codegen
7878
/Scripts/Editor/Help/
7979
/Scripts/Editor/Help.meta
80+
*/MRefBuilder.config.meta

Scripts/Editor/Help/Working/MRefBuilder.config.meta

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

Scripts/Services/Assistant/v1/Model/MessageResponse.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public class MessageResponse
6262
/// <value>Output from the dialog, including the response to the user, the nodes that were triggered, and log messages.</value>
6363
[fsProperty("output")]
6464
public object Output { get; set; }
65+
/// <summary>
66+
/// An array of objects describing any actions requested by the dialog node.
67+
/// </summary>
68+
[fsProperty("actions")]
69+
public object Actions { get; set; }
6570
}
6671

6772
}

Scripts/Services/Assistant/v1/Model/OutputData.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class OutputData
5656
/// <value>An array of objects containing detailed diagnostic information about the nodes that were triggered during processing of the input message. Included only if **nodes_visited_details** is set to `true` in the message request.</value>
5757
[fsProperty("nodes_visited_details")]
5858
public Dictionary<string, object> NodesVisitedDetails { get; set; }
59+
// <summary>
60+
/// An array of objects describing any actions requested by the dialog node.
61+
/// </summary>
62+
[fsProperty("actions")]
63+
public Dictionary<string, object> Actions { get; set; }
5964
}
6065

6166
}

Scripts/UnitTests/TestAssistantCF.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class TestAssistantCF : UnitTest
4040
private fsSerializer _serializer = new fsSerializer();
4141

4242
private string _inputString = "Hello";
43-
private string _conversationString0 = "unlock the door";
44-
private string _conversationString1 = "turn on the ac";
45-
private string _conversationString2 = "turn down the radio";
43+
private string _conversationString0 = "Are you open on christmas?";
44+
private string _conversationString1 = "Can you connect me to a real person?";
45+
private string _conversationString2 = "goodbye";
4646
private static string _lastIntent = null;
4747

4848
private static string _createdWorkspaceName = "unity-sdk-example-workspace-delete";

Scripts/Utilities/Credentials.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class Credentials
3636
private string _iamApiKey;
3737
private string _userAcessToken;
3838
private const string APIKEY_AS_USERNAME = "apikey";
39+
private const string ICP_PREFIX = "icp-";
3940
#endregion
4041

4142
#region Public Fields
@@ -146,7 +147,7 @@ public Credentials(TokenOptions iamTokenOptions, string serviceUrl = null)
146147
#region SetCredentials
147148
private void SetCredentials(string username, string password, string url = null)
148149
{
149-
if (username == APIKEY_AS_USERNAME)
150+
if (username == APIKEY_AS_USERNAME && !password.StartsWith(ICP_PREFIX))
150151
{
151152
TokenOptions tokenOptions = new TokenOptions()
152153
{
@@ -167,18 +168,25 @@ private void SetCredentials(string username, string password, string url = null)
167168

168169
private void SetCredentials(TokenOptions iamTokenOptions, string serviceUrl = null)
169170
{
170-
if (!string.IsNullOrEmpty(serviceUrl))
171-
Url = serviceUrl;
172-
_iamUrl = !string.IsNullOrEmpty(iamTokenOptions.IamUrl) ? iamTokenOptions.IamUrl : "https://iam.bluemix.net/identity/token";
173-
_iamTokenData = new IamTokenData();
171+
if (iamTokenOptions.IamApiKey.StartsWith(ICP_PREFIX))
172+
{
173+
SetCredentials(APIKEY_AS_USERNAME, iamTokenOptions.IamApiKey, serviceUrl);
174+
}
175+
else
176+
{
177+
if (!string.IsNullOrEmpty(serviceUrl))
178+
Url = serviceUrl;
179+
_iamUrl = !string.IsNullOrEmpty(iamTokenOptions.IamUrl) ? iamTokenOptions.IamUrl : "https://iam.bluemix.net/identity/token";
180+
_iamTokenData = new IamTokenData();
174181

175-
if (!string.IsNullOrEmpty(iamTokenOptions.IamApiKey))
176-
_iamApiKey = iamTokenOptions.IamApiKey;
182+
if (!string.IsNullOrEmpty(iamTokenOptions.IamApiKey))
183+
_iamApiKey = iamTokenOptions.IamApiKey;
177184

178-
if (!string.IsNullOrEmpty(iamTokenOptions.IamAccessToken))
179-
this._userAcessToken = iamTokenOptions.IamAccessToken;
185+
if (!string.IsNullOrEmpty(iamTokenOptions.IamAccessToken))
186+
this._userAcessToken = iamTokenOptions.IamAccessToken;
180187

181-
GetToken();
188+
GetToken();
189+
}
182190
}
183191
#endregion
184192

0 commit comments

Comments
 (0)