Skip to content

Commit eaec06c

Browse files
committed
feat(regenerate): regenerate services to include model and connector changes
1 parent 1dcc5d2 commit eaec06c

File tree

13 files changed

+267
-1107
lines changed

13 files changed

+267
-1107
lines changed

Scripts/Services/Assistant/V1/AssistantService.cs

Lines changed: 52 additions & 130 deletions
Large diffs are not rendered by default.

Scripts/Services/Assistant/V2/AssistantService.cs

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,7 @@ namespace IBM.Watson.Assistant.V2
3232
public partial class AssistantService : BaseService
3333
{
3434
private const string serviceId = "assistant";
35-
private const string defaultUrl = "https://gateway.watsonplatform.net/assistant/api";
36-
37-
#region Authenticator
38-
/// <summary>
39-
/// Gets and sets the authenticator of the service. Replace the default endpoint if endpoint is defined.
40-
/// </summary>
41-
public Authenticator Authenticator
42-
{
43-
get { return authenticator; }
44-
set
45-
{
46-
authenticator = value;
47-
}
48-
}
49-
#endregion
50-
51-
#region Url
52-
/// <summary>
53-
/// Gets and sets the endpoint URL for the service.
54-
/// </summary>
55-
public string Url
56-
{
57-
get { return url; }
58-
set { url = value; }
59-
}
60-
#endregion
35+
private const string defaultServiceUrl = "https://gateway.watsonplatform.net/assistant/api";
6136

6237
#region VersionDate
6338
private string versionDate;
@@ -96,6 +71,7 @@ public AssistantService(string versionDate) : this(versionDate, ConfigBasedAuthe
9671
/// <param name="authenticator">The service authenticator.</param>
9772
public AssistantService(string versionDate, Authenticator authenticator) : base(versionDate, authenticator, serviceId)
9873
{
74+
Authenticator = authenticator;
9975
if (string.IsNullOrEmpty(versionDate))
10076
{
10177
throw new ArgumentNullException("A versionDate (format `yyyy-mm-dd`) is required to create an instance of AssistantService");
@@ -105,19 +81,10 @@ public AssistantService(string versionDate, Authenticator authenticator) : base(
10581
VersionDate = versionDate;
10682
}
10783

108-
if (authenticator != null)
109-
{
110-
Authenticator = authenticator;
11184

112-
if (string.IsNullOrEmpty(Url))
113-
{
114-
Authenticator.Url = defaultUrl;
115-
}
116-
Authenticator.Url = Url;
117-
}
118-
else
85+
if (string.IsNullOrEmpty(GetServiceUrl()))
11986
{
120-
throw new IBMException("Please provide a username and password or authorization token to use the Assistant service. For more information, see https://github.com/watson-developer-cloud/unity-sdk/#configuring-your-service-credentials");
87+
SetServiceUrl(defaultServiceUrl);
12188
}
12289
}
12390

@@ -165,12 +132,11 @@ public bool CreateSession(Callback<SessionResponse> callback, string assistantId
165132

166133
req.OnResponse = OnCreateSessionResponse;
167134

168-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions", assistantId));
135+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions", assistantId), GetServiceUrl());
169136
if (connector == null)
170137
{
171138
return false;
172139
}
173-
Authenticator.Authenticate(connector);
174140

175141
return connector.Send(req);
176142
}
@@ -245,12 +211,11 @@ public bool DeleteSession(Callback<object> callback, string assistantId, string
245211

246212
req.OnResponse = OnDeleteSessionResponse;
247213

248-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId));
214+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId), GetServiceUrl());
249215
if (connector == null)
250216
{
251217
return false;
252218
}
253-
Authenticator.Authenticate(connector);
254219

255220
return connector.Send(req);
256221
}
@@ -340,12 +305,11 @@ public bool Message(Callback<MessageResponse> callback, string assistantId, stri
340305

341306
req.OnResponse = OnMessageResponse;
342307

343-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId));
308+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId), GetServiceUrl());
344309
if (connector == null)
345310
{
346311
return false;
347312
}
348-
Authenticator.Authenticate(connector);
349313

350314
return connector.Send(req);
351315
}

Scripts/Services/CompareComply/V1/CompareComplyService.cs

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,7 @@ namespace IBM.Watson.CompareComply.V1
3232
public partial class CompareComplyService : BaseService
3333
{
3434
private const string serviceId = "compare_comply";
35-
private const string defaultUrl = "https://gateway.watsonplatform.net/compare-comply/api";
36-
37-
#region Authenticator
38-
/// <summary>
39-
/// Gets and sets the authenticator of the service. Replace the default endpoint if endpoint is defined.
40-
/// </summary>
41-
public Authenticator Authenticator
42-
{
43-
get { return authenticator; }
44-
set
45-
{
46-
authenticator = value;
47-
}
48-
}
49-
#endregion
50-
51-
#region Url
52-
/// <summary>
53-
/// Gets and sets the endpoint URL for the service.
54-
/// </summary>
55-
public string Url
56-
{
57-
get { return url; }
58-
set { url = value; }
59-
}
60-
#endregion
35+
private const string defaultServiceUrl = "https://gateway.watsonplatform.net/compare-comply/api";
6136

6237
#region VersionDate
6338
private string versionDate;
@@ -96,6 +71,7 @@ public CompareComplyService(string versionDate) : this(versionDate, ConfigBasedA
9671
/// <param name="authenticator">The service authenticator.</param>
9772
public CompareComplyService(string versionDate, Authenticator authenticator) : base(versionDate, authenticator, serviceId)
9873
{
74+
Authenticator = authenticator;
9975
if (string.IsNullOrEmpty(versionDate))
10076
{
10177
throw new ArgumentNullException("A versionDate (format `yyyy-mm-dd`) is required to create an instance of CompareComplyService");
@@ -105,19 +81,10 @@ public CompareComplyService(string versionDate, Authenticator authenticator) : b
10581
VersionDate = versionDate;
10682
}
10783

108-
if (authenticator != null)
109-
{
110-
Authenticator = authenticator;
11184

112-
if (string.IsNullOrEmpty(Url))
113-
{
114-
Authenticator.Url = defaultUrl;
115-
}
116-
Authenticator.Url = Url;
117-
}
118-
else
85+
if (string.IsNullOrEmpty(GetServiceUrl()))
11986
{
120-
throw new IBMException("Please provide a username and password or authorization token to use the CompareComply service. For more information, see https://github.com/watson-developer-cloud/unity-sdk/#configuring-your-service-credentials");
87+
SetServiceUrl(defaultServiceUrl);
12188
}
12289
}
12390

@@ -173,12 +140,11 @@ public bool ConvertToHtml(Callback<HTMLReturn> callback, System.IO.MemoryStream
173140

174141
req.OnResponse = OnConvertToHtmlResponse;
175142

176-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/html_conversion");
143+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/html_conversion", GetServiceUrl());
177144
if (connector == null)
178145
{
179146
return false;
180147
}
181-
Authenticator.Authenticate(connector);
182148

183149
return connector.Send(req);
184150
}
@@ -259,12 +225,11 @@ public bool ClassifyElements(Callback<ClassifyReturn> callback, System.IO.Memory
259225

260226
req.OnResponse = OnClassifyElementsResponse;
261227

262-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/element_classification");
228+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/element_classification", GetServiceUrl());
263229
if (connector == null)
264230
{
265231
return false;
266232
}
267-
Authenticator.Authenticate(connector);
268233

269234
return connector.Send(req);
270235
}
@@ -345,12 +310,11 @@ public bool ExtractTables(Callback<TableReturn> callback, System.IO.MemoryStream
345310

346311
req.OnResponse = OnExtractTablesResponse;
347312

348-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/tables");
313+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/tables", GetServiceUrl());
349314
if (connector == null)
350315
{
351316
return false;
352317
}
353-
Authenticator.Authenticate(connector);
354318

355319
return connector.Send(req);
356320
}
@@ -449,12 +413,11 @@ public bool CompareDocuments(Callback<CompareReturn> callback, System.IO.MemoryS
449413

450414
req.OnResponse = OnCompareDocumentsResponse;
451415

452-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/comparison");
416+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/comparison", GetServiceUrl());
453417
if (connector == null)
454418
{
455419
return false;
456420
}
457-
Authenticator.Authenticate(connector);
458421

459422
return connector.Send(req);
460423
}
@@ -537,12 +500,11 @@ public bool AddFeedback(Callback<FeedbackReturn> callback, FeedbackDataInput fee
537500

538501
req.OnResponse = OnAddFeedbackResponse;
539502

540-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback");
503+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", GetServiceUrl());
541504
if (connector == null)
542505
{
543506
return false;
544507
}
545-
Authenticator.Authenticate(connector);
546508

547509
return connector.Send(req);
548510
}
@@ -710,12 +672,11 @@ public bool ListFeedback(Callback<FeedbackList> callback, string feedbackType =
710672

711673
req.OnResponse = OnListFeedbackResponse;
712674

713-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback");
675+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", GetServiceUrl());
714676
if (connector == null)
715677
{
716678
return false;
717679
}
718-
Authenticator.Authenticate(connector);
719680

720681
return connector.Send(req);
721682
}
@@ -790,12 +751,11 @@ public bool GetFeedback(Callback<GetFeedback> callback, string feedbackId, strin
790751

791752
req.OnResponse = OnGetFeedbackResponse;
792753

793-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId));
754+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), GetServiceUrl());
794755
if (connector == null)
795756
{
796757
return false;
797758
}
798-
Authenticator.Authenticate(connector);
799759

800760
return connector.Send(req);
801761
}
@@ -870,12 +830,11 @@ public bool DeleteFeedback(Callback<FeedbackDeleted> callback, string feedbackId
870830

871831
req.OnResponse = OnDeleteFeedbackResponse;
872832

873-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId));
833+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), GetServiceUrl());
874834
if (connector == null)
875835
{
876836
return false;
877837
}
878-
Authenticator.Authenticate(connector);
879838

880839
return connector.Send(req);
881840
}
@@ -1010,12 +969,11 @@ public bool CreateBatch(Callback<BatchStatus> callback, string function, System.
1010969

1011970
req.OnResponse = OnCreateBatchResponse;
1012971

1013-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches");
972+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", GetServiceUrl());
1014973
if (connector == null)
1015974
{
1016975
return false;
1017976
}
1018-
Authenticator.Authenticate(connector);
1019977

1020978
return connector.Send(req);
1021979
}
@@ -1079,12 +1037,11 @@ public bool ListBatches(Callback<Batches> callback)
10791037

10801038
req.OnResponse = OnListBatchesResponse;
10811039

1082-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches");
1040+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", GetServiceUrl());
10831041
if (connector == null)
10841042
{
10851043
return false;
10861044
}
1087-
Authenticator.Authenticate(connector);
10881045

10891046
return connector.Send(req);
10901047
}
@@ -1151,12 +1108,11 @@ public bool GetBatch(Callback<BatchStatus> callback, string batchId)
11511108

11521109
req.OnResponse = OnGetBatchResponse;
11531110

1154-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId));
1111+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), GetServiceUrl());
11551112
if (connector == null)
11561113
{
11571114
return false;
11581115
}
1159-
Authenticator.Authenticate(connector);
11601116

11611117
return connector.Send(req);
11621118
}
@@ -1239,12 +1195,11 @@ public bool UpdateBatch(Callback<BatchStatus> callback, string batchId, string a
12391195

12401196
req.OnResponse = OnUpdateBatchResponse;
12411197

1242-
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId));
1198+
RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), GetServiceUrl());
12431199
if (connector == null)
12441200
{
12451201
return false;
12461202
}
1247-
Authenticator.Authenticate(connector);
12481203

12491204
return connector.Send(req);
12501205
}

0 commit comments

Comments
 (0)