Skip to content

Commit d7f70bb

Browse files
committed
regenerated sdk, updated tests and examples
1 parent 95b0d17 commit d7f70bb

File tree

94 files changed

+1845
-1553
lines changed

Some content is hidden

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

94 files changed

+1845
-1553
lines changed

IBM.WatsonDeveloperCloud.sln

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Pe
8282
EndProject
8383
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.ToneAnalyzer.v3.Example", "examples\IBM.WatsonDeveloperCloud.ToneAnalyzer.v3.Example\IBM.WatsonDeveloperCloud.ToneAnalyzer.v3.Example.xproj", "{40ADCBF1-2FC1-4ACC-8DA0-2DB0174B7E03}"
8484
EndProject
85-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests", "test\IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests\IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests.xproj", "{F4448D3D-913D-4FE0-85F6-60F04EB7C134}"
86-
EndProject
8785
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Conversation.v1.UnitTests", "test\IBM.WatsonDeveloperCloud.Conversation.v1.UnitTests\IBM.WatsonDeveloperCloud.Conversation.v1.UnitTests.xproj", "{7DA05E71-3503-4982-AAB6-26C9B76BDD5F}"
8886
EndProject
8987
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.NaturalLanguageUnderstanding.v1.IntTests", "test\IBM.WatsonDeveloperCloud.NaturalLanguageUnderstanding.v1.IntTests\IBM.WatsonDeveloperCloud.NaturalLanguageUnderstanding.v1.IntTests.xproj", "{A6BC7470-79A2-4C7E-923A-748540791D97}"
@@ -106,6 +104,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Di
106104
EndProject
107105
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Discovery.v1.Example", "examples\IBM.WatsonDeveloperCloud.Discovery.v1.Example\IBM.WatsonDeveloperCloud.Discovery.v1.Example.xproj", "{F15ADA39-381E-4E5F-8E18-E08B51635016}"
108106
EndProject
107+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests", "test\IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests\IBM.WatsonDeveloperCloud.Conversation.v1.IntegrationTests.xproj", "{F4448D3D-913D-4FE0-85F6-60F04EB7C134}"
108+
EndProject
109109
Global
110110
GlobalSection(SolutionConfigurationPlatforms) = preSolution
111111
Debug|Any CPU = Debug|Any CPU
@@ -212,10 +212,6 @@ Global
212212
{40ADCBF1-2FC1-4ACC-8DA0-2DB0174B7E03}.Debug|Any CPU.Build.0 = Debug|Any CPU
213213
{40ADCBF1-2FC1-4ACC-8DA0-2DB0174B7E03}.Release|Any CPU.ActiveCfg = Release|Any CPU
214214
{40ADCBF1-2FC1-4ACC-8DA0-2DB0174B7E03}.Release|Any CPU.Build.0 = Release|Any CPU
215-
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
216-
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Debug|Any CPU.Build.0 = Debug|Any CPU
217-
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Release|Any CPU.ActiveCfg = Release|Any CPU
218-
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Release|Any CPU.Build.0 = Release|Any CPU
219215
{7DA05E71-3503-4982-AAB6-26C9B76BDD5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
220216
{7DA05E71-3503-4982-AAB6-26C9B76BDD5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
221217
{7DA05E71-3503-4982-AAB6-26C9B76BDD5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -260,6 +256,10 @@ Global
260256
{F15ADA39-381E-4E5F-8E18-E08B51635016}.Debug|Any CPU.Build.0 = Debug|Any CPU
261257
{F15ADA39-381E-4E5F-8E18-E08B51635016}.Release|Any CPU.ActiveCfg = Release|Any CPU
262258
{F15ADA39-381E-4E5F-8E18-E08B51635016}.Release|Any CPU.Build.0 = Release|Any CPU
259+
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
260+
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Debug|Any CPU.Build.0 = Debug|Any CPU
261+
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Release|Any CPU.ActiveCfg = Release|Any CPU
262+
{F4448D3D-913D-4FE0-85F6-60F04EB7C134}.Release|Any CPU.Build.0 = Release|Any CPU
263263
EndGlobalSection
264264
GlobalSection(SolutionProperties) = preSolution
265265
HideSolutionNode = FALSE
@@ -301,7 +301,6 @@ Global
301301
{9F05DE48-0665-4691-8687-AE428A19B09A} = {89D715BF-7464-45FB-8DA0-9D7B46AB8C7F}
302302
{80915AD4-F490-4CCB-A0E2-83CF18A8D510} = {D65AC99F-4E63-4362-8765-EB6F15838CA0}
303303
{40ADCBF1-2FC1-4ACC-8DA0-2DB0174B7E03} = {C7873F44-7188-49BE-84C5-532BE4E07147}
304-
{F4448D3D-913D-4FE0-85F6-60F04EB7C134} = {8B927AB2-21F8-40DE-BE6B-5B1105453133}
305304
{7DA05E71-3503-4982-AAB6-26C9B76BDD5F} = {8B927AB2-21F8-40DE-BE6B-5B1105453133}
306305
{A6BC7470-79A2-4C7E-923A-748540791D97} = {89D715BF-7464-45FB-8DA0-9D7B46AB8C7F}
307306
{B401A97F-FD61-4CC9-9392-26324A8E5461} = {89D715BF-7464-45FB-8DA0-9D7B46AB8C7F}
@@ -313,5 +312,6 @@ Global
313312
{0248BA8F-0351-4F9C-ACB3-7D9FE42A4CB1} = {BE946662-3884-45E9-A3B1-B28F3081AD1B}
314313
{4302B718-98DA-4922-84D6-6839495F4B71} = {BE946662-3884-45E9-A3B1-B28F3081AD1B}
315314
{F15ADA39-381E-4E5F-8E18-E08B51635016} = {BE946662-3884-45E9-A3B1-B28F3081AD1B}
315+
{F4448D3D-913D-4FE0-85F6-60F04EB7C134} = {8B927AB2-21F8-40DE-BE6B-5B1105453133}
316316
EndGlobalSection
317317
EndGlobal

examples/IBM.WatsonDeveloperCloud.Discovery.v1.Example/DiscoveryServiceExample.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class DiscoveryServiceExample
6262
#region Constructor
6363
public DiscoveryServiceExample(string url, string username, string password)
6464
{
65-
_discovery = new DiscoveryService(username, password, DiscoveryService.DISCOVERY_VERSION_DATE_2017_09_01);
65+
_discovery = new DiscoveryService(username, password, DiscoveryService.DISCOVERY_VERSION_DATE_2017_11_07);
6666
_discovery.Endpoint = url;
6767

6868
GetEnvironments();
@@ -128,7 +128,7 @@ public void GetEnvironments()
128128
{
129129
Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
130130

131-
foreach (ModelEnvironment environment in result.Environments)
131+
foreach (Model.Environment environment in result.Environments)
132132
{
133133
if (!(bool)environment._ReadOnly)
134134
{
@@ -256,7 +256,7 @@ private bool IsEnvironmentReady(string environmentId)
256256
var result = _discovery.GetEnvironment(environmentId);
257257
Console.WriteLine(string.Format("\tEnvironment {0} status is {1}.", environmentId, result.Status));
258258

259-
if (result.Status == ModelEnvironment.StatusEnum.ACTIVE)
259+
if (result.Status == Model.Environment.StatusEnum.ACTIVE)
260260
{
261261
autoEvent.Set();
262262
}
@@ -269,7 +269,7 @@ private bool IsEnvironmentReady(string environmentId)
269269
});
270270
}
271271

272-
return result.Status == ModelEnvironment.StatusEnum.ACTIVE;
272+
return result.Status == Model.Environment.StatusEnum.ACTIVE;
273273
}
274274
#endregion
275275

examples/IBM.WatsonDeveloperCloud.LanguageTranslator.v2.Example/LanguageTranslatorServiceExample.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class LanguageTranslatorServiceExample
2727
{
2828
private LanguageTranslatorService _languageTranslator;
2929
private string _glossaryPath = "glossary.tmx";
30-
private string _glossaryMimeType = "text/xml";
3130
private string _baseModel = "en-fr";
3231
private string _customModelName = "dotnetExampleModel";
3332
private string _customModelID = "en-fr";
@@ -74,7 +73,7 @@ private void CreateModel()
7473
{
7574
Console.WriteLine(string.Format("Calling CreateModel({0}, {1}, {2})...", _baseModel, _customModelName, _glossaryPath));
7675

77-
var result = _languageTranslator.CreateModel(_baseModel, _customModelName, forcedGlossary:fs, forcedGlossaryContentType:_glossaryMimeType);
76+
var result = _languageTranslator.CreateModel(_baseModel, _customModelName, forcedGlossary:fs);
7877

7978
if (result != null)
8079
{

examples/IBM.WatsonDeveloperCloud.NaturalLanguageUnderstanding.v1.Ex/NaturalLanguageUnderstandingExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private void ListModels()
285285
{
286286
if(result.Models != null && result.Models.Count > 0)
287287
{
288-
foreach(ModelModel model in result.Models)
288+
foreach(Model.Model model in result.Models)
289289
{
290290
Console.WriteLine(string.Format("Model id: {0} | status: {1} | language: {3} | description: {4}", model.ModelId, model.Status, model.Language, model.Description));
291291
}

examples/IBM.WatsonDeveloperCloud.PersonalityInsights.v3.Example/Program.cs

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,24 @@
1616
*/
1717

1818
using IBM.WatsonDeveloperCloud.PersonalityInsights.v3.Model;
19-
using IBM.WatsonDeveloperCloud.Util;
20-
using Newtonsoft.Json;
2119
using Newtonsoft.Json.Linq;
2220
using System;
2321
using System.Collections.Generic;
24-
using System.Threading.Tasks;
25-
22+
using System.IO;
23+
2624
namespace IBM.WatsonDeveloperCloud.PersonalityInsights.v3.Example
2725
{
2826
public class Program
2927
{
3028
public static void Main(string[] args)
31-
{
32-
string credentials = string.Empty;
33-
34-
try
35-
{
36-
credentials = Utility.SimpleGet(
37-
Environment.GetEnvironmentVariable("VCAP_URL"),
38-
Environment.GetEnvironmentVariable("VCAP_USERNAME"),
39-
Environment.GetEnvironmentVariable("VCAP_PASSWORD")).Result;
40-
}
41-
catch (Exception e)
42-
{
43-
Console.WriteLine(string.Format("Failed to get credentials: {0}", e.Message));
44-
}
45-
46-
Task.WaitAll();
47-
48-
var vcapServices = JObject.Parse(credentials);
49-
var _url = vcapServices["personality_insights"]["url"].Value<string>();
50-
var _username = vcapServices["personality_insights"]["username"].Value<string>();
51-
var _password = vcapServices["personality_insights"]["password"].Value<string>();
52-
53-
PersonalityInsightsService _personalityInsights = new PersonalityInsightsService(_username, _password, "2016-10-20");
54-
_personalityInsights.Endpoint = _url;
55-
29+
{
30+
var environmentVariable = Environment.GetEnvironmentVariable("VCAP_SERVICES");
31+
var fileContent = File.ReadAllText(environmentVariable);
32+
var vcapServices = JObject.Parse(fileContent);
33+
var _username = vcapServices["personality_insights"][0]["credentials"]["username"];
34+
var _password = vcapServices["personality_insights"][0]["credentials"]["password"];
35+
36+
PersonalityInsightsService _personalityInsights = new PersonalityInsightsService(_username.ToString(), _password.ToString(), "2016-10-20");
5637
string contentToProfile = "The IBM Watson™ Personality Insights service provides a Representational State Transfer (REST) Application Programming Interface (API) that enables applications to derive insights from social media, enterprise data, or other digital communications. The service uses linguistic analytics to infer individuals' intrinsic personality characteristics, including Big Five, Needs, and Values, from digital communications such as email, text messages, tweets, and forum posts. The service can automatically infer, from potentially noisy social media, portraits of individuals that reflect their personality characteristics. The service can report consumption preferences based on the results of its analysis, and for JSON content that is timestamped, it can report temporal behavior.";
5738

5839
// Test Profile
@@ -71,7 +52,7 @@ public static void Main(string[] args)
7152

7253
var result = _personalityInsights.Profile(content, "text/plain", acceptLanguage:"application/json", rawScores: true, consumptionPreferences:true, csvHeaders:true);
7354

74-
Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));
55+
Console.WriteLine(string.Format("Profile result: {0}", result));
7556

7657
Console.ReadKey();
7758
}

examples/IBM.WatsonDeveloperCloud.VisualRecognition.v3.Example/VisualRecognitionServiceExample.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,14 @@ public class VisualRecognitionServiceExample
3232
private string _imageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/Kittyply_edit1.jpg/1200px-Kittyply_edit1.jpg";
3333
private string _faceUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/8/8d/President_Barack_Obama.jpg/220px-President_Barack_Obama.jpg";
3434
private string _localGiraffeFilePath = @"VisualRecognitionTestData\giraffe_to_classify.jpg";
35-
private string _localImageMetadataPath = @"VisualRecognitionTestData\imageMetadata.json";
3635
private string _localFaceFilePath = @"VisualRecognitionTestData\obama.jpg";
37-
private string _localTurtleFilePath = @"VisualRecognitionTestData\turtle_to_classify.jpg";
3836
private string _localGiraffePositiveExamplesFilePath = @"VisualRecognitionTestData\giraffe_positive_examples.zip";
3937
private string _giraffeClassname = "giraffe";
4038
private string _localTurtlePositiveExamplesFilePath = @"VisualRecognitionTestData\turtle_positive_examples.zip";
4139
private string _turtleClassname = "turtle";
4240
private string _localNegativeExamplesFilePath = @"VisualRecognitionTestData\negative_examples.zip";
4341
private string _createdClassifierName = "dotnet-standard-test-classifier";
4442
private string _createdClassifierId = "";
45-
private string _collectionNameToCreate = "dotnet-standard-test-collection";
46-
private string _createdCollectionId = "";
47-
private string _addedImageId = "";
4843
AutoResetEvent autoEvent = new AutoResetEvent(false);
4944

5045
public VisualRecognitionServiceExample(string url, string apikey)

src/IBM.WatsonDeveloperCloud.Conversation.v1/ConversationService.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public WorkspaceCollection ListWorkspaces(long? pageLimit = null, bool? includeC
174174
return result;
175175
}
176176

177-
public Workspace UpdateWorkspace(string workspaceId, UpdateWorkspace properties = null)
177+
public Workspace UpdateWorkspace(string workspaceId, UpdateWorkspace properties = null, bool? append = null)
178178
{
179179
if (string.IsNullOrEmpty(workspaceId))
180180
throw new ArgumentNullException(nameof(workspaceId));
@@ -189,6 +189,7 @@ public Workspace UpdateWorkspace(string workspaceId, UpdateWorkspace properties
189189
result = this.Client.WithAuthentication(this.UserName, this.Password)
190190
.PostAsync($"{this.Endpoint}/v1/workspaces/{workspaceId}")
191191
.WithArgument("version", VersionDate)
192+
.WithArgument("append", append)
192193
.WithBody<UpdateWorkspace>(properties)
193194
.As<Workspace>()
194195
.Result;
@@ -1142,8 +1143,10 @@ public DialogNode UpdateDialogNode(string workspaceId, string dialogNode, Update
11421143

11431144
return result;
11441145
}
1145-
public LogCollection ListAllLogs(string sort = null, string filter = null, long? pageLimit = null, string cursor = null)
1146+
public LogCollection ListAllLogs(string filter, string sort = null, long? pageLimit = null, string cursor = null)
11461147
{
1148+
if (string.IsNullOrEmpty(filter))
1149+
throw new ArgumentNullException(nameof(filter));
11471150

11481151
if(string.IsNullOrEmpty(VersionDate))
11491152
throw new ArgumentNullException("versionDate cannot be null. Use 'CONVERSATION_VERSION_DATE_2017_05_26'");
@@ -1155,8 +1158,8 @@ public LogCollection ListAllLogs(string sort = null, string filter = null, long?
11551158
result = this.Client.WithAuthentication(this.UserName, this.Password)
11561159
.GetAsync($"{this.Endpoint}/v1/logs")
11571160
.WithArgument("version", VersionDate)
1158-
.WithArgument("sort", sort)
11591161
.WithArgument("filter", filter)
1162+
.WithArgument("sort", sort)
11601163
.WithArgument("page_limit", pageLimit)
11611164
.WithArgument("cursor", cursor)
11621165
.As<LogCollection>()
Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5-
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6-
</PropertyGroup>
7-
8-
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
9-
<PropertyGroup Label="Globals">
10-
<ProjectGuid>34f55944-7db0-4ec1-9600-9686c9dea071</ProjectGuid>
11-
<RootNamespace>IBM.WatsonDeveloperCloud.Conversation.v1</RootNamespace>
12-
<AssemblyName>IBM.WatsonDeveloperCloud.Conversation.v1</AssemblyName>
13-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
14-
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
15-
<TargetFrameworkVersion></TargetFrameworkVersion>
16-
</PropertyGroup>
17-
18-
<PropertyGroup>
19-
<SchemaVersion>2.0</SchemaVersion>
20-
</PropertyGroup>
21-
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
22-
</Project>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>34f55944-7db0-4ec1-9600-9686c9dea071</ProjectGuid>
10+
<RootNamespace>IBM.WatsonDeveloperCloud.Conversation.v1</RootNamespace>
11+
<AssemblyName>IBM.WatsonDeveloperCloud.Conversation.v1</AssemblyName>
12+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
13+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
14+
<TargetFrameworkVersion>
15+
</TargetFrameworkVersion>
16+
</PropertyGroup>
17+
<PropertyGroup>
18+
<SchemaVersion>2.0</SchemaVersion>
19+
</PropertyGroup>
20+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
21+
</Project>

0 commit comments

Comments
 (0)