Skip to content

Commit

Permalink
feat(discovery-v1): document status & query aggregation update
Browse files Browse the repository at this point in the history
DocumentStatus: documentID, status, and statusDescription are now optional. QueryAggregation:
BREAKING QueryAggregation subclasses changed.

BREAKING CHANGE: QueryAggregation: BREAKING QueryAggregation subclasses changed.
  • Loading branch information
kevinkowa committed Mar 21, 2022
1 parent 03c3646 commit 97a432e
Show file tree
Hide file tree
Showing 16 changed files with 547 additions and 48 deletions.
8 changes: 4 additions & 4 deletions Scripts/Services/Discovery/V1/DiscoveryService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2019, 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

/**
* IBM OpenAPI SDK Code Generator Version: 3.38.0-07189efd-20210827-205025
* IBM OpenAPI SDK Code Generator Version: 3.46.0-a4e29da0-20220224-210428
*/

using System.Collections.Generic;
Expand Down Expand Up @@ -363,8 +363,8 @@ private void OnGetEnvironmentResponse(RESTConnector.Request req, RESTConnector.R
/// <param name="environmentId">The ID of the environment.</param>
/// <param name="name">Name that identifies the environment. (optional, default to )</param>
/// <param name="description">Description of the environment. (optional, default to )</param>
/// <param name="size">Size that the environment should be increased to. Environment size cannot be modified
/// when using a Lite plan. Environment size can only increased and not decreased. (optional)</param>
/// <param name="size">Size to change the environment to. **Note:** Lite plan users cannot change the
/// environment size. (optional)</param>
/// <returns><see cref="ModelEnvironment" />ModelEnvironment</returns>
public bool UpdateEnvironment(Callback<ModelEnvironment> callback, string environmentId, string name = null, string description = null, string size = null)
{
Expand Down
19 changes: 9 additions & 10 deletions Scripts/Services/Discovery/V1/Model/Enrichment.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2019, 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,15 +51,10 @@ public class Enrichment
[JsonProperty("overwrite", NullValueHandling = NullValueHandling.Ignore)]
public bool? Overwrite { get; set; }
/// <summary>
/// Name of the enrichment service to call. Current options are `natural_language_understanding` and `elements`.
/// Name of the enrichment service to call. The only supported option is `natural_language_understanding`. The
/// `elements` option is deprecated and support ended on 10 July 2020.
///
/// When using `natual_language_understanding`, the **options** object must contain Natural Language
/// Understanding options.
///
/// When using `elements` the **options** object must contain Element Classification options. Additionally, when
/// using the `elements` enrichment the configuration specified and files ingested must meet all the criteria
/// specified in [the
/// documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-element-classification#element-classification).
/// The **options** object must contain Natural Language Understanding options.
/// </summary>
[JsonProperty("enrichment", NullValueHandling = NullValueHandling.Ignore)]
public string _Enrichment { get; set; }
Expand All @@ -70,7 +65,11 @@ public class Enrichment
[JsonProperty("ignore_downstream_errors", NullValueHandling = NullValueHandling.Ignore)]
public bool? IgnoreDownstreamErrors { get; set; }
/// <summary>
/// Options which are specific to a particular enrichment.
/// Options that are specific to a particular enrichment.
///
/// The `elements` enrichment type is deprecated. Use the [Create a
/// project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2 API to
/// create a `content_intelligence` project type instead.
/// </summary>
[JsonProperty("options", NullValueHandling = NullValueHandling.Ignore)]
public EnrichmentOptions Options { get; set; }
Expand Down
11 changes: 7 additions & 4 deletions Scripts/Services/Discovery/V1/Model/EnrichmentOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2019, 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,11 @@
namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// Options which are specific to a particular enrichment.
/// Options that are specific to a particular enrichment.
///
/// The `elements` enrichment type is deprecated. Use the [Create a
/// project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2 API to create a
/// `content_intelligence` project type instead.
/// </summary>
public class EnrichmentOptions
{
Expand Down Expand Up @@ -86,8 +90,7 @@ public class LanguageValue
[JsonProperty("features", NullValueHandling = NullValueHandling.Ignore)]
public NluEnrichmentFeatures Features { get; set; }
/// <summary>
/// For use with `elements` enrichments only. The element extraction model to use. The only model available is
/// `contract`.
/// The element extraction model to use, which can be `contract` only. The `elements` enrichment is deprecated.
/// </summary>
[JsonProperty("model", NullValueHandling = NullValueHandling.Ignore)]
public string Model { get; set; }
Expand Down
40 changes: 12 additions & 28 deletions Scripts/Services/Discovery/V1/Model/QueryAggregation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2019, 2021.
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
*
*/

using System.Collections.Generic;
using JsonSubTypes;
using Newtonsoft.Json;

Expand All @@ -25,38 +24,23 @@ namespace IBM.Watson.Discovery.V1.Model
/// An aggregation produced by Discovery to analyze the input provided.
/// </summary>
[JsonConverter(typeof(JsonSubtypes), "type")]
[JsonSubtypes.KnownSubType(typeof(Histogram), "histogram")]
[JsonSubtypes.KnownSubType(typeof(Calculation), "max")]
[JsonSubtypes.KnownSubType(typeof(Calculation), "min")]
[JsonSubtypes.KnownSubType(typeof(Calculation), "average")]
[JsonSubtypes.KnownSubType(typeof(Calculation), "sum")]
[JsonSubtypes.KnownSubType(typeof(Calculation), "unique_count")]
[JsonSubtypes.KnownSubType(typeof(Term), "term")]
[JsonSubtypes.KnownSubType(typeof(Filter), "filter")]
[JsonSubtypes.KnownSubType(typeof(Nested), "nested")]
[JsonSubtypes.KnownSubType(typeof(Timeslice), "timeslice")]
[JsonSubtypes.KnownSubType(typeof(TopHits), "top_hits")]
[JsonSubtypes.KnownSubType(typeof(QueryHistogramAggregation), "histogram")]
[JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "max")]
[JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "min")]
[JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "average")]
[JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "sum")]
[JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "unique_count")]
[JsonSubtypes.KnownSubType(typeof(QueryTermAggregation), "term")]
[JsonSubtypes.KnownSubType(typeof(QueryFilterAggregation), "filter")]
[JsonSubtypes.KnownSubType(typeof(QueryNestedAggregation), "nested")]
[JsonSubtypes.KnownSubType(typeof(QueryTimesliceAggregation), "timeslice")]
[JsonSubtypes.KnownSubType(typeof(QueryTopHitsAggregation), "top_hits")]
public class QueryAggregation
{
/// <summary>
/// The type of aggregation command used. For example: term, filter, max, min, etc.
/// </summary>
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
public string Type { get; set; }
/// <summary>
/// Array of aggregation results.
/// </summary>
[JsonProperty("results", NullValueHandling = NullValueHandling.Ignore)]
public List<AggregationResult> Results { get; set; }
/// <summary>
/// Number of matching results.
/// </summary>
[JsonProperty("matching_results", NullValueHandling = NullValueHandling.Ignore)]
public long? MatchingResults { get; set; }
/// <summary>
/// Aggregations returned by Discovery.
/// </summary>
[JsonProperty("aggregations", NullValueHandling = NullValueHandling.Ignore)]
public List<QueryAggregation> Aggregations { get; set; }
}
}
39 changes: 39 additions & 0 deletions Scripts/Services/Discovery/V1/Model/QueryCalculationAggregation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using Newtonsoft.Json;

namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// Returns a scalar calculation across all documents for the field specified. Possible calculations include min,
/// max, sum, average, and unique_count.
/// </summary>
public class QueryCalculationAggregation : QueryAggregation
{
/// <summary>
/// The field to perform the calculation on.
/// </summary>
[JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)]
public string Field { get; set; }
/// <summary>
/// The value of the calculation.
/// </summary>
[JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
public double? Value { get; set; }
}
}
45 changes: 45 additions & 0 deletions Scripts/Services/Discovery/V1/Model/QueryFilterAggregation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// A modifier that narrows the document set of the sub-aggregations it precedes.
/// </summary>
public class QueryFilterAggregation : QueryAggregation
{
/// <summary>
/// The filter that is written in Discovery Query Language syntax and is applied to the documents before
/// sub-aggregations are run.
/// </summary>
[JsonProperty("match", NullValueHandling = NullValueHandling.Ignore)]
public string Match { get; set; }
/// <summary>
/// Number of documents that match the filter.
/// </summary>
[JsonProperty("matching_results", NullValueHandling = NullValueHandling.Ignore)]
public long? MatchingResults { get; set; }
/// <summary>
/// An array of sub-aggregations.
/// </summary>
[JsonProperty("aggregations", NullValueHandling = NullValueHandling.Ignore)]
public List<QueryAggregation> Aggregations { get; set; }
}
}
50 changes: 50 additions & 0 deletions Scripts/Services/Discovery/V1/Model/QueryHistogramAggregation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// Numeric interval segments to categorize documents by using field values from a single numeric field to describe
/// the category.
/// </summary>
public class QueryHistogramAggregation : QueryAggregation
{
/// <summary>
/// The numeric field name used to create the histogram.
/// </summary>
[JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)]
public string Field { get; set; }
/// <summary>
/// The size of the sections that the results are split into.
/// </summary>
[JsonProperty("interval", NullValueHandling = NullValueHandling.Ignore)]
public long? Interval { get; set; }
/// <summary>
/// Identifier specified in the query request of this aggregation.
/// </summary>
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
/// <summary>
/// Array of numeric intervals.
/// </summary>
[JsonProperty("results", NullValueHandling = NullValueHandling.Ignore)]
public List<QueryHistogramAggregationResult> Results { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// Histogram numeric interval result.
/// </summary>
public class QueryHistogramAggregationResult
{
/// <summary>
/// The value of the upper bound for the numeric segment.
/// </summary>
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
public long? Key { get; set; }
/// <summary>
/// Number of documents with the specified key as the upper bound.
/// </summary>
[JsonProperty("matching_results", NullValueHandling = NullValueHandling.Ignore)]
public long? MatchingResults { get; set; }
/// <summary>
/// An array of sub-aggregations.
/// </summary>
[JsonProperty("aggregations", NullValueHandling = NullValueHandling.Ignore)]
public List<QueryAggregation> Aggregations { get; set; }
}
}
45 changes: 45 additions & 0 deletions Scripts/Services/Discovery/V1/Model/QueryNestedAggregation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Discovery.V1.Model
{
/// <summary>
/// A restriction that alters the document set that is used for sub-aggregations it precedes to nested documents
/// found in the field specified.
/// </summary>
public class QueryNestedAggregation : QueryAggregation
{
/// <summary>
/// The path to the document field to scope sub-aggregations to.
/// </summary>
[JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)]
public string Path { get; set; }
/// <summary>
/// Number of nested documents found in the specified field.
/// </summary>
[JsonProperty("matching_results", NullValueHandling = NullValueHandling.Ignore)]
public long? MatchingResults { get; set; }
/// <summary>
/// An array of sub-aggregations.
/// </summary>
[JsonProperty("aggregations", NullValueHandling = NullValueHandling.Ignore)]
public List<QueryAggregation> Aggregations { get; set; }
}
}
Loading

0 comments on commit 97a432e

Please sign in to comment.