Skip to content

Commit 7659243

Browse files
committed
fix string interpolation, dynamic type, move delegate to interface
1 parent 0690f4a commit 7659243

File tree

8 files changed

+83
-82
lines changed

8 files changed

+83
-82
lines changed

Scripts/Services/Assistant/v1/Assistant.cs

Lines changed: 43 additions & 60 deletions
Large diffs are not rendered by default.

Scripts/Services/Assistant/v1/IAssistant.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,26 @@
1515
*
1616
*/
1717

18+
using IBM.Watson.DeveloperCloud.Connection;
1819
using System.Collections.Generic;
19-
using static IBM.Watson.DeveloperCloud.Services.Assistant.v1.Assistant;
2020

2121
namespace IBM.Watson.DeveloperCloud.Services.Assistant.v1
2222
{
23+
///// <summary>
24+
///// Success callback delegate.
25+
///// </summary>
26+
///// <typeparam name="T">Type of the returned object.</typeparam>
27+
///// <param name="response">The returned object.</param>
28+
///// <param name="customData">user defined custom data including raw json.</param>
29+
public delegate void SuccessCallback<T>(T response, Dictionary<string, object> customData);
30+
31+
///// <summary>
32+
///// Fail callback delegate.
33+
///// </summary>
34+
///// <param name="error">The error object.</param>
35+
///// <param name="customData">User defined custom data</param>
36+
public delegate void FailCallback(RESTConnector.Error error, Dictionary<string, object> customData);
37+
2338
public interface IAssistant
2439
{
2540
/// <summary>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
using FullSerializer;
19+
using System.Collections.Generic;
1920

2021
namespace IBM.Watson.DeveloperCloud.Services.Assistant.v1
2122
{
@@ -29,12 +30,12 @@ public class Context
2930
/// The unique identifier of the conversation.
3031
/// </summary>
3132
/// <value>The unique identifier of the conversation.</value>
32-
public dynamic ConversationId { get; set; }
33+
public Dictionary<string, object> ConversationId { get; set; }
3334
/// <summary>
3435
/// For internal use only.
3536
/// </summary>
3637
/// <value>For internal use only.</value>
37-
public dynamic System { get; set; }
38+
public Dictionary<string, object> System { get; set; }
3839
}
3940

4041
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
using FullSerializer;
19+
using System.Collections.Generic;
1920
using System.Runtime.Serialization;
2021

2122
namespace IBM.Watson.DeveloperCloud.Services.Assistant.v1
@@ -61,7 +62,7 @@ public enum LevelEnum
6162
/// The text of the message.
6263
/// </summary>
6364
/// <value>The text of the message.</value>
64-
public dynamic Msg { get; set; }
65+
public Dictionary<string, object> Msg { get; set; }
6566
}
6667

6768
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ public class MessageResponse
3030
/// The user input from the request.
3131
/// </summary>
3232
/// <value>The user input from the request.</value>
33-
public dynamic Input { get; set; }
33+
public Dictionary<string, object> Input { get; set; }
3434
/// <summary>
3535
/// An array of intents recognized in the user input, sorted in descending order of confidence.
3636
/// </summary>
3737
/// <value>An array of intents recognized in the user input, sorted in descending order of confidence.</value>
38-
public dynamic Intents { get; set; }
38+
public Dictionary<string, object> Intents { get; set; }
3939
/// <summary>
4040
/// An array of entities identified in the user input.
4141
/// </summary>
4242
/// <value>An array of entities identified in the user input.</value>
43-
public dynamic Entities { get; set; }
43+
public Dictionary<string, object> Entities { get; set; }
4444
/// <summary>
4545
/// Whether to return more than one intent. `true` indicates that all matching intents are returned.
4646
/// </summary>
4747
/// <value>Whether to return more than one intent. `true` indicates that all matching intents are returned.</value>
48-
public dynamic AlternateIntents { get; set; }
48+
public Dictionary<string, object> AlternateIntents { get; set; }
4949
/// <summary>
5050
/// State information for the conversation.
5151
/// </summary>
5252
/// <value>State information for the conversation.</value>
53-
public dynamic Context { get; set; }
53+
public Dictionary<string, object> Context { get; set; }
5454
/// <summary>
5555
/// Output from the dialog, including the response to the user, the nodes that were triggered, and log messages.
5656
/// </summary>
5757
/// <value>Output from the dialog, including the response to the user, the nodes that were triggered, and log messages.</value>
58-
public dynamic Output { get; set; }
58+
public Dictionary<string, object> Output { get; set; }
5959
}
6060

6161
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ public class OutputData
3030
/// Up to 50 messages logged with the request.
3131
/// </summary>
3232
/// <value>Up to 50 messages logged with the request.</value>
33-
public dynamic LogMessages { get; set; }
33+
public Dictionary<string, object> LogMessages { get; set; }
3434
/// <summary>
3535
/// An array of responses to the user.
3636
/// </summary>
3737
/// <value>An array of responses to the user.</value>
38-
public dynamic Text { get; set; }
38+
public Dictionary<string, object> Text { get; set; }
3939
/// <summary>
4040
/// An array of the nodes that were triggered to create the response.
4141
/// </summary>
4242
/// <value>An array of the nodes that were triggered to create the response.</value>
43-
public dynamic NodesVisited { get; set; }
43+
public Dictionary<string, object> NodesVisited { get; set; }
4444
/// <summary>
4545
/// An array of objects containing detailed diagnostic information about the nodes that were triggered during processing of the input message.
4646
/// </summary>
4747
/// <value>An array of objects containing detailed diagnostic information about the nodes that were triggered during processing of the input message.</value>
48-
public dynamic NodesVisitedDetails { get; set; }
48+
public Dictionary<string, object> NodesVisitedDetails { get; set; }
4949
}
5050

5151
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ public class RuntimeEntity
3030
/// The recognized entity from a term in the input.
3131
/// </summary>
3232
/// <value>The recognized entity from a term in the input.</value>
33-
public dynamic Entity { get; set; }
33+
public Dictionary<string, object> Entity { get; set; }
3434
/// <summary>
3535
/// Zero-based character offsets that indicate where the entity value begins and ends in the input text.
3636
/// </summary>
3737
/// <value>Zero-based character offsets that indicate where the entity value begins and ends in the input text.</value>
38-
public dynamic Location { get; set; }
38+
public Dictionary<string, object> Location { get; set; }
3939
/// <summary>
4040
/// The term in the input text that was recognized.
4141
/// </summary>
4242
/// <value>The term in the input text that was recognized.</value>
43-
public dynamic Value { get; set; }
43+
public Dictionary<string, object> Value { get; set; }
4444
/// <summary>
4545
/// A decimal percentage that represents Watson's confidence in the entity.
4646
/// </summary>
4747
/// <value>A decimal percentage that represents Watson's confidence in the entity.</value>
48-
public dynamic Confidence { get; set; }
48+
public Dictionary<string, object> Confidence { get; set; }
4949
/// <summary>
5050
/// The metadata for the entity.
5151
/// </summary>
5252
/// <value>The metadata for the entity.</value>
53-
public dynamic Metadata { get; set; }
53+
public Dictionary<string, object> Metadata { get; set; }
5454
/// <summary>
5555
/// The recognized capture groups for the entity, as defined by the entity pattern.
5656
/// </summary>
5757
/// <value>The recognized capture groups for the entity, as defined by the entity pattern.</value>
58-
public dynamic Groups { get; set; }
58+
public Dictionary<string, object> Groups { get; set; }
5959
}
6060

6161
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
using FullSerializer;
19+
using System.Collections.Generic;
1920

2021
namespace IBM.Watson.DeveloperCloud.Services.Assistant.v1
2122
{
@@ -29,12 +30,12 @@ public class RuntimeIntent
2930
/// The name of the recognized intent.
3031
/// </summary>
3132
/// <value>The name of the recognized intent.</value>
32-
public dynamic Intent { get; set; }
33+
public Dictionary<string, object> Intent { get; set; }
3334
/// <summary>
3435
/// A decimal percentage that represents Watson's confidence in the intent.
3536
/// </summary>
3637
/// <value>A decimal percentage that represents Watson's confidence in the intent.</value>
37-
public dynamic Confidence { get; set; }
38+
public Dictionary<string, object> Confidence { get; set; }
3839
}
3940

4041
}

0 commit comments

Comments
 (0)