Skip to content

Commit ef82fc6

Browse files
authored
Merge pull request #427 from watson-developer-cloud/rc-2.5.0
IBM Watson SDK for Unity v2.5.0
2 parents eda2d80 + d3a2797 commit ef82fc6

File tree

15 files changed

+1461
-59
lines changed

15 files changed

+1461
-59
lines changed

Docs/publishing-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The following tasks should be completed before publishing a release. Track the p
55
- [ ] Review and merge any outstanding pull requests.
66
- [ ] Review any oustanding issues assigned to this release milestone.
77
- [ ] Branch from `develop` to `rc-[version]`, ex: `rc-2.0.0`.
8-
- [ ] Draft release with version in the format of `v2.0.0` targeting the 'master' branch. Standard release should be named using the format `Watson Developer Cloud Unity SDK [version]`, ex: `Watson Developer Cloud Unity SDK v2.0.0`.
8+
- [ ] Draft release with version in the format of `v2.0.0` targeting the 'master' branch. Standard release should be named using the format `IBM Watson SDK for Unity [version]`, ex: `IBM Watson SDK for Unity v2.0.0`.
99

1010
#### Source Changes (in `rc` branch)
1111
- [ ] Update `String.Version` in `Scripts/Utilities/Constants.cs` to the current version, ex: `watson-apis-unity-sdk/2.0.0`

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "Watson Developer Cloud Unity SDK"
35+
PROJECT_NAME = "IBM Watson SDK for Unity"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

Examples/ServiceExamples/Scripts/ExampleDiscovery.cs

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public class ExampleDiscovery : MonoBehaviour
8383
private bool _readyToContinue = false;
8484
private float _waitTime = 10f;
8585

86+
private bool _listCredentialsTested = false;
87+
private bool _createCredentialsTested = false;
88+
private bool _getCredentialTested = false;
89+
private bool _deleteCredentialsTested = false;
90+
private string _createdCredentialId = null;
91+
8692
private void Start()
8793
{
8894
LogSystem.InstallDefaultReactors();
@@ -285,6 +291,44 @@ private IEnumerator Examples()
285291
while (!_isEnvironmentReady)
286292
yield return null;
287293

294+
// List Credentials
295+
Log.Debug("TestDiscovery.RunTest()", "Attempting to list credentials");
296+
_service.ListCredentials(OnListCredentials, OnFail, _environmentId);
297+
while (!_listCredentialsTested)
298+
yield return null;
299+
300+
// Create Credentials
301+
Log.Debug("TestDiscovery.RunTest()", "Attempting to create credentials");
302+
SourceCredentials credentialsParameter = new SourceCredentials()
303+
{
304+
SourceType = SourceCredentials.SourceTypeEnum.box,
305+
CredentialDetails = new CredentialDetails()
306+
{
307+
CredentialType = CredentialDetails.CredentialTypeEnum.oauth2,
308+
EnterpriseId = "myEnterpriseId",
309+
ClientId = "myClientId",
310+
ClientSecret = "myClientSecret",
311+
PublicKeyId = "myPublicIdKey",
312+
Passphrase = "myPassphrase",
313+
PrivateKey = "myPrivateKey"
314+
}
315+
};
316+
_service.CreateCredentials(OnCreateCredentials, OnFail, _environmentId, credentialsParameter);
317+
while (!_createCredentialsTested)
318+
yield return null;
319+
320+
// Get Credential
321+
Log.Debug("TestDiscovery.RunTest()", "Attempting to get credential");
322+
_service.GetCredential(OnGetCredential, OnFail, _environmentId, _createdCredentialId);
323+
while (!_getCredentialTested)
324+
yield return null;
325+
326+
// DeleteCredential
327+
Log.Debug("TestDiscovery.RunTest()", "Attempting to delete credential");
328+
_service.DeleteCredentials(OnDeleteCredentials, OnFail, _environmentId, _createdCredentialId);
329+
while (!_deleteCredentialsTested)
330+
yield return null;
331+
288332
Log.Debug("TestDiscovery.RunTest()", "Discovery examples complete.");
289333
}
290334

@@ -327,13 +371,22 @@ private IEnumerator Delay(float waitTime)
327371
private void OnGetEnvironments(GetEnvironmentsResponse resp, Dictionary<string, object> customData)
328372
{
329373
Log.Debug("ExampleDiscovery.OnGetEnvironments()", "Discovery - GetEnvironments Response: {0}", customData["json"].ToString());
374+
375+
foreach (var environment in resp.environments)
376+
{
377+
if (environment.read_only == false)
378+
{
379+
Log.Debug("ExampleDiscovery.OnGetEnvironments()", "setting environment to {0}", environment.environment_id);
380+
_environmentId = environment.environment_id;
381+
}
382+
}
383+
330384
_getEnvironmentsTested = true;
331385
}
332386

333387
private void OnGetEnvironment(Environment resp, Dictionary<string, object> customData)
334388
{
335389
Log.Debug("ExampleDiscovery.OnGetEnvironment()", "Discovery - GetEnvironment Response: {0}", customData["json"].ToString());
336-
_environmentId = resp.environment_id;
337390
_getEnvironmentTested = true;
338391
}
339392

@@ -437,6 +490,30 @@ private void OnQuery(QueryResponse resp, Dictionary<string, object> customData)
437490
_queryTested = true;
438491
}
439492

493+
private void OnListCredentials(CredentialsList response, Dictionary<string, object> customData)
494+
{
495+
Log.Debug("ExampleDiscovery.OnListCredentials()", "Response: {0}", customData["json"].ToString());
496+
_listCredentialsTested = true;
497+
}
498+
private void OnCreateCredentials(SourceCredentials response, Dictionary<string, object> customData)
499+
{
500+
Log.Debug("ExampleDiscovery.OnCreateCredentials()", "Response: {0}", customData["json"].ToString());
501+
_createdCredentialId = response.CredentialId;
502+
_createCredentialsTested = true;
503+
}
504+
505+
private void OnGetCredential(SourceCredentials response, Dictionary<string, object> customData)
506+
{
507+
Log.Debug("ExampleDiscovery.OnGetCredential()", "Response: {0}", customData["json"].ToString());
508+
_getCredentialTested = true;
509+
}
510+
511+
private void OnDeleteCredentials(DeleteCredentials response, Dictionary<string, object> customData)
512+
{
513+
Log.Debug("ExampleDiscovery.OnDeleteCredentials()", "Response: {0}", customData["json"].ToString());
514+
_deleteCredentialsTested = true;
515+
}
516+
440517
private void OnFail(RESTConnector.Error error, Dictionary<string, object> customData)
441518
{
442519
Log.Error("ExampleDiscovery.OnFail()", "Error received: {0}", error.ToString());

NOTICES.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
This asset is governed by the Asset Store EULA; however, the following components are governed by the licenses indicated below:
2+
3+
A. websocket-sharp
4+
5+
The MIT License (MIT)
6+
7+
Copyright (c) 2010-2018 sta.blockhead
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
27+
28+
B. Full Serializer
29+
30+
The MIT License (MIT)
31+
32+
Copyright (c) 2014 Jacob Dufault
33+
34+
Permission is hereby granted, free of charge, to any person obtaining a copy
35+
of this software and associated documentation files (the "Software"), to deal
36+
in the Software without restriction, including without limitation the rights
37+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38+
copies of the Software, and to permit persons to whom the Software is
39+
furnished to do so, subject to the following conditions:
40+
41+
The above copyright notice and this permission notice shall be included in
42+
all copies or substantial portions of the Software.
43+
44+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50+
THE SOFTWARE.
51+
52+
C. MiniJSON
53+
54+
Copyright (c) 2013 Calvin Rien
55+
56+
Based on the JSON parser by Patrick van Bergen
57+
http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
58+
59+
Simplified it so that it doesn't throw exceptions
60+
and can be used in Unity iPhone with maximum code stripping.
61+
62+
Permission is hereby granted, free of charge, to any person obtaining
63+
a copy of this software and associated documentation files (the
64+
"Software"), to deal in the Software without restriction, including
65+
without limitation the rights to use, copy, modify, merge, publish,
66+
distribute, sublicense, and/or sell copies of the Software, and to
67+
permit persons to whom the Software is furnished to do so, subject to
68+
the following conditions:
69+
70+
The above copyright notice and this permission notice shall be
71+
included in all copies or substantial portions of the Software.
72+
73+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
74+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
75+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
76+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
77+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
78+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
79+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Ensure that you have the following prerequisites:
2929
* [Unity][get_unity]. You can use the **free** Personal edition.
3030

3131
## Configuring Unity
32-
* Change the build settings in Unity (**File > Build Settings**) to any platform except for web player/Web GL. The Watson Developer Cloud Unity SDK does not support Unity Web Player.
32+
* Change the build settings in Unity (**File > Build Settings**) to any platform except for web player/Web GL. The IBM Watson SDK for Unity does not support Unity Web Player.
3333
* If using Unity 2018.2 or later you'll need to set Scripting Runtime Version in Build Settings to .NET 4.x equivalent. We need to access security options to enable TLS 1.2.
3434

3535
## Getting the Watson SDK and adding it to Unity
@@ -107,15 +107,16 @@ You supply either an IAM service **API key** or an **access token**:
107107
```cs
108108
IEnumerator TokenExample()
109109
{
110-
// Create IAM token options and supply the apikey.
110+
// Create IAM token options and supply the apikey. IamUrl is the URL used to get the
111+
// authorization token using the IamApiKey. It defaults to https://iam.bluemix.net/identity/token
111112
TokenOptions iamTokenOptions = new TokenOptions()
112113
{
113114
IamApiKey = "<iam-api-key>",
114-
IamUrl = "<service-url>"
115+
IamUrl = "<iam-url>"
115116
};
116117

117118
// Create credentials using the IAM token options
118-
_credentials = new Credentials(iamTokenOptions, "<service-url");
119+
_credentials = new Credentials(iamTokenOptions, "<service-url>");
119120
while (!_credentials.HasIamTokenData())
120121
yield return null;
121122

@@ -314,6 +315,9 @@ private void OnMessage(object resp, Dictionary<string, object> customData)
314315
```
315316

316317
## Authentication Tokens
318+
319+
**Authenticating with the `X-Watson-Authorization-Token` header is deprecated. The token continues to work with Cloud Foundry services, but is not supported for services that use Identity and Access Management (IAM) authentication. For details see [Authenticating with IAM tokens](https://console.bluemix.net/docs/services/watson/getting-started-iam.html#iam) or the [README](#IAM) in the IBM Watson SDK you use.**
320+
317321
You use tokens to write applications that make authenticated requests to IBM Watson™ services without embedding service credentials in every call.
318322

319323
You can write an authentication proxy in IBM Cloud that obtains and returns a token to your client application, which can then use the token to call the service directly. This proxy eliminates the need to channel all service requests through an intermediate server-side application, which is otherwise necessary to avoid exposing your service credentials from your client application.
@@ -352,6 +356,9 @@ private void OnGetToken(AuthenticationToken authenticationToken, string customDa
352356
}
353357
```
354358

359+
## Streaming outside of US South region
360+
Watson services have upgraded their hosts to TLS 1.2. The US South region has a TLS 1.0 endpoint that will work for streaming but if you are streaming in other regions you will need to use Unity 2018.2 and set Scripting Runtime Version in Build Settings to .NET 4.x equivalent. In lower versions of Unity you will need to create the Speech to Text instance in US South.
361+
355362
## Documentation
356363
Documentation can be found [here][documentation]. You can also access the documentation by selecting API Reference the Watson menu (**Watson -> API Reference**).
357364

0 commit comments

Comments
 (0)