Skip to content

Commit a2cd70f

Browse files
committed
feat(Regeneration): Regenerate with generator 2.0.0 and api definition sdk-2019-11-19
1 parent d5ac13e commit a2cd70f

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/IBM.Watson.Discovery.v2/DiscoveryService.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ public DetailedResponse<object> DeleteTrainingQueries(string projectId)
940940
/// Discovery administrative tooling.</param>
941941
/// <param name="trainingQuery">An object that represents the query to be submitted. (optional)</param>
942942
/// <returns><see cref="TrainingQuery" />TrainingQuery</returns>
943-
public DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, string naturalLanguageQuery = null, string filter = null, List<TrainingExample> examples = null)
943+
public DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)
944944
{
945945
if (string.IsNullOrEmpty(projectId))
946946
{
@@ -974,14 +974,14 @@ public DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, str
974974
{
975975
bodyObject["natural_language_query"] = naturalLanguageQuery;
976976
}
977-
if (!string.IsNullOrEmpty(filter))
978-
{
979-
bodyObject["filter"] = filter;
980-
}
981977
if (examples != null && examples.Count > 0)
982978
{
983979
bodyObject["examples"] = JToken.FromObject(examples);
984980
}
981+
if (!string.IsNullOrEmpty(filter))
982+
{
983+
bodyObject["filter"] = filter;
984+
}
985985
var httpContent = new StringContent(JsonConvert.SerializeObject(bodyObject), Encoding.UTF8, HttpMediaType.APPLICATION_JSON);
986986
restRequest.WithBodyContent(httpContent);
987987

@@ -1076,7 +1076,7 @@ public DetailedResponse<TrainingQuery> GetTrainingQuery(string projectId, string
10761076
/// <param name="queryId">The ID of the query used for training.</param>
10771077
/// <param name="body">The body of the example that is to be added to the specified query.</param>
10781078
/// <returns><see cref="TrainingQuery" />TrainingQuery</returns>
1079-
public DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery = null, string filter = null, List<TrainingExample> examples = null)
1079+
public DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null)
10801080
{
10811081
if (string.IsNullOrEmpty(projectId))
10821082
{
@@ -1094,6 +1094,14 @@ public DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, str
10941094
{
10951095
queryId = Uri.EscapeDataString(queryId);
10961096
}
1097+
if (string.IsNullOrEmpty(naturalLanguageQuery))
1098+
{
1099+
throw new ArgumentNullException("`naturalLanguageQuery` is required for `UpdateTrainingQuery`");
1100+
}
1101+
if (examples == null)
1102+
{
1103+
throw new ArgumentNullException("`examples` is required for `UpdateTrainingQuery`");
1104+
}
10971105

10981106
if (string.IsNullOrEmpty(VersionDate))
10991107
{
@@ -1118,14 +1126,14 @@ public DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, str
11181126
{
11191127
bodyObject["natural_language_query"] = naturalLanguageQuery;
11201128
}
1121-
if (!string.IsNullOrEmpty(filter))
1122-
{
1123-
bodyObject["filter"] = filter;
1124-
}
11251129
if (examples != null && examples.Count > 0)
11261130
{
11271131
bodyObject["examples"] = JToken.FromObject(examples);
11281132
}
1133+
if (!string.IsNullOrEmpty(filter))
1134+
{
1135+
bodyObject["filter"] = filter;
1136+
}
11291137
var httpContent = new StringContent(JsonConvert.SerializeObject(bodyObject), Encoding.UTF8, HttpMediaType.APPLICATION_JSON);
11301138
restRequest.WithBodyContent(httpContent);
11311139

src/IBM.Watson.Discovery.v2/IDiscoveryService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public partial interface IDiscoveryService
3434
DetailedResponse<DeleteDocumentResponse> DeleteDocument(string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null);
3535
DetailedResponse<TrainingQuerySet> ListTrainingQueries(string projectId);
3636
DetailedResponse<object> DeleteTrainingQueries(string projectId);
37-
DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, string naturalLanguageQuery = null, string filter = null, List<TrainingExample> examples = null);
37+
DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null);
3838
DetailedResponse<TrainingQuery> GetTrainingQuery(string projectId, string queryId);
39-
DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery = null, string filter = null, List<TrainingExample> examples = null);
39+
DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null);
4040
}
4141
}

0 commit comments

Comments
 (0)