Skip to content

Commit 77c8e0b

Browse files
authored
Merge pull request #87 from watson-developer-cloud/gh-85-dynamicInputContext
- Change MessageRequest (Input/Context) to dynamic
2 parents 0c6eb93 + 7ccf832 commit 77c8e0b

File tree

5 files changed

+179
-99
lines changed

5 files changed

+179
-99
lines changed

examples/IBM.WatsonDeveloperCloud.Conversation.Example/ConversationServiceExample.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ private void Message()
4040
{
4141
MessageRequest messageRequest = new MessageRequest()
4242
{
43-
Input = new InputData()
44-
{
45-
Text = _inputString
46-
}
43+
Input = new { Text = _inputString }
4744
};
4845

4946
Console.WriteLine(string.Format("Calling Message(\"{0}\")...", _inputString));

src/IBM.WatsonDeveloperCloud.Conversation/v1/IConversationService.cs

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,115 @@ public interface IConversationService
8080
MessageResponse Message(string workspaceId, MessageRequest request);
8181

8282
#endregion
83+
84+
#region Intents
85+
86+
/// <summary>
87+
/// List the intents for a workspace.
88+
/// </summary>
89+
/// <param name="workspaceId">Unique identifier of the workspace</param>
90+
/// <returns></returns>
91+
IntentCollectionResponse ListIntents(string workspaceId);
92+
93+
/// <summary>
94+
/// List the intents for a workspace.
95+
/// </summary>
96+
/// <param name="workspaceId">Unique identifier of the workspace</param>
97+
/// <param name="export">Whether to include all element content in the returned data. If export=false, the returned data includes only information about the element itself. If export=true, all content, including subelements, is included. The default value is false. </param>
98+
/// <returns></returns>
99+
IntentCollectionResponse ListIntents(string workspaceId, bool export = false);
100+
101+
/// <summary>
102+
/// Create a new intent.
103+
/// </summary>
104+
/// <param name="workspaceId">Unique identifier of the workspace</param>
105+
/// <param name="request">A CreateIntent object defining the content of the new intent. </param>
106+
/// <returns></returns>
107+
IntentResponse CreateIntent(string workspaceId, CreateIntent request);
108+
109+
/// <summary>
110+
/// Delete an intent from a workspace.
111+
/// </summary>
112+
/// <param name="workspaceId">Unique identifier of the workspace</param>
113+
/// <param name="intent">The intent name (for example, pizza_order). </param>
114+
/// <returns></returns>
115+
object DeleteIntent(string workspaceId, string intent);
116+
117+
/// <summary>
118+
/// Get information about an intent, optionally including all intent content.
119+
/// </summary>
120+
/// <param name="workspaceId">Unique identifier of the workspace</param>
121+
/// <param name="intent">The intent name (for example, pizza_order).</param>
122+
/// <returns></returns>
123+
IntentExportResponse GetIntent(string workspaceId, string intent);
124+
125+
/// <summary>
126+
/// Get information about an intent, optionally including all intent content.
127+
/// </summary>
128+
/// <param name="workspaceId">Unique identifier of the workspace</param>
129+
/// <param name="intent">The intent name (for example, pizza_order).</param>
130+
/// <param name="export">Whether to include all element content in the returned data. If export=false, the returned data includes only information about the element itself. If export=true, all content, including subelements, is included. The default value is false. </param>
131+
/// <returns></returns>
132+
IntentExportResponse GetIntent(string workspaceId, string intent, bool export = false);
133+
134+
/// <summary>
135+
/// Update an existing intent with new or modified data. You must provide JSON data defining the content of the updated intent. Any elements included in the new JSON will completely replace the equivalent existing elements, including all subelements. (Previously existing subelements are not retained unless they are included in the new JSON.) For example, if you update the user input examples for an intent, the previously existing examples are discarded and replaced with the new examples specified in the JSON input.
136+
/// </summary>
137+
/// <param name="workspaceId">Unique identifier of the workspace</param>
138+
/// <param name="intent">The name of the intent to update.</param>
139+
/// <param name="request">An UpdateIntent object defining the updated content of the intent.</param>
140+
/// <returns></returns>
141+
IntentResponse UpdateIntent(string workspaceId, string intent, UpdateIntent request);
142+
143+
#endregion
144+
145+
#region Examples
146+
147+
/// <summary>
148+
/// List the user input examples for an intent.
149+
/// </summary>
150+
/// <param name="workspaceId">Unique identifier of the workspace</param>
151+
/// <param name="intent">The intent name (for example, pizza_order).</param>
152+
/// <returns></returns>
153+
ExampleCollectionResponse ListExamples(string workspaceId, string intent);
154+
155+
/// <summary>
156+
/// Add a new user input example to an intent.
157+
/// </summary>
158+
/// <param name="workspaceId">Unique identifier of the workspace</param>
159+
/// <param name="intent">The intent name (for example, pizza_order).</param>
160+
/// <param name="request">A CreateExample object defining the content of the new user input example..</param>
161+
/// <returns></returns>
162+
ExampleResponse CreateExample(string workspaceId, string intent, CreateExample request);
163+
164+
/// <summary>
165+
/// Delete a user input example from an intent.
166+
/// </summary>
167+
/// <param name="workspaceId">Unique identifier of the workspace</param>
168+
/// <param name="intent">The intent name (for example, pizza_order).</param>
169+
/// <param name="text">The text of the user input example, with spaces and special characters in URL encoding.</param>
170+
/// <returns></returns>
171+
object DeleteExample(string workspaceId, string intent, string text);
172+
173+
/// <summary>
174+
/// Get information about a user input example.
175+
/// </summary>
176+
/// <param name="workspaceId">Unique identifier of the workspace</param>
177+
/// <param name="intent">The intent name (for example, pizza_order).</param>
178+
/// <param name="text">The text of the user input example, with spaces and special characters in URL encoding.</param>
179+
/// <returns></returns>
180+
ExampleResponse GetExample(string workspaceId, string intent, string text);
181+
182+
/// <summary>
183+
/// Update the text of a user input example.
184+
/// </summary>
185+
/// <param name="workspaceId">Unique identifier of the workspace</param>
186+
/// <param name="intent">The intent name (for example, pizza_order).</param>
187+
/// <param name="text">The text of the user input example, with spaces and special characters in URL encoding.</param>
188+
/// <param name="request">An UpdateExample object defining the new text for the user input example.</param>
189+
/// <returns></returns>
190+
ExampleResponse UpdateExample(string workspaceId, string intent, string text, UpdateExample request);
191+
192+
#endregion
83193
}
84194
}

src/IBM.WatsonDeveloperCloud.Conversation/v1/Model/MessageRequest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class MessageRequest
2929
/// An input object that includes the input text.
3030
/// </summary>
3131
[JsonProperty("input", NullValueHandling = NullValueHandling.Ignore)]
32-
public InputData Input { get; set; }
32+
public dynamic Input { get; set; }
3333

3434
/// <summary>
3535
///Whether to return more than one intent. Default is false.
@@ -44,7 +44,7 @@ public class MessageRequest
4444
/// include the context object from the response.
4545
/// </summary>
4646
[JsonProperty("context", NullValueHandling = NullValueHandling.Ignore)]
47-
public Context Context { get; set; }
47+
public dynamic Context { get; set; }
4848

4949
/// <summary>
5050
/// The portion of the user's input that you can use to provide a different response or action to an intent.

test/IBM.WatsonDeveloperCloud.Conversation.IntegrationTests/ConversationServiceIntegrationTest.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,7 @@ public void Message()
339339

340340
MessageRequest messageRequest = new MessageRequest()
341341
{
342-
Input = new InputData()
343-
{
344-
Text = "Turn on the lights"
345-
}
342+
Input = new { Text = "Turn on the lights" }
346343
};
347344

348345
#endregion messageRequest

0 commit comments

Comments
 (0)