Skip to content

Commit d80af19

Browse files
authored
Merge pull request #392 from watson-developer-cloud/7332-auth-methods
Update auth methods
2 parents e48dd4a + 39125aa commit d80af19

File tree

90 files changed

+2925
-4153
lines changed

Some content is hidden

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

90 files changed

+2925
-4153
lines changed

examples/IBM.Watson.Assistant.v1.Examples/ServiceExample.cs

Lines changed: 135 additions & 180 deletions
Large diffs are not rendered by default.

examples/IBM.Watson.Assistant.v2.Examples/IBM.Watson.Assistant.v2.Examples.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="IBM.Cloud.SDK.Core" Version="0.8.0" />
9+
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.0.0-rc3" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
13+
<!-- <ProjectReference Include="..\..\..\dotnet-sdk-core\src\IBM.Cloud.SDK.Core\IBM.Cloud.SDK.Core.csproj" /> -->
1314
<ProjectReference Include="..\..\src\IBM.Watson.Assistant.v2\IBM.Watson.Assistant.v2.csproj" />
1415
</ItemGroup>
1516

examples/IBM.Watson.Assistant.v2.Examples/ServiceExample.cs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ static void Main(string[] args)
4646
#region Sessions
4747
public void CreateSession()
4848
{
49-
IamConfig config = new IamConfig(
50-
apikey: "{apikey}"
51-
);
49+
IamAuthenticator authenticator = new IamAuthenticator(
50+
apikey: "{apikey}");
5251

53-
AssistantService service = new AssistantService("2019-02-28", config);
52+
AssistantService service = new AssistantService("2019-02-28", authenticator);
5453
service.SetEndpoint("{url}");
5554

56-
var result = service.CreateSession(
57-
assistantId: "{assistantId}"
55+
var result = service.CreateSession(
56+
assistantId: "{assistantId}"
5857
);
5958

6059
Console.WriteLine(result.Response);
@@ -64,16 +63,15 @@ public void CreateSession()
6463

6564
public void DeleteSession()
6665
{
67-
IamConfig config = new IamConfig(
68-
apikey: "{apikey}"
69-
);
66+
IamAuthenticator authenticator = new IamAuthenticator(
67+
apikey: "{apikey}");
7068

71-
AssistantService service = new AssistantService("2019-02-28", config);
69+
AssistantService service = new AssistantService("2019-02-28", authenticator);
7270
service.SetEndpoint("{url}");
7371

74-
var result = service.DeleteSession(
72+
var result = service.DeleteSession(
7573
assistantId: "{assistantId}",
76-
sessionId: "{sessionId}"
74+
sessionId: "{sessionId}"
7775
);
7876

7977
Console.WriteLine(result.Response);
@@ -83,11 +81,10 @@ public void DeleteSession()
8381
#region Message
8482
public void Message()
8583
{
86-
IamConfig config = new IamConfig(
87-
apikey: "{apikey}"
88-
);
84+
IamAuthenticator authenticator = new IamAuthenticator(
85+
apikey: "{apikey}");
8986

90-
AssistantService service = new AssistantService("2019-02-28", config);
87+
AssistantService service = new AssistantService("2019-02-28", authenticator);
9188
service.SetEndpoint("{url}");
9289

9390
var result = service.Message(
@@ -106,11 +103,10 @@ public void Message()
106103
#region Message with context
107104
public void MessageWithContext()
108105
{
109-
IamConfig config = new IamConfig(
110-
apikey: "{apikey}"
111-
);
106+
IamAuthenticator authenticator = new IamAuthenticator(
107+
apikey: "{apikey}");
112108

113-
AssistantService service = new AssistantService("2019-02-28", config);
109+
AssistantService service = new AssistantService("2019-02-28", authenticator);
114110
service.SetEndpoint("{url}");
115111

116112
MessageContextSkills skills = new MessageContextSkills();

examples/IBM.Watson.CompareComply.v1.Examples/IBM.Watson.CompareComply.v1.Examples.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="IBM.Cloud.SDK.Core" Version="0.8.0" />
9+
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.0.0-rc3" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
13+
<!-- <ProjectReference Include="..\..\..\dotnet-sdk-core\src\IBM.Cloud.SDK.Core\IBM.Cloud.SDK.Core.csproj" /> -->
1314
<ProjectReference Include="..\..\src\IBM.Watson.CompareComply.v1\IBM.Watson.CompareComply.v1.csproj" />
1415
</ItemGroup>
1516

examples/IBM.Watson.CompareComply.v1.Examples/ServiceExample.cs

Lines changed: 48 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ static void Main(string[] args)
6767
#region HTML Conversion
6868
public void ConvertToHtml()
6969
{
70-
IamConfig config = new IamConfig(
71-
apikey: "{apikey}"
72-
);
73-
74-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
70+
IamAuthenticator authenticator = new IamAuthenticator(
71+
apikey: "{apikey}");
72+
73+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
7574
service.SetEndpoint("{url}");
7675

7776
using (FileStream fs = File.OpenRead("{path-to-file}"))
@@ -94,11 +93,10 @@ public void ConvertToHtml()
9493
#region Element Classification
9594
public void ClassifyElements()
9695
{
97-
IamConfig config = new IamConfig(
98-
apikey: "{apikey}"
99-
);
100-
101-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
96+
IamAuthenticator authenticator = new IamAuthenticator(
97+
apikey: "{apikey}");
98+
99+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
102100
service.SetEndpoint("{url}");
103101

104102
using (FileStream fs = File.OpenRead("{path-to-file}"))
@@ -120,11 +118,10 @@ public void ClassifyElements()
120118
#region Tables
121119
public void ExtractTables()
122120
{
123-
IamConfig config = new IamConfig(
124-
apikey: "{apikey}"
125-
);
126-
127-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
121+
IamAuthenticator authenticator = new IamAuthenticator(
122+
apikey: "{apikey}");
123+
124+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
128125
service.SetEndpoint("{url}");
129126

130127
using (FileStream fs = File.OpenRead("{path-to-file}"))
@@ -146,11 +143,10 @@ public void ExtractTables()
146143
#region Comparision
147144
public void CompareDocuments()
148145
{
149-
IamConfig config = new IamConfig(
150-
apikey: "{apikey}"
151-
);
152-
153-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
146+
IamAuthenticator authenticator = new IamAuthenticator(
147+
apikey: "{apikey}");
148+
149+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
154150
service.SetEndpoint("{url}");
155151

156152
using (FileStream fs0 = File.OpenRead("{path-to-file-1}"))
@@ -183,11 +179,10 @@ public void CompareDocuments()
183179
#region Feedback
184180
public void ListFeedback()
185181
{
186-
IamConfig config = new IamConfig(
187-
apikey: "{apikey}"
188-
);
189-
190-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
182+
IamAuthenticator authenticator = new IamAuthenticator(
183+
apikey: "{apikey}");
184+
185+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
191186
service.SetEndpoint("{url}");
192187

193188
var result = service.ListFeedback();
@@ -197,11 +192,10 @@ public void ListFeedback()
197192

198193
public void AddFeedback()
199194
{
200-
IamConfig config = new IamConfig(
201-
apikey: "{apikey}"
202-
);
203-
204-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
195+
IamAuthenticator authenticator = new IamAuthenticator(
196+
apikey: "{apikey}");
197+
198+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
205199
service.SetEndpoint("{url}");
206200

207201
#region feedbackData
@@ -315,11 +309,10 @@ public void AddFeedback()
315309

316310
public void GetFeedback()
317311
{
318-
IamConfig config = new IamConfig(
319-
apikey: "{apikey}"
320-
);
321-
322-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
312+
IamAuthenticator authenticator = new IamAuthenticator(
313+
apikey: "{apikey}");
314+
315+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
323316
service.SetEndpoint("{url}");
324317

325318
var result = service.GetFeedback(
@@ -331,11 +324,10 @@ public void GetFeedback()
331324

332325
public void DeleteFeedback()
333326
{
334-
IamConfig config = new IamConfig(
335-
apikey: "{apikey}"
336-
);
337-
338-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
327+
IamAuthenticator authenticator = new IamAuthenticator(
328+
apikey: "{apikey}");
329+
330+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
339331
service.SetEndpoint("{url}");
340332

341333
var result = service.DeleteFeedback(
@@ -349,11 +341,10 @@ public void DeleteFeedback()
349341
#region Batches
350342
public void ListBatches()
351343
{
352-
IamConfig config = new IamConfig(
353-
apikey: "{apikey}"
354-
);
355-
356-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
344+
IamAuthenticator authenticator = new IamAuthenticator(
345+
apikey: "{apikey}");
346+
347+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
357348
service.SetEndpoint("{url}");
358349

359350
var result = service.ListBatches();
@@ -363,11 +354,10 @@ public void ListBatches()
363354

364355
public void CreateBatch()
365356
{
366-
IamConfig config = new IamConfig(
367-
apikey: "{apikey}"
368-
);
369-
370-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
357+
IamAuthenticator authenticator = new IamAuthenticator(
358+
apikey: "{apikey}");
359+
360+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
371361
service.SetEndpoint("{url}");
372362

373363
using (FileStream fsInput = File.OpenRead("{object-storage-input-credentials-filepath}"))
@@ -400,11 +390,10 @@ public void CreateBatch()
400390

401391
public void GetBatch()
402392
{
403-
IamConfig config = new IamConfig(
404-
apikey: "{apikey}"
405-
);
406-
407-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
393+
IamAuthenticator authenticator = new IamAuthenticator(
394+
apikey: "{apikey}");
395+
396+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
408397
service.SetEndpoint("{url}");
409398

410399
var result = service.GetBatch(
@@ -416,11 +405,10 @@ public void GetBatch()
416405

417406
public void UpdateBatch()
418407
{
419-
IamConfig config = new IamConfig(
420-
apikey: "{apikey}"
421-
);
422-
423-
CompareComplyService service = new CompareComplyService("2018-10-15", config);
408+
IamAuthenticator authenticator = new IamAuthenticator(
409+
apikey: "{apikey}");
410+
411+
CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);
424412
service.SetEndpoint("{url}");
425413

426414
var result = service.UpdateBatch(

examples/IBM.Watson.Discovery.v1.Examples/IBM.Watson.Discovery.v1.Examples.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="IBM.Cloud.SDK.Core" Version="0.8.0" />
9+
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.0.0-rc3" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
@@ -16,6 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19+
<!-- <ProjectReference Include="..\..\..\dotnet-sdk-core\src\IBM.Cloud.SDK.Core\IBM.Cloud.SDK.Core.csproj" /> -->
1920
<ProjectReference Include="..\..\src\IBM.Watson.Discovery.v1\IBM.Watson.Discovery.v1.csproj" />
2021
</ItemGroup>
2122

0 commit comments

Comments
 (0)