Skip to content

feat(regerate): regenerate services for pre-release #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Examples/ExampleAssistantV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
using UnityEngine;
using IBM.Watson.Assistant.V1;
using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;
using IBM.Cloud.SDK.Utilities;
using IBM.Watson.Assistant.V1.Model;
using System;
Expand Down Expand Up @@ -104,12 +106,15 @@ private void Start()

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

// Wait for authorization token
while (!service.Credentials.HasIamTokenData())
IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}");

// Wait for tokendata
while (!authenticator.CanAuthenticate())
yield return null;

service = new AssistantService("2019-02-18", authenticator);

workspaceId = Environment.GetEnvironmentVariable("CONVERSATION_WORKSPACE_ID");
Runnable.Run(Examples());
}
Expand All @@ -118,7 +123,7 @@ private IEnumerator Examples()
{
// List Workspaces
Log.Debug("ExampleAssistantV1", "Attempting to ListWorkspaces...");
service.ListWorkspaces(callback: OnListWorkspaces, pageLimit: 1, includeCount: true, sort: "-name", includeAudit: true);
service.ListWorkspaces(callback: OnListWorkspaces, pageLimit: 1, sort: "-name", includeAudit: true);
while (!listWorkspacesTested)
yield return null;

Expand Down
16 changes: 5 additions & 11 deletions Examples/ExampleAssistantV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

using System.Collections;
using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;
using IBM.Cloud.SDK.Utilities;
using IBM.Watson.Assistant.V2;
using IBM.Watson.Assistant.V2.Model;
Expand Down Expand Up @@ -68,21 +70,13 @@ private IEnumerator CreateService()
}

// Create credential and instantiate service
Credentials credentials = null;

// Authenticate using iamApikey
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = iamApikey
};

credentials = new Credentials(tokenOptions, serviceUrl);
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);

// Wait for tokendata
while (!credentials.HasIamTokenData())
while (!authenticator.CanAuthenticate())
yield return null;

service = new AssistantService(versionDate, credentials);
service = new AssistantService(versionDate, authenticator);

Runnable.Run(Examples());
}
Expand Down
15 changes: 8 additions & 7 deletions Examples/ExampleNaturalLanguageUnderstandingV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using IBM.Watson.NaturalLanguageUnderstanding.V1.Model;
using IBM.Cloud.SDK.Utilities;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand Down Expand Up @@ -57,18 +58,18 @@ private IEnumerator CreateService()
throw new IBMException("Please add IAM ApiKey to the Iam Apikey field in the inspector.");
}

IamTokenOptions tokenOptions = new IamTokenOptions()
{
IamApiKey = iamApikey
};
Credentials credentials = new Credentials(tokenOptions, serviceUrl);
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);

// Wait for tokendata
while (!authenticator.CanAuthenticate())
yield return null;

while (!credentials.HasTokenData())
while (!authenticator.CanAuthenticate())
{
yield return null;
}

service = new NaturalLanguageUnderstandingService(versionDate, credentials);
service = new NaturalLanguageUnderstandingService(versionDate, authenticator);

Runnable.Run(ExampleAnalyze());
Runnable.Run(ExampleListModels());
Expand Down
13 changes: 9 additions & 4 deletions Examples/ExamplePersonalityInsightsV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/

using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;
using IBM.Cloud.SDK.Utilities;
using IBM.Watson.PersonalityInsights.V3;
using IBM.Watson.PersonalityInsights.V3.Model;
Expand All @@ -35,7 +37,7 @@ public class ExamplePersonalityInsightsV3 : MonoBehaviour

private bool profileTested = false;
private bool profileAsCsvTested = false;

private void Start()
{
LogSystem.InstallDefaultReactors();
Expand All @@ -45,12 +47,15 @@ private void Start()

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

// Wait for authorization token
while (!service.Credentials.HasIamTokenData())
IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}");

// Wait for tokendata
while (!authenticator.CanAuthenticate())
yield return null;

service = new PersonalityInsightsService("2019-02-18", authenticator);

Runnable.Run(Examples());
}

Expand Down
17 changes: 5 additions & 12 deletions Examples/ExampleStreaming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using UnityEngine.UI;
using IBM.Watson.SpeechToText.V1;
using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;
using IBM.Cloud.SDK.Utilities;
using IBM.Cloud.SDK.DataTypes;

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

// Create credential and instantiate service
Credentials credentials = null;

// Authenticate using iamApikey
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = _iamApikey
};

credentials = new Credentials(tokenOptions, _serviceUrl);
IamAuthenticator authenticator = new IamAuthenticator(apikey: _iamApikey);

// Wait for tokendata
while (!credentials.HasIamTokenData())
while (!authenticator.CanAuthenticate())
yield return null;

_service = new SpeechToTextService(credentials);
_service = new SpeechToTextService(authenticator);
_service.StreamMultipart = true;

Active = true;
Expand Down
16 changes: 5 additions & 11 deletions Examples/ExampleToneAnalyzerV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
using System.Collections.Generic;
using UnityEngine;
using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using IBM.Cloud.SDK.Authentication.Iam;

namespace IBM.Watson.Examples
{
Expand Down Expand Up @@ -60,21 +62,13 @@ private IEnumerator CreateService()
}

// Create credential and instantiate service
Credentials credentials = null;

// Authenticate using iamApikey
TokenOptions tokenOptions = new TokenOptions()
{
IamApiKey = iamApikey
};

credentials = new Credentials(tokenOptions, serviceUrl);
IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);

// Wait for tokendata
while (!credentials.HasIamTokenData())
while (!authenticator.CanAuthenticate())
yield return null;

service = new ToneAnalyzerService(versionDate, credentials);
service = new ToneAnalyzerService(versionDate, authenticator);

Runnable.Run(Examples());
}
Expand Down
1 change: 1 addition & 0 deletions Examples/GenericSerialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Collections.Generic;
using UnityEngine;
using IBM.Cloud.SDK;
using IBM.Cloud.SDK.Authentication;
using Newtonsoft.Json;
using IBM.Watson.Assistant.V2.Model;

Expand Down
Loading