Skip to content

Commit f2f1b12

Browse files
authored
Merge pull request #482 from watson-developer-cloud/5786-sdk-update-c-and-c
Update SDK with Compare and Comply support and new Discovery and Natural Language Understanding features
2 parents f7e6723 + 4e52b7b commit f2f1b12

File tree

168 files changed

+7554
-1893
lines changed

Some content is hidden

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

168 files changed

+7554
-1893
lines changed

Docs/UnitySDK.shfbproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,14 @@
7272
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Utilities" isDocumented="True">Various utility classes.</NamespaceSummaryItem>
7373
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Widgets" isDocumented="True">Widget classes.</NamespaceSummaryItem>
7474
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services" isDocumented="True">Watson service classes.</NamespaceSummaryItem>
75-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.AlchemyAPI.v1" isDocumented="True">Alchemy API version 1 service abstraction.</NamespaceSummaryItem>
7675
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.Conversation.v1" isDocumented="True">Conversation version 1 service abstraction.</NamespaceSummaryItem>
77-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.ConversationExperimental.v1" isDocumented="True">Experimental Conversation service abstraction.</NamespaceSummaryItem>
78-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.DeepQA.v1" isDocumented="True">Deep QA version 1 service abstraction.</NamespaceSummaryItem>
7976
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.Dialog.v1" isDocumented="True">Dialog version 1 service abstraction.</NamespaceSummaryItem>
80-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.DocumentConversion.v1" isDocumented="True">Document Conversiont version 1 service abstraction.</NamespaceSummaryItem>
81-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.LanguageTranslator.v1" isDocumented="True">Language Translator version 1 service abstraction.</NamespaceSummaryItem>
8277
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.NaturalLanguageClassifier.v1" isDocumented="True">Natural Language Classifier version 1 service abstraction.</NamespaceSummaryItem>
8378
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.PersonalityInsights.v2" isDocumented="True">Personality Insightst version 2 service abstraction.</NamespaceSummaryItem>
84-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.RetrieveAndRank.v1" isDocumented="True">Retrieve and Rankt version 1 service abstraction.</NamespaceSummaryItem>
8579
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.SpeechToText.v1" isDocumented="True">Speech to Text version 1 service abstraction.</NamespaceSummaryItem>
8680
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.TextToSpeech.v1" isDocumented="True">Text to Speech version 1 service abstraction.</NamespaceSummaryItem>
8781
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.ToneAnalyzer.v3" isDocumented="True">Tone Analyzer version 3 service abstraction.</NamespaceSummaryItem>
88-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.TradeoffAnalytics.v1" isDocumented="True">Tradeoff Analytics version 1 service abstraction.</NamespaceSummaryItem>
8982
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.VisualRecognition.v3" isDocumented="True">Visual Recognitionr version 3 service abstraction.</NamespaceSummaryItem>
90-
<NamespaceSummaryItem name="IBM.Watson.DeveloperCloud.Services.LanguageTranslation.v1" isDocumented="True">Language Translation version 1 service abstraction.</NamespaceSummaryItem>
9183
</NamespaceSummaries>
9284
<ApiFilter>
9385
<Filter entryType="Namespace" fullName="" isExposed="False" />

Examples/ServiceExamples/Scripts/ExampleAssistantV1.cs

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,10 @@ public class ExampleAssistantV1 : MonoBehaviour
3737
[Tooltip("The version date with which you would like to use the service in the form YYYY-MM-DD.")]
3838
[SerializeField]
3939
private string _versionDate;
40-
[Header("CF Authentication")]
41-
[Tooltip("The authentication username.")]
42-
[SerializeField]
43-
private string _username;
44-
[Tooltip("The authentication password.")]
45-
[SerializeField]
46-
private string _password;
4740
[Header("IAM Authentication")]
4841
[Tooltip("The IAM apikey.")]
4942
[SerializeField]
5043
private string _iamApikey;
51-
[Tooltip("The IAM url used to authenticate the apikey (optional). This defaults to \"https://iam.bluemix.net/identity/token\".")]
52-
[SerializeField]
53-
private string _iamUrl;
5444
#endregion
5545

5646
private string _createdWorkspaceId;
@@ -132,32 +122,25 @@ void Start()
132122

133123
private IEnumerator CreateService()
134124
{
135-
// Create credential and instantiate service
136-
Credentials credentials = null;
137-
if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password))
125+
if(string.IsNullOrEmpty(_iamApikey))
138126
{
139-
// Authenticate using username and password
140-
credentials = new Credentials(_username, _password, _serviceUrl);
127+
throw new WatsonException("Plesae provide IAM ApiKey for the service.");
141128
}
142-
else if (!string.IsNullOrEmpty(_iamApikey))
143-
{
144-
// Authenticate using iamApikey
145-
TokenOptions tokenOptions = new TokenOptions()
146-
{
147-
IamApiKey = _iamApikey,
148-
IamUrl = _iamUrl
149-
};
150-
151-
credentials = new Credentials(tokenOptions, _serviceUrl);
152-
153-
// Wait for tokendata
154-
while (!credentials.HasIamTokenData())
155-
yield return null;
156-
}
157-
else
129+
130+
// Create credential and instantiate service
131+
Credentials credentials = null;
132+
133+
// Authenticate using iamApikey
134+
TokenOptions tokenOptions = new TokenOptions()
158135
{
159-
throw new WatsonException("Please provide either username and password or IAM apikey to authenticate the service.");
160-
}
136+
IamApiKey = _iamApikey
137+
};
138+
139+
credentials = new Credentials(tokenOptions, _serviceUrl);
140+
141+
// Wait for tokendata
142+
while (!credentials.HasIamTokenData())
143+
yield return null;
161144

162145
_service = new Assistant(credentials);
163146
_service.VersionDate = _versionDate;

Examples/ServiceExamples/Scripts/ExampleAssistantV2.cs

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,10 @@ public class ExampleAssistantV2 : MonoBehaviour
3838
[Tooltip("The version date with which you would like to use the service in the form YYYY-MM-DD.")]
3939
[SerializeField]
4040
private string _versionDate;
41-
[Header("CF Authentication")]
42-
[Tooltip("The authentication username.")]
43-
[SerializeField]
44-
private string _username;
45-
[Tooltip("The authentication password.")]
46-
[SerializeField]
47-
private string _password;
4841
[Header("IAM Authentication")]
4942
[Tooltip("The IAM apikey.")]
5043
[SerializeField]
5144
private string _iamApikey;
52-
[Tooltip("The IAM url used to authenticate the apikey (optional). This defaults to \"https://iam.bluemix.net/identity/token\".")]
53-
[SerializeField]
54-
private string _iamUrl;
5545
#endregion
5646

5747
private Assistant _service;
@@ -73,32 +63,25 @@ private void Start()
7363

7464
private IEnumerator CreateService()
7565
{
76-
// Create credential and instantiate service
77-
Credentials credentials = null;
78-
if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password))
66+
if (string.IsNullOrEmpty(_iamApikey))
7967
{
80-
// Authenticate using username and password
81-
credentials = new Credentials(_username, _password, _serviceUrl);
68+
throw new WatsonException("Plesae provide IAM ApiKey for the service.");
8269
}
83-
else if (!string.IsNullOrEmpty(_iamApikey))
84-
{
85-
// Authenticate using iamApikey
86-
TokenOptions tokenOptions = new TokenOptions()
87-
{
88-
IamApiKey = _iamApikey,
89-
IamUrl = _iamUrl
90-
};
9170

92-
credentials = new Credentials(tokenOptions, _serviceUrl);
71+
// Create credential and instantiate service
72+
Credentials credentials = null;
9373

94-
// Wait for tokendata
95-
while (!credentials.HasIamTokenData())
96-
yield return null;
97-
}
98-
else
74+
// Authenticate using iamApikey
75+
TokenOptions tokenOptions = new TokenOptions()
9976
{
100-
throw new WatsonException("Please provide either username and password or IAM apikey to authenticate the service.");
101-
}
77+
IamApiKey = _iamApikey
78+
};
79+
80+
credentials = new Credentials(tokenOptions, _serviceUrl);
81+
82+
// Wait for tokendata
83+
while (!credentials.HasIamTokenData())
84+
yield return null;
10285

10386
_service = new Assistant(credentials);
10487
_service.VersionDate = _versionDate;

0 commit comments

Comments
 (0)