Skip to content

Commit 991b296

Browse files
authored
Merge pull request #434 from watson-developer-cloud/rc-2.6.0
Watson SDK for Unity 2.6.0
2 parents ef82fc6 + 81dfd9b commit 991b296

File tree

57 files changed

+1622
-42
lines changed

Some content is hidden

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

57 files changed

+1622
-42
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,5 @@ Docs/publishing-release.md.meta
7272
*.md.meta
7373
*.txt.meta
7474
*.ps1.meta
75+
**/.swagger-codegen-ignore
76+
**/.swagger-codegen

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: objective-c
22
osx_image: xcode61
33
rvm:
4-
- 2.1.2
4+
- 2.2
55
cache:
66
directories:
77
- ./Unity

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "IBM Watson SDK for Unity"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 2.4.2
41+
PROJECT_NUMBER = 2.6.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

Examples/ServiceExamples/Scripts/ExampleAssistant.cs

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class ExampleAssistant : MonoBehaviour
9797
private bool _createEntityTested = false;
9898
private bool _getEntityTested = false;
9999
private bool _updateEntityTested = false;
100+
private bool _listMentionsTested = false;
100101
private bool _listValuesTested = false;
101102
private bool _createValueTested = false;
102103
private bool _getValueTested = false;
@@ -189,8 +190,8 @@ private IEnumerator Examples()
189190
// Update Workspace
190191
UpdateWorkspace updateWorkspace = new UpdateWorkspace()
191192
{
192-
Name = _createdWorkspaceName + "-updated",
193-
Description = _createdWorkspaceDescription + "-updated",
193+
Name = _createdWorkspaceName + "Updated",
194+
Description = _createdWorkspaceDescription + "Updated",
194195
Language = _createdWorkspaceLanguage
195196
};
196197
_service.UpdateWorkspace(OnUpdateWorkspace, OnFail, _createdWorkspaceId, updateWorkspace);
@@ -259,8 +260,8 @@ private IEnumerator Examples()
259260
while (!_getIntentTested)
260261
yield return null;
261262
// Update Intents
262-
string updatedIntent = _createdIntent + "-updated";
263-
string updatedIntentDescription = _createdIntentDescription + "-updated";
263+
string updatedIntent = _createdIntent + "Updated";
264+
string updatedIntentDescription = _createdIntentDescription + "Updated";
264265
UpdateIntent updateIntent = new UpdateIntent()
265266
{
266267
Intent = updatedIntent,
@@ -287,7 +288,7 @@ private IEnumerator Examples()
287288
while (!_getExampleTested)
288289
yield return null;
289290
// Update Examples
290-
string updatedExample = _createdExample + "-updated";
291+
string updatedExample = _createdExample + "Updated";
291292
UpdateExample updateExample = new UpdateExample()
292293
{
293294
Text = updatedExample
@@ -314,8 +315,8 @@ private IEnumerator Examples()
314315
while (!_getEntityTested)
315316
yield return null;
316317
// Update Entities
317-
string updatedEntity = _createdEntity + "-updated";
318-
string updatedEntityDescription = _createdEntityDescription + "-updated";
318+
string updatedEntity = _createdEntity + "Updated";
319+
string updatedEntityDescription = _createdEntityDescription + "Updated";
319320
UpdateEntity updateEntity = new UpdateEntity()
320321
{
321322
Entity = updatedEntity,
@@ -325,6 +326,11 @@ private IEnumerator Examples()
325326
while (!_updateEntityTested)
326327
yield return null;
327328

329+
// List Mentinos
330+
_service.ListMentions(OnListMentions, OnFail, _createdWorkspaceId, updatedEntity);
331+
while (!_listMentionsTested)
332+
yield return null;
333+
328334
// List Values
329335
_service.ListValues(OnListValues, OnFail, _createdWorkspaceId, updatedEntity);
330336
while (!_listValuesTested)
@@ -342,7 +348,7 @@ private IEnumerator Examples()
342348
while (!_getValueTested)
343349
yield return null;
344350
// Update Values
345-
string updatedValue = _createdValue + "-updated";
351+
string updatedValue = _createdValue + "Updated";
346352
UpdateValue updateValue = new UpdateValue()
347353
{
348354
Value = updatedValue
@@ -368,7 +374,7 @@ private IEnumerator Examples()
368374
while (!_getSynonymTested)
369375
yield return null;
370376
// Update Synonyms
371-
string updatedSynonym = _createdSynonym + "-updated";
377+
string updatedSynonym = _createdSynonym + "Updated";
372378
UpdateSynonym updateSynonym = new UpdateSynonym()
373379
{
374380
Synonym = updatedSynonym
@@ -395,8 +401,8 @@ private IEnumerator Examples()
395401
while (!_getDialogNodeTested)
396402
yield return null;
397403
// Update Dialog Nodes
398-
string updatedDialogNodeName = _dialogNodeName + "_updated";
399-
string updatedDialogNodeDescription = _dialogNodeDesc + "_updated";
404+
string updatedDialogNodeName = _dialogNodeName + "Updated";
405+
string updatedDialogNodeDescription = _dialogNodeDesc + "Updated";
400406
UpdateDialogNode updateDialogNode = new UpdateDialogNode()
401407
{
402408
DialogNode = updatedDialogNodeName,
@@ -433,7 +439,7 @@ private IEnumerator Examples()
433439
while (!_getCounterexampleTested)
434440
yield return null;
435441
// Update Counterexamples
436-
string updatedCounterExampleText = _createdCounterExampleText + "-updated";
442+
string updatedCounterExampleText = _createdCounterExampleText + "Updated";
437443
UpdateCounterexample updateCounterExample = new UpdateCounterexample()
438444
{
439445
Text = updatedCounterExampleText
@@ -480,6 +486,12 @@ private IEnumerator Examples()
480486
yield break;
481487
}
482488

489+
private void OnListMentions(EntityMentionCollection response, Dictionary<string, object> customData)
490+
{
491+
Log.Debug("ExampleAssistant.OnListMentions()", "Response: {0}", customData["json"].ToString());
492+
_listMentionsTested = true;
493+
}
494+
483495
private void OnDeleteWorkspace(object response, Dictionary<string, object> customData)
484496
{
485497
Log.Debug("ExampleAssistant.OnDeleteWorkspace()", "Response: {0}", customData["json"].ToString());
@@ -769,6 +781,13 @@ private void OnCreateWorkspace(Workspace response, Dictionary<string, object> cu
769781
private void OnListWorkspaces(WorkspaceCollection response, Dictionary<string, object> customData)
770782
{
771783
Log.Debug("ExampleAssistant.OnListWorkspaces()", "Response: {0}", customData["json"].ToString());
784+
785+
foreach(Workspace workspace in response.Workspaces)
786+
{
787+
if(workspace.Name.Contains("unity"))
788+
_service.DeleteWorkspace(OnDeleteWorkspace, OnFail, workspace.WorkspaceId);
789+
}
790+
772791
_listWorkspacesTested = true;
773792
}
774793

Examples/ServiceExamples/ServiceExamples.unity

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OcclusionCullingSettings:
1313
--- !u!104 &2
1414
RenderSettings:
1515
m_ObjectHideFlags: 0
16-
serializedVersion: 9
16+
serializedVersion: 8
1717
m_Fog: 0
1818
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
1919
m_FogMode: 3
@@ -38,8 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.37311926, g: 0.38073996, b: 0.35872692, a: 1}
42-
m_UseRadianceAmbientProbe: 0
41+
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
4342
--- !u!157 &3
4443
LightmapSettings:
4544
m_ObjectHideFlags: 0
@@ -55,10 +54,11 @@ LightmapSettings:
5554
m_EnableBakedLightmaps: 1
5655
m_EnableRealtimeLightmaps: 1
5756
m_LightmapEditorSettings:
58-
serializedVersion: 10
57+
serializedVersion: 9
5958
m_Resolution: 2
6059
m_BakeResolution: 40
61-
m_AtlasSize: 1024
60+
m_TextureWidth: 1024
61+
m_TextureHeight: 1024
6262
m_AO: 0
6363
m_AOMaxDistance: 1
6464
m_CompAOExponent: 0
@@ -88,7 +88,6 @@ LightmapSettings:
8888
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
8989
m_PVRFilteringAtrousPositionSigmaIndirect: 2
9090
m_PVRFilteringAtrousPositionSigmaAO: 1
91-
m_ShowResolutionOverlay: 1
9291
m_LightingDataAsset: {fileID: 0}
9392
m_UseShadowmask: 0
9493
--- !u!196 &4
@@ -110,8 +109,6 @@ NavMeshSettings:
110109
manualTileSize: 0
111110
tileSize: 256
112111
accuratePlacement: 0
113-
debug:
114-
m_Flags: 0
115112
m_NavMeshData: {fileID: 0}
116113
--- !u!1 &85803340
117114
GameObject:
@@ -276,11 +273,11 @@ Camera:
276273
m_TargetEye: 3
277274
m_HDR: 0
278275
m_AllowMSAA: 1
279-
m_AllowDynamicResolution: 0
280276
m_ForceIntoRT: 0
281277
m_OcclusionCulling: 1
282278
m_StereoConvergence: 10
283279
m_StereoSeparation: 0.022
280+
m_StereoMirrorMode: 0
284281
--- !u!4 &725710372
285282
Transform:
286283
m_ObjectHideFlags: 0
@@ -309,7 +306,7 @@ GameObject:
309306
m_Icon: {fileID: 0}
310307
m_NavMeshLayer: 0
311308
m_StaticEditorFlags: 0
312-
m_IsActive: 1
309+
m_IsActive: 0
313310
--- !u!114 &832860417
314311
MonoBehaviour:
315312
m_ObjectHideFlags: 0
@@ -816,7 +813,7 @@ GameObject:
816813
m_Icon: {fileID: 0}
817814
m_NavMeshLayer: 0
818815
m_StaticEditorFlags: 0
819-
m_IsActive: 0
816+
m_IsActive: 1
820817
--- !u!114 &2118312580
821818
MonoBehaviour:
822819
m_ObjectHideFlags: 0
@@ -829,10 +826,10 @@ MonoBehaviour:
829826
m_Name:
830827
m_EditorClassIdentifier:
831828
_serviceUrl:
832-
_workspaceId:
833-
_versionDate:
834-
_username:
835-
_password:
829+
_workspaceId: edff566a-66b3-477b-85ad-67c4b6837745
830+
_versionDate: 2018-07-10
831+
_username: 3a13aa4a-6cd1-437c-b0c3-7b1245d701ad
832+
_password: 5OZLsFZN4Y0m
836833
_iamApikey:
837834
_iamUrl:
838835
--- !u!4 &2118312581

Scripts/Services/Assistant/v1/Assistant.cs

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,116 @@ private void OnUpdateEntityResponse(RESTConnector.Request req, RESTConnector.Res
27082708
((UpdateEntityRequestObj)req).FailCallback(resp.Error, customData);
27092709
}
27102710
}
2711+
2712+
/// <summary>
2713+
/// List entity mentions.
2714+
///
2715+
/// List mentions for a contextual entity. An entity mention is an occurrence of a contextual entity in the
2716+
/// context of an intent user input example.
2717+
///
2718+
/// This operation is limited to 200 requests per 30 minutes. For more information, see **Rate limiting**.
2719+
/// </summary>
2720+
/// <param name="successCallback">The function that is called when the operation is successful.</param>
2721+
/// <param name="failCallback">The function that is called when the operation fails.</param>
2722+
/// <param name="workspaceId">Unique identifier of the workspace.</param>
2723+
/// <param name="entity">The name of the entity.</param>
2724+
/// <param name="export">Whether to include all element content in the returned data. If **export**=`false`, the
2725+
/// returned data includes only information about the element itself. If **export**=`true`, all content,
2726+
/// including subelements, is included. (optional, default to false)</param>
2727+
/// <param name="includeAudit">Whether to include the audit properties (`created` and `updated` timestamps) in
2728+
/// the response. (optional, default to false)</param>
2729+
/// <returns><see cref="EntityMentionCollection" />EntityMentionCollection</returns>
2730+
/// <param name="customData">A Dictionary<string, object> of data that will be passed to the callback. The raw
2731+
/// json output from the REST call will be passed in this object as the value of the 'json'
2732+
/// key.</string></param>
2733+
public bool ListMentions(SuccessCallback<EntityMentionCollection> successCallback, FailCallback failCallback, string workspaceId, string entity, bool? export = null, bool? includeAudit = null, Dictionary<string, object> customData = null)
2734+
{
2735+
if (successCallback == null)
2736+
throw new ArgumentNullException("successCallback");
2737+
if (failCallback == null)
2738+
throw new ArgumentNullException("failCallback");
2739+
2740+
ListMentionsRequestObj req = new ListMentionsRequestObj();
2741+
req.SuccessCallback = successCallback;
2742+
req.FailCallback = failCallback;
2743+
req.CustomData = customData == null ? new Dictionary<string, object>() : customData;
2744+
if (req.CustomData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
2745+
{
2746+
foreach (KeyValuePair<string, string> kvp in req.CustomData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
2747+
{
2748+
req.Headers.Add(kvp.Key, kvp.Value);
2749+
}
2750+
}
2751+
req.Parameters["version"] = VersionDate;
2752+
if (export != null)
2753+
req.Parameters["export"] = export;
2754+
if (includeAudit != null)
2755+
req.Parameters["include_audit"] = includeAudit;
2756+
req.OnResponse = OnListMentionsResponse;
2757+
2758+
RESTConnector connector = RESTConnector.GetConnector(Credentials, string.Format("/v1/workspaces/{0}/entities/{1}/mentions", workspaceId, entity));
2759+
if (connector == null)
2760+
return false;
2761+
2762+
return connector.Send(req);
2763+
}
2764+
2765+
private class ListMentionsRequestObj : RESTConnector.Request
2766+
{
2767+
/// <summary>
2768+
/// The success callback.
2769+
/// </summary>
2770+
public SuccessCallback<EntityMentionCollection> SuccessCallback { get; set; }
2771+
/// <summary>
2772+
/// The fail callback.
2773+
/// </summary>
2774+
public FailCallback FailCallback { get; set; }
2775+
/// <summary>
2776+
/// Custom data.
2777+
/// </summary>
2778+
public Dictionary<string, object> CustomData { get; set; }
2779+
}
2780+
2781+
private void OnListMentionsResponse(RESTConnector.Request req, RESTConnector.Response resp)
2782+
{
2783+
EntityMentionCollection result = new EntityMentionCollection();
2784+
fsData data = null;
2785+
Dictionary<string, object> customData = ((ListMentionsRequestObj)req).CustomData;
2786+
2787+
if (resp.Success)
2788+
{
2789+
try
2790+
{
2791+
fsResult r = fsJsonParser.Parse(Encoding.UTF8.GetString(resp.Data), out data);
2792+
if (!r.Succeeded)
2793+
throw new WatsonException(r.FormattedMessages);
2794+
2795+
object obj = result;
2796+
r = _serializer.TryDeserialize(data, obj.GetType(), ref obj);
2797+
if (!r.Succeeded)
2798+
throw new WatsonException(r.FormattedMessages);
2799+
2800+
customData.Add("json", data);
2801+
}
2802+
catch (Exception e)
2803+
{
2804+
Log.Error("Assistant.OnListMentionsResponse()", "Exception: {0}", e.ToString());
2805+
resp.Success = false;
2806+
}
2807+
}
2808+
2809+
if (resp.Success)
2810+
{
2811+
if (((ListMentionsRequestObj)req).SuccessCallback != null)
2812+
((ListMentionsRequestObj)req).SuccessCallback(result, customData);
2813+
}
2814+
else
2815+
{
2816+
if (((ListMentionsRequestObj)req).FailCallback != null)
2817+
((ListMentionsRequestObj)req).FailCallback(resp.Error, customData);
2818+
}
2819+
}
2820+
27112821
/// <summary>
27122822
/// Add entity value. Create a new value for an entity. This operation is limited to 1000 requests per 30 minutes. For more information, see [**Rate limiting**](https://www.ibm.com/watson/developercloud/assistant/api/v1/#rate-limiting).
27132823
/// </summary>

Scripts/Services/Assistant/v1/IAssistant.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public interface IAssistant
8383
bool ListEntities(SuccessCallback<EntityCollection> successCallback, FailCallback failCallback, string workspaceId, bool? export = null, long? pageLimit = null, bool? includeCount = null, string sort = null, string cursor = null, bool? includeAudit = null, Dictionary<string, object> customData = null);
8484

8585
bool UpdateEntity(SuccessCallback<Entity> successCallback, FailCallback failCallback, string workspaceId, string entity, UpdateEntity properties, Dictionary<string, object> customData = null);
86+
bool ListMentions(SuccessCallback<EntityMentionCollection> successCallback, FailCallback failCallback, string workspaceId, string entity, bool? export = null, bool? includeAudit = null, Dictionary<string, object> customData = null);
8687
bool CreateValue(SuccessCallback<Value> successCallback, FailCallback failCallback, string workspaceId, string entity, CreateValue properties, Dictionary<string, object> customData = null);
8788

8889
bool DeleteValue(SuccessCallback<object> successCallback, FailCallback failCallback, string workspaceId, string entity, string value, Dictionary<string, object> customData = null);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ public enum EventNameEnum
205205
/// <value>The location in the dialog context where output is stored.</value>
206206
[fsProperty("variable")]
207207
public string Variable { get; set; }
208+
/// <summary>
209+
/// A label that can be displayed externally to describe the purpose of the node to users.
210+
/// </summary>
211+
[fsProperty("user_label")]
212+
public string UserLabel { get; set; }
208213
}
209214

210215
}

0 commit comments

Comments
 (0)