Skip to content

Commit 621c0de

Browse files
authored
Merge pull request #607 from watson-developer-cloud/release-5-2019
v4.1
2 parents 3f1ebbe + 0936857 commit 621c0de

File tree

164 files changed

+5930
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+5930
-47
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "8.3"
3+
- "10"
44
os:
55
- osx
66
osx_image: xcode61

Examples/ExampleDiscoveryV2.cs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
using IBM.Watson.Discovery.V2;
2+
using IBM.Watson.Discovery.V2.Model;
3+
using IBM.Cloud.SDK.Utilities;
4+
using IBM.Cloud.SDK.Authentication;
5+
using IBM.Cloud.SDK.Authentication.Bearer;
6+
using System.Collections;
7+
using System.Collections.Generic;
8+
using UnityEngine;
9+
using IBM.Cloud.SDK;
10+
11+
public class ExampleDiscoveryV2 : MonoBehaviour
12+
{
13+
#region PLEASE SET THESE VARIABLES IN THE INSPECTOR
14+
[Space(10)]
15+
[Tooltip("The Bearer Token.")]
16+
[SerializeField]
17+
private string bearerToken;
18+
[Tooltip("The service URL (optional). This defaults to \"https://gateway.watsonplatform.net/discovery/api\"")]
19+
[SerializeField]
20+
private string serviceUrl;
21+
[Tooltip("The version date with which you would like to use the service in the form YYYY-MM-DD.")]
22+
[SerializeField]
23+
private string versionDate;
24+
#endregion
25+
26+
private DiscoveryService service;
27+
// Start is called before the first frame update
28+
void Start()
29+
{
30+
LogSystem.InstallDefaultReactors();
31+
Runnable.Run(CreateService());
32+
}
33+
34+
// Update is called once per frame
35+
public IEnumerator CreateService()
36+
{
37+
if (string.IsNullOrEmpty(bearerToken))
38+
{
39+
throw new IBMException("Plesae provide Bearer Token for the service.");
40+
}
41+
42+
// Option 1
43+
// Create credential and instantiate service using bearer token
44+
BearerTokenAuthenticator authenticator = new BearerTokenAuthenticator(bearerToken: bearerToken);
45+
46+
// Option 2
47+
// Create credential and instantiate service using username/password
48+
// var authenticator = new CloudPakForDataAuthenticator(
49+
// url: "https://{cpd_cluster_host}{:port}",
50+
// username: "{username}",
51+
// password: "{password}"
52+
// );
53+
54+
// Wait for tokendata
55+
while (!authenticator.CanAuthenticate())
56+
yield return null;
57+
58+
service = new DiscoveryService(versionDate, authenticator);
59+
service.SetServiceUrl("service_url");
60+
61+
62+
Runnable.Run(ExampleListCollections());
63+
}
64+
65+
private IEnumerator ExampleListCollections()
66+
{
67+
Log.Debug("DiscoveryServiceV2", "ListCollections");
68+
ListCollectionsResponse listCollectionsResponse = null;
69+
service.ListCollections(
70+
callback: (DetailedResponse<ListCollectionsResponse> response, IBMError error) =>
71+
{
72+
Log.Debug("DiscoveryServiceV2", "ListCollections result: {0}", response.Response);
73+
listCollectionsResponse = response.Result;
74+
},
75+
projectId: "{project_id}"
76+
);
77+
78+
while (listCollectionsResponse == null)
79+
yield return null;
80+
}
81+
}

Examples/ExampleDiscoveryV2.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.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Use this SDK to build Watson-powered applications in Unity.
1212
* [Before you begin](#before-you-begin)
1313
* [Getting the Watson SDK and adding it to Unity](#getting-the-watson-sdk-and-adding-it-to-unity)
1414
* [Installing the SDK source into your Unity project](#installing-the-sdk-source-into-your-unity-project)
15+
* [Discovery v2 only on CP4D](#discovery-v2-only-on-cp4d)
1516
* [Configuring your service credentials](#configuring-your-service-credentials)
1617
* [Authentication](#authentication)
1718
* [Watson Services](#watson-services)
@@ -43,6 +44,9 @@ You can get the latest SDK release by clicking [here][latest_release_sdk]. **You
4344
### Installing the SDK source into your Unity project
4445
Move the **`unity-sdk`** and **`unity-sdk-core`** directories into the **`Assets`** directory of your Unity project. _Optional: rename the SDK directory from `unity-sdk` to `Watson` and the Core directory from `unity-sdk-core` to `IBMSdkCore`_.
4546

47+
## Discovery v2 only on CP4D
48+
49+
Discovery v2 is only available on Cloud Pak for Data.
4650

4751
## Configuring your service credentials
4852
To create instances of Watson services and their credentials, follow the steps below.

Scripts/Services/Assistant/V1/AssistantService.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ private void OnListWorkspacesResponse(RESTConnector.Request req, RESTConnector.R
313313
/// (optional)</param>
314314
/// <param name="counterexamples">An array of objects defining input examples that have been marked as
315315
/// irrelevant input. (optional)</param>
316+
/// <param name="webhooks"> (optional)</param>
316317
/// <returns><see cref="Workspace" />Workspace</returns>
317-
public bool CreateWorkspace(Callback<Workspace> callback, string name = null, string description = null, string language = null, Dictionary<string, object> metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List<CreateIntent> intents = null, List<CreateEntity> entities = null, List<DialogNode> dialogNodes = null, List<Counterexample> counterexamples = null)
318+
public bool CreateWorkspace(Callback<Workspace> callback, string name = null, string description = null, string language = null, Dictionary<string, object> metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List<CreateIntent> intents = null, List<CreateEntity> entities = null, List<DialogNode> dialogNodes = null, List<Counterexample> counterexamples = null, List<Webhook> webhooks = null)
318319
{
319320
if (callback == null)
320321
throw new ArgumentNullException("`callback` is required for `CreateWorkspace`");
@@ -363,6 +364,8 @@ public bool CreateWorkspace(Callback<Workspace> callback, string name = null, st
363364
bodyObject["dialog_nodes"] = JToken.FromObject(dialogNodes);
364365
if (counterexamples != null && counterexamples.Count > 0)
365366
bodyObject["counterexamples"] = JToken.FromObject(counterexamples);
367+
if (webhooks != null && webhooks.Count > 0)
368+
bodyObject["webhooks"] = JToken.FromObject(webhooks);
366369
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
367370

368371
req.OnResponse = OnCreateWorkspaceResponse;
@@ -521,8 +524,9 @@ private void OnGetWorkspaceResponse(RESTConnector.Request req, RESTConnector.Res
521524
///
522525
/// If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in
523526
/// the new data collide with existing elements, the update request fails. (optional, default to false)</param>
527+
/// <param name="webhooks"> (optional)</param>
524528
/// <returns><see cref="Workspace" />Workspace</returns>
525-
public bool UpdateWorkspace(Callback<Workspace> callback, string workspaceId, string name = null, string description = null, string language = null, Dictionary<string, object> metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List<CreateIntent> intents = null, List<CreateEntity> entities = null, List<DialogNode> dialogNodes = null, List<Counterexample> counterexamples = null, bool? append = null)
529+
public bool UpdateWorkspace(Callback<Workspace> callback, string workspaceId, string name = null, string description = null, string language = null, Dictionary<string, object> metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List<CreateIntent> intents = null, List<CreateEntity> entities = null, List<DialogNode> dialogNodes = null, List<Counterexample> counterexamples = null, bool? append = null, List<Webhook> webhooks = null)
526530
{
527531
if (callback == null)
528532
throw new ArgumentNullException("`callback` is required for `UpdateWorkspace`");
@@ -577,6 +581,8 @@ public bool UpdateWorkspace(Callback<Workspace> callback, string workspaceId, st
577581
bodyObject["dialog_nodes"] = JToken.FromObject(dialogNodes);
578582
if (counterexamples != null && counterexamples.Count > 0)
579583
bodyObject["counterexamples"] = JToken.FromObject(counterexamples);
584+
if (webhooks != null && webhooks.Count > 0)
585+
bodyObject["webhooks"] = JToken.FromObject(webhooks);
580586
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
581587

582588
req.OnResponse = OnUpdateWorkspaceResponse;
@@ -3595,8 +3601,10 @@ private void OnListDialogNodesResponse(RESTConnector.Request req, RESTConnector.
35953601
/// (optional)</param>
35963602
/// <param name="userLabel">A label that can be displayed externally to describe the purpose of the node to
35973603
/// users. (optional)</param>
3604+
/// <param name="disambiguationOptOut">Whether the dialog node should be excluded from disambiguation
3605+
/// suggestions. (optional, default to false)</param>
35983606
/// <returns><see cref="DialogNode" />DialogNode</returns>
3599-
public bool CreateDialogNode(Callback<DialogNode> callback, string workspaceId, string dialogNode, string description = null, string conditions = null, string parent = null, string previousSibling = null, DialogNodeOutput output = null, Dictionary<string, object> context = null, Dictionary<string, object> metadata = null, DialogNodeNextStep nextStep = null, string title = null, string type = null, string eventName = null, string variable = null, List<DialogNodeAction> actions = null, string digressIn = null, string digressOut = null, string digressOutSlots = null, string userLabel = null)
3607+
public bool CreateDialogNode(Callback<DialogNode> callback, string workspaceId, string dialogNode, string description = null, string conditions = null, string parent = null, string previousSibling = null, DialogNodeOutput output = null, Dictionary<string, object> context = null, Dictionary<string, object> metadata = null, DialogNodeNextStep nextStep = null, string title = null, string type = null, string eventName = null, string variable = null, List<DialogNodeAction> actions = null, string digressIn = null, string digressOut = null, string digressOutSlots = null, string userLabel = null, bool? disambiguationOptOut = null)
36003608
{
36013609
if (callback == null)
36023610
throw new ArgumentNullException("`callback` is required for `CreateDialogNode`");
@@ -3665,6 +3673,8 @@ public bool CreateDialogNode(Callback<DialogNode> callback, string workspaceId,
36653673
bodyObject["digress_out_slots"] = digressOutSlots;
36663674
if (!string.IsNullOrEmpty(userLabel))
36673675
bodyObject["user_label"] = userLabel;
3676+
if (disambiguationOptOut != null)
3677+
bodyObject["disambiguation_opt_out"] = JToken.FromObject(disambiguationOptOut);
36683678
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
36693679

36703680
req.OnResponse = OnCreateDialogNodeResponse;
@@ -3825,8 +3835,10 @@ private void OnGetDialogNodeResponse(RESTConnector.Request req, RESTConnector.Re
38253835
/// (optional)</param>
38263836
/// <param name="newUserLabel">A label that can be displayed externally to describe the purpose of the node to
38273837
/// users. (optional)</param>
3838+
/// <param name="newDisambiguationOptOut">Whether the dialog node should be excluded from disambiguation
3839+
/// suggestions. (optional, default to false)</param>
38283840
/// <returns><see cref="DialogNode" />DialogNode</returns>
3829-
public bool UpdateDialogNode(Callback<DialogNode> callback, string workspaceId, string dialogNode, string newDialogNode = null, string newDescription = null, string newConditions = null, string newParent = null, string newPreviousSibling = null, DialogNodeOutput newOutput = null, Dictionary<string, object> newContext = null, Dictionary<string, object> newMetadata = null, DialogNodeNextStep newNextStep = null, string newTitle = null, string newType = null, string newEventName = null, string newVariable = null, List<DialogNodeAction> newActions = null, string newDigressIn = null, string newDigressOut = null, string newDigressOutSlots = null, string newUserLabel = null)
3841+
public bool UpdateDialogNode(Callback<DialogNode> callback, string workspaceId, string dialogNode, string newDialogNode = null, string newDescription = null, string newConditions = null, string newParent = null, string newPreviousSibling = null, DialogNodeOutput newOutput = null, Dictionary<string, object> newContext = null, Dictionary<string, object> newMetadata = null, DialogNodeNextStep newNextStep = null, string newTitle = null, string newType = null, string newEventName = null, string newVariable = null, List<DialogNodeAction> newActions = null, string newDigressIn = null, string newDigressOut = null, string newDigressOutSlots = null, string newUserLabel = null, bool? newDisambiguationOptOut = null)
38303842
{
38313843
if (callback == null)
38323844
throw new ArgumentNullException("`callback` is required for `UpdateDialogNode`");
@@ -3895,6 +3907,8 @@ public bool UpdateDialogNode(Callback<DialogNode> callback, string workspaceId,
38953907
bodyObject["digress_out_slots"] = newDigressOutSlots;
38963908
if (!string.IsNullOrEmpty(newUserLabel))
38973909
bodyObject["user_label"] = newUserLabel;
3910+
if (newDisambiguationOptOut != null)
3911+
bodyObject["disambiguation_opt_out"] = JToken.FromObject(newDisambiguationOptOut);
38983912
req.Send = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(bodyObject));
38993913

39003914
req.OnResponse = OnUpdateDialogNodeResponse;
@@ -4107,8 +4121,9 @@ private void OnListLogsResponse(RESTConnector.Request req, RESTConnector.Respons
41074121
/// </summary>
41084122
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
41094123
/// <param name="filter">A cacheable parameter that limits the results to those matching the specified filter.
4110-
/// You must specify a filter query that includes a value for `language`, as well as a value for `workspace_id`
4111-
/// or `request.context.metadata.deployment`. For more information, see the
4124+
/// You must specify a filter query that includes a value for `language`, as well as a value for
4125+
/// `request.context.system.assistant_id`, `workspace_id`, or `request.context.metadata.deployment`. For more
4126+
/// information, see the
41124127
/// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-filter-reference#filter-reference).</param>
41134128
/// <param name="sort">How to sort the returned log events. You can sort by **request_timestamp**. To reverse
41144129
/// the sort order, prefix the parameter value with a minus sign (`-`). (optional)</param>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ public class DigressOutSlotsValue
263263
[JsonProperty("user_label", NullValueHandling = NullValueHandling.Ignore)]
264264
public string UserLabel { get; set; }
265265
/// <summary>
266+
/// Whether the dialog node should be excluded from disambiguation suggestions.
267+
/// </summary>
268+
[JsonProperty("disambiguation_opt_out", NullValueHandling = NullValueHandling.Ignore)]
269+
public bool? DisambiguationOptOut { get; set; }
270+
/// <summary>
266271
/// For internal use only.
267272
/// </summary>
268273
[JsonProperty("disabled", NullValueHandling = NullValueHandling.Ignore)]

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public class TypeValue
4646
/// Constant WEB_ACTION for web_action
4747
/// </summary>
4848
public const string WEB_ACTION = "web_action";
49+
/// <summary>
50+
/// Constant WEBHOOK for webhook
51+
/// </summary>
52+
public const string WEBHOOK = "webhook";
4953

5054
}
5155

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace IBM.Watson.Assistant.V1.Model
2525
public class DialogSuggestion
2626
{
2727
/// <summary>
28-
/// The user-facing label for the disambiguation option. This label is taken from the **user_label** property of
29-
/// the corresponding dialog node.
28+
/// The user-facing label for the disambiguation option. This label is taken from the **title** or
29+
/// **user_label** property of the corresponding dialog node, depending on the disambiguation options.
3030
/// </summary>
3131
[JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
3232
public string Label { get; set; }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public class PreferenceValue
149149
/// An array of objects describing the possible matching dialog nodes from which the user can choose.
150150
///
151151
/// **Note:** The **suggestions** property is part of the disambiguation feature, which is only available for
152-
/// Premium users.
152+
/// Plus and Premium users.
153153
/// </summary>
154154
[JsonProperty("suggestions", NullValueHandling = NullValueHandling.Ignore)]
155155
public List<DialogSuggestion> Suggestions { get; set; }

0 commit comments

Comments
 (0)