Skip to content

Commit c20297f

Browse files
authored
Merge pull request #588 from watson-developer-cloud/feat/regenerate-pre-release-1
feat(regerate): regenerate services for pre-release
2 parents 1ef2b54 + 9b81639 commit c20297f

File tree

96 files changed

+1937
-1429
lines changed

Some content is hidden

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

96 files changed

+1937
-1429
lines changed

Examples/ExampleAssistantV1.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
using UnityEngine;
2121
using IBM.Watson.Assistant.V1;
2222
using IBM.Cloud.SDK;
23+
using IBM.Cloud.SDK.Authentication;
24+
using IBM.Cloud.SDK.Authentication.Iam;
2325
using IBM.Cloud.SDK.Utilities;
2426
using IBM.Watson.Assistant.V1.Model;
2527
using System;
@@ -104,12 +106,15 @@ private void Start()
104106

105107
private IEnumerator CreateService()
106108
{
107-
service = new AssistantService("2019-02-18");
108109

109-
// Wait for authorization token
110-
while (!service.Credentials.HasIamTokenData())
110+
IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}");
111+
112+
// Wait for tokendata
113+
while (!authenticator.CanAuthenticate())
111114
yield return null;
112115

116+
service = new AssistantService("2019-02-18", authenticator);
117+
113118
workspaceId = Environment.GetEnvironmentVariable("CONVERSATION_WORKSPACE_ID");
114119
Runnable.Run(Examples());
115120
}
@@ -118,7 +123,7 @@ private IEnumerator Examples()
118123
{
119124
// List Workspaces
120125
Log.Debug("ExampleAssistantV1", "Attempting to ListWorkspaces...");
121-
service.ListWorkspaces(callback: OnListWorkspaces, pageLimit: 1, includeCount: true, sort: "-name", includeAudit: true);
126+
service.ListWorkspaces(callback: OnListWorkspaces, pageLimit: 1, sort: "-name", includeAudit: true);
122127
while (!listWorkspacesTested)
123128
yield return null;
124129

Examples/ExampleAssistantV2.cs

+5-11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
using System.Collections;
2020
using IBM.Cloud.SDK;
21+
using IBM.Cloud.SDK.Authentication;
22+
using IBM.Cloud.SDK.Authentication.Iam;
2123
using IBM.Cloud.SDK.Utilities;
2224
using IBM.Watson.Assistant.V2;
2325
using IBM.Watson.Assistant.V2.Model;
@@ -68,21 +70,13 @@ private IEnumerator CreateService()
6870
}
6971

7072
// Create credential and instantiate service
71-
Credentials credentials = null;
72-
73-
// Authenticate using iamApikey
74-
TokenOptions tokenOptions = new TokenOptions()
75-
{
76-
IamApiKey = iamApikey
77-
};
78-
79-
credentials = new Credentials(tokenOptions, serviceUrl);
73+
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);
8074

8175
// Wait for tokendata
82-
while (!credentials.HasIamTokenData())
76+
while (!authenticator.CanAuthenticate())
8377
yield return null;
8478

85-
service = new AssistantService(versionDate, credentials);
79+
service = new AssistantService(versionDate, authenticator);
8680

8781
Runnable.Run(Examples());
8882
}

Examples/ExampleNaturalLanguageUnderstandingV1.cs

+8-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using IBM.Watson.NaturalLanguageUnderstanding.V1.Model;
2020
using IBM.Cloud.SDK.Utilities;
2121
using IBM.Cloud.SDK.Authentication;
22+
using IBM.Cloud.SDK.Authentication.Iam;
2223
using System.Collections;
2324
using System.Collections.Generic;
2425
using UnityEngine;
@@ -57,18 +58,18 @@ private IEnumerator CreateService()
5758
throw new IBMException("Please add IAM ApiKey to the Iam Apikey field in the inspector.");
5859
}
5960

60-
IamTokenOptions tokenOptions = new IamTokenOptions()
61-
{
62-
IamApiKey = iamApikey
63-
};
64-
Credentials credentials = new Credentials(tokenOptions, serviceUrl);
61+
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);
62+
63+
// Wait for tokendata
64+
while (!authenticator.CanAuthenticate())
65+
yield return null;
6566

66-
while (!credentials.HasTokenData())
67+
while (!authenticator.CanAuthenticate())
6768
{
6869
yield return null;
6970
}
7071

71-
service = new NaturalLanguageUnderstandingService(versionDate, credentials);
72+
service = new NaturalLanguageUnderstandingService(versionDate, authenticator);
7273

7374
Runnable.Run(ExampleAnalyze());
7475
Runnable.Run(ExampleListModels());

Examples/ExamplePersonalityInsightsV3.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717

1818
using IBM.Cloud.SDK;
19+
using IBM.Cloud.SDK.Authentication;
20+
using IBM.Cloud.SDK.Authentication.Iam;
1921
using IBM.Cloud.SDK.Utilities;
2022
using IBM.Watson.PersonalityInsights.V3;
2123
using IBM.Watson.PersonalityInsights.V3.Model;
@@ -35,7 +37,7 @@ public class ExamplePersonalityInsightsV3 : MonoBehaviour
3537

3638
private bool profileTested = false;
3739
private bool profileAsCsvTested = false;
38-
40+
3941
private void Start()
4042
{
4143
LogSystem.InstallDefaultReactors();
@@ -45,12 +47,15 @@ private void Start()
4547

4648
private IEnumerator CreateService()
4749
{
48-
service = new PersonalityInsightsService("2019-02-18");
4950

50-
// Wait for authorization token
51-
while (!service.Credentials.HasIamTokenData())
51+
IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}");
52+
53+
// Wait for tokendata
54+
while (!authenticator.CanAuthenticate())
5255
yield return null;
5356

57+
service = new PersonalityInsightsService("2019-02-18", authenticator);
58+
5459
Runnable.Run(Examples());
5560
}
5661

Examples/ExampleStreaming.cs

+5-12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
using UnityEngine.UI;
2323
using IBM.Watson.SpeechToText.V1;
2424
using IBM.Cloud.SDK;
25+
using IBM.Cloud.SDK.Authentication;
26+
using IBM.Cloud.SDK.Authentication.Iam;
2527
using IBM.Cloud.SDK.Utilities;
2628
using IBM.Cloud.SDK.DataTypes;
2729

@@ -70,22 +72,13 @@ private IEnumerator CreateService()
7072
throw new IBMException("Plesae provide IAM ApiKey for the service.");
7173
}
7274

73-
// Create credential and instantiate service
74-
Credentials credentials = null;
75-
76-
// Authenticate using iamApikey
77-
TokenOptions tokenOptions = new TokenOptions()
78-
{
79-
IamApiKey = _iamApikey
80-
};
81-
82-
credentials = new Credentials(tokenOptions, _serviceUrl);
75+
IamAuthenticator authenticator = new IamAuthenticator(apikey: _iamApikey);
8376

8477
// Wait for tokendata
85-
while (!credentials.HasIamTokenData())
78+
while (!authenticator.CanAuthenticate())
8679
yield return null;
8780

88-
_service = new SpeechToTextService(credentials);
81+
_service = new SpeechToTextService(authenticator);
8982
_service.StreamMultipart = true;
9083

9184
Active = true;

Examples/ExampleToneAnalyzerV3.cs

+5-11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
using System.Collections.Generic;
2323
using UnityEngine;
2424
using IBM.Cloud.SDK;
25+
using IBM.Cloud.SDK.Authentication;
26+
using IBM.Cloud.SDK.Authentication.Iam;
2527

2628
namespace IBM.Watson.Examples
2729
{
@@ -60,21 +62,13 @@ private IEnumerator CreateService()
6062
}
6163

6264
// Create credential and instantiate service
63-
Credentials credentials = null;
64-
65-
// Authenticate using iamApikey
66-
TokenOptions tokenOptions = new TokenOptions()
67-
{
68-
IamApiKey = iamApikey
69-
};
70-
71-
credentials = new Credentials(tokenOptions, serviceUrl);
65+
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);
7266

7367
// Wait for tokendata
74-
while (!credentials.HasIamTokenData())
68+
while (!authenticator.CanAuthenticate())
7569
yield return null;
7670

77-
service = new ToneAnalyzerService(versionDate, credentials);
71+
service = new ToneAnalyzerService(versionDate, authenticator);
7872

7973
Runnable.Run(Examples());
8074
}

Examples/GenericSerialization.cs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Collections.Generic;
1919
using UnityEngine;
2020
using IBM.Cloud.SDK;
21+
using IBM.Cloud.SDK.Authentication;
2122
using Newtonsoft.Json;
2223
using IBM.Watson.Assistant.V2.Model;
2324

0 commit comments

Comments
 (0)