Skip to content

Commit e0ead99

Browse files
committed
fix(Assistant): node dialog respose should have agent props
1 parent 800f7de commit e0ead99

22 files changed

+290
-203
lines changed

Examples/ExamplePersonalityInsightsV3.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2019 IBM Corp. All Rights Reserved.
2+
* (C) Copyright IBM Corp. 2019, 2020.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

Examples/GenericSerialization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2019 IBM Corp. All Rights Reserved.
2+
* (C) Copyright IBM Corp. 2019, 2020.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

Scripts/Services/Assistant/V1/AssistantService.cs

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

1818
/**
19-
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-a45d89ef-20201209-153452
19+
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-a45d89ef-20201221-120002
2020
*/
2121

2222
using System.Collections.Generic;
@@ -228,6 +228,92 @@ private void OnMessageResponse(RESTConnector.Request req, RESTConnector.Response
228228
((RequestObject<MessageResponse>)req).Callback(response, resp.Error);
229229
}
230230

231+
/// <summary>
232+
/// Identify intents and entities in multiple user utterances.
233+
///
234+
/// Send multiple user inputs to a workspace in a single request and receive information about the intents and
235+
/// entities recognized in each input. This method is useful for testing and comparing the performance of
236+
/// different workspaces.
237+
///
238+
/// This method is available only with Premium plans.
239+
/// </summary>
240+
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
241+
/// <param name="workspaceId">Unique identifier of the workspace.</param>
242+
/// <param name="input">An array of input utterances to classify. (optional)</param>
243+
/// <returns><see cref="BulkClassifyResponse" />BulkClassifyResponse</returns>
244+
public bool BulkClassify(Callback<BulkClassifyResponse> callback, string workspaceId, List<BulkClassifyUtterance> input = null)
245+
{
246+
if (callback == null)
247+
throw new ArgumentNullException("`callback` is required for `BulkClassify`");
248+
if (string.IsNullOrEmpty(workspaceId))
249+
throw new ArgumentNullException("`workspaceId` is required for `BulkClassify`");
250+
if (string.IsNullOrEmpty(Version))
251+
throw new ArgumentNullException("`Version` is required");
252+
253+
RequestObject<BulkClassifyResponse> req = new RequestObject<BulkClassifyResponse>
254+
{
255+
Callback = callback,
256+
HttpMethod = UnityWebRequest.kHttpVerbPOST,
257+
DisableSslVerification = DisableSslVerification
258+
};
259+
260+
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
261+
{
262+
req.Headers.Add(kvp.Key, kvp.Value);
263+
}
264+
265+
ClearCustomRequestHeaders();
266+
267+
foreach (KeyValuePair<string, string> kvp in Common.GetSdkHeaders("conversation", "V1", "BulkClassify"))
268+
{
269+
req.Headers.Add(kvp.Key, kvp.Value);
270+
}
271+
272+
if (!string.IsNullOrEmpty(Version))
273+
{
274+
req.Parameters["version"] = Version;
275+
}
276+
req.Headers["Content-Type"] = "application/json";
277+
req.Headers["Accept"] = "application/json";
278+
279+
JObject bodyObject = new JObject();
280+
if (input != null && input.Count > 0)
281+
bodyObject["input"] = JToken.FromObject(input);
282+
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
283+
284+
req.OnResponse = OnBulkClassifyResponse;
285+
286+
Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/bulk_classify", workspaceId);
287+
Authenticator.Authenticate(Connector);
288+
289+
return Connector.Send(req);
290+
}
291+
292+
private void OnBulkClassifyResponse(RESTConnector.Request req, RESTConnector.Response resp)
293+
{
294+
DetailedResponse<BulkClassifyResponse> response = new DetailedResponse<BulkClassifyResponse>();
295+
foreach (KeyValuePair<string, string> kvp in resp.Headers)
296+
{
297+
response.Headers.Add(kvp.Key, kvp.Value);
298+
}
299+
response.StatusCode = resp.HttpResponseCode;
300+
301+
try
302+
{
303+
string json = Encoding.UTF8.GetString(resp.Data);
304+
response.Result = JsonConvert.DeserializeObject<BulkClassifyResponse>(json);
305+
response.Response = json;
306+
}
307+
catch (Exception e)
308+
{
309+
Log.Error("AssistantService.OnBulkClassifyResponse()", "Exception: {0}", e.ToString());
310+
resp.Success = false;
311+
}
312+
313+
if (((RequestObject<BulkClassifyResponse>)req).Callback != null)
314+
((RequestObject<BulkClassifyResponse>)req).Callback(response, resp.Error);
315+
}
316+
231317
/// <summary>
232318
/// List workspaces.
233319
///
@@ -4665,91 +4751,5 @@ private void OnDeleteUserDataResponse(RESTConnector.Request req, RESTConnector.R
46654751
if (((RequestObject<object>)req).Callback != null)
46664752
((RequestObject<object>)req).Callback(response, resp.Error);
46674753
}
4668-
4669-
/// <summary>
4670-
/// Identify intents and entities in multiple user utterances.
4671-
///
4672-
/// Send multiple user inputs to a workspace in a single request and receive information about the intents and
4673-
/// entities recognized in each input. This method is useful for testing and comparing the performance of
4674-
/// different workspaces.
4675-
///
4676-
/// This method is available only with Premium plans.
4677-
/// </summary>
4678-
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
4679-
/// <param name="workspaceId">Unique identifier of the workspace.</param>
4680-
/// <param name="input">An array of input utterances to classify. (optional)</param>
4681-
/// <returns><see cref="BulkClassifyResponse" />BulkClassifyResponse</returns>
4682-
public bool BulkClassify(Callback<BulkClassifyResponse> callback, string workspaceId, List<BulkClassifyUtterance> input = null)
4683-
{
4684-
if (callback == null)
4685-
throw new ArgumentNullException("`callback` is required for `BulkClassify`");
4686-
if (string.IsNullOrEmpty(workspaceId))
4687-
throw new ArgumentNullException("`workspaceId` is required for `BulkClassify`");
4688-
if (string.IsNullOrEmpty(Version))
4689-
throw new ArgumentNullException("`Version` is required");
4690-
4691-
RequestObject<BulkClassifyResponse> req = new RequestObject<BulkClassifyResponse>
4692-
{
4693-
Callback = callback,
4694-
HttpMethod = UnityWebRequest.kHttpVerbPOST,
4695-
DisableSslVerification = DisableSslVerification
4696-
};
4697-
4698-
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
4699-
{
4700-
req.Headers.Add(kvp.Key, kvp.Value);
4701-
}
4702-
4703-
ClearCustomRequestHeaders();
4704-
4705-
foreach (KeyValuePair<string, string> kvp in Common.GetSdkHeaders("conversation", "V1", "BulkClassify"))
4706-
{
4707-
req.Headers.Add(kvp.Key, kvp.Value);
4708-
}
4709-
4710-
if (!string.IsNullOrEmpty(Version))
4711-
{
4712-
req.Parameters["version"] = Version;
4713-
}
4714-
req.Headers["Content-Type"] = "application/json";
4715-
req.Headers["Accept"] = "application/json";
4716-
4717-
JObject bodyObject = new JObject();
4718-
if (input != null && input.Count > 0)
4719-
bodyObject["input"] = JToken.FromObject(input);
4720-
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
4721-
4722-
req.OnResponse = OnBulkClassifyResponse;
4723-
4724-
Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/bulk_classify", workspaceId);
4725-
Authenticator.Authenticate(Connector);
4726-
4727-
return Connector.Send(req);
4728-
}
4729-
4730-
private void OnBulkClassifyResponse(RESTConnector.Request req, RESTConnector.Response resp)
4731-
{
4732-
DetailedResponse<BulkClassifyResponse> response = new DetailedResponse<BulkClassifyResponse>();
4733-
foreach (KeyValuePair<string, string> kvp in resp.Headers)
4734-
{
4735-
response.Headers.Add(kvp.Key, kvp.Value);
4736-
}
4737-
response.StatusCode = resp.HttpResponseCode;
4738-
4739-
try
4740-
{
4741-
string json = Encoding.UTF8.GetString(resp.Data);
4742-
response.Result = JsonConvert.DeserializeObject<BulkClassifyResponse>(json);
4743-
response.Response = json;
4744-
}
4745-
catch (Exception e)
4746-
{
4747-
Log.Error("AssistantService.OnBulkClassifyResponse()", "Exception: {0}", e.ToString());
4748-
resp.Success = false;
4749-
}
4750-
4751-
if (((RequestObject<BulkClassifyResponse>)req).Callback != null)
4752-
((RequestObject<BulkClassifyResponse>)req).Callback(response, resp.Error);
4753-
}
47544754
}
47554755
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* (C) Copyright IBM Corp. 2020.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using Newtonsoft.Json;
19+
20+
namespace IBM.Watson.Assistant.V1.Model
21+
{
22+
/// <summary>
23+
/// AgentAvailabilityMessage.
24+
/// </summary>
25+
public class AgentAvailabilityMessage
26+
{
27+
/// <summary>
28+
/// The text of the message.
29+
/// </summary>
30+
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
31+
public string Message { get; set; }
32+
}
33+
}

Scripts/Services/Assistant/V1/Model/AgentAvailabilityMessage.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace IBM.Watson.Assistant.V1.Model
2525
/// The output of the dialog node. For more information about how to specify dialog node output, see the
2626
/// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses).
2727
/// </summary>
28-
public class DialogNodeOutput: DynamicModel<object>
28+
public class DialogNodeOutput : DynamicModel<object>
2929
{
3030
/// <summary>
3131
/// An array of objects describing the output defined for the dialog node.

Scripts/Services/Assistant/V1/Model/DialogNodeOutputGeneric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ public class QueryTypeValue
193193
/// next available agent.
194194
/// </summary>
195195
[JsonProperty("agent_available", NullValueHandling = NullValueHandling.Ignore)]
196-
public string AgentAvailable { get; protected set; }
196+
public AgentAvailabilityMessage AgentAvailable { get; protected set; }
197197
/// <summary>
198198
/// An optional message to be displayed to the user to indicate that no online agent is available to take over
199199
/// the conversation.
200200
/// </summary>
201201
[JsonProperty("agent_unavailable", NullValueHandling = NullValueHandling.Ignore)]
202-
public string AgentUnavailable { get; protected set; }
202+
public AgentAvailabilityMessage AgentUnavailable { get; protected set; }
203203
/// <summary>
204204
/// Routing or other contextual information to be used by target service desk systems.
205205
/// </summary>

Scripts/Services/Assistant/V1/Model/DialogNodeOutputGenericDialogNodeOutputResponseTypeConnectToAgent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class ResponseTypeValue
5151
/// next available agent.
5252
/// </summary>
5353
[JsonProperty("agent_available", NullValueHandling = NullValueHandling.Ignore)]
54-
public new string AgentAvailable
54+
public new AgentAvailabilityMessage AgentAvailable
5555
{
5656
get { return base.AgentAvailable; }
5757
set { base.AgentAvailable = value; }
@@ -61,7 +61,7 @@ public class ResponseTypeValue
6161
/// the conversation.
6262
/// </summary>
6363
[JsonProperty("agent_unavailable", NullValueHandling = NullValueHandling.Ignore)]
64-
public new string AgentUnavailable
64+
public new AgentAvailabilityMessage AgentUnavailable
6565
{
6666
get { return base.AgentUnavailable; }
6767
set { base.AgentUnavailable = value; }

Scripts/Services/Assistant/V1/Model/MessageInput.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright IBM Corp. 2018, 2020.
2+
* (C) Copyright IBM Corp. 2019, 2020.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ namespace IBM.Watson.Assistant.V1.Model
2323
/// <summary>
2424
/// An input object that includes the input text.
2525
/// </summary>
26-
public class MessageInput: DynamicModel<object>
26+
public class MessageInput : DynamicModel<object>
2727
{
2828
/// <summary>
2929
/// The text of the user input. This string cannot contain carriage return, newline, or tab characters.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018, 2019 IBM Corp. All Rights Reserved.
2+
* (C) Copyright IBM Corp. 2019, 2020.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ namespace IBM.Watson.Assistant.V1.Model
2525
/// An output object that includes the response to the user, the dialog nodes that were triggered, and messages from
2626
/// the log.
2727
/// </summary>
28-
public class OutputData: DynamicModel<object>
28+
public class OutputData : DynamicModel<object>
2929
{
3030
/// <summary>
3131
/// An array of the nodes that were triggered to create the response, in the order in which they were visited.

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ public class RuntimeEntity
5757
[JsonProperty("groups", NullValueHandling = NullValueHandling.Ignore)]
5858
public List<CaptureGroup> Groups { get; set; }
5959
/// <summary>
60-
/// An object containing detailed information about the entity recognized in the user input. This property is
61-
/// included only if the new system entities are enabled for the workspace.
60+
/// An object containing detailed information about the entity recognized in the user input.
6261
///
63-
/// For more information about how the new system entities are interpreted, see the
64-
/// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities).
62+
/// For more information about how system entities are interpreted, see the
63+
/// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-system-entities).
6564
/// </summary>
6665
[JsonProperty("interpretation", NullValueHandling = NullValueHandling.Ignore)]
6766
public RuntimeEntityInterpretation Interpretation { get; set; }

Scripts/Services/Assistant/V1/Model/RuntimeResponseGeneric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ public class PreferenceValue
139139
/// next available agent.
140140
/// </summary>
141141
[JsonProperty("agent_available", NullValueHandling = NullValueHandling.Ignore)]
142-
public string AgentAvailable { get; protected set; }
142+
public AgentAvailabilityMessage AgentAvailable { get; protected set; }
143143
/// <summary>
144144
/// An optional message to be displayed to the user to indicate that no online agent is available to take over
145145
/// the conversation.
146146
/// </summary>
147147
[JsonProperty("agent_unavailable", NullValueHandling = NullValueHandling.Ignore)]
148-
public string AgentUnavailable { get; protected set; }
148+
public AgentAvailabilityMessage AgentUnavailable { get; protected set; }
149149
/// <summary>
150150
/// Routing or other contextual information to be used by target service desk systems.
151151
/// </summary>

Scripts/Services/Assistant/V1/Model/RuntimeResponseGenericRuntimeResponseTypeConnectToAgent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class ResponseTypeValue
5151
/// next available agent.
5252
/// </summary>
5353
[JsonProperty("agent_available", NullValueHandling = NullValueHandling.Ignore)]
54-
public new string AgentAvailable
54+
public new AgentAvailabilityMessage AgentAvailable
5555
{
5656
get { return base.AgentAvailable; }
5757
set { base.AgentAvailable = value; }
@@ -61,7 +61,7 @@ public class ResponseTypeValue
6161
/// the conversation.
6262
/// </summary>
6363
[JsonProperty("agent_unavailable", NullValueHandling = NullValueHandling.Ignore)]
64-
public new string AgentUnavailable
64+
public new AgentAvailabilityMessage AgentUnavailable
6565
{
6666
get { return base.AgentUnavailable; }
6767
set { base.AgentUnavailable = value; }

0 commit comments

Comments
 (0)