Skip to content

Commit

Permalink
feat(discovery-v2): update models and add new methods
Browse files Browse the repository at this point in the history
NEW methods: listDocuments, getDocument, listDocumentClassifiers, createDocumentClassifier,
getDocumentClassifier, updateDocumentClassifier, deleteDocumentClassifier,
listDocumentClassifierModels, createDocumentClassifierModels, getDocumentClassifierModels,
updateDocumentClassifierModels, deleteDocumentClassifierModels, getStopwordList, createStopwordList,
deleteStopwordList, listExpansions, createExpansions, deleteExpansions
  • Loading branch information
kevinkowa committed Aug 9, 2022
1 parent fb05fb6 commit 495295f
Show file tree
Hide file tree
Showing 43 changed files with 3,834 additions and 851 deletions.
3,108 changes: 2,316 additions & 792 deletions src/IBM.Watson.Discovery.v2/DiscoveryService.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.2.0" />
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/IBM.Watson.Discovery.v2/IBM.Watson.Discovery.v2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.2.0" />
<PackageReference Include="IBM.Cloud.SDK.Core" Version="1.3.1" />
<PackageReference Include="IBM.Watson.Common" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="JsonSubTypes" Version="1.6.0" />
Expand Down
44 changes: 31 additions & 13 deletions src/IBM.Watson.Discovery.v2/IDiscoveryService.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 @@ -23,37 +23,55 @@ namespace IBM.Watson.Discovery.v2
{
public partial interface IDiscoveryService
{
DetailedResponse<ListProjectsResponse> ListProjects();
DetailedResponse<ProjectDetails> CreateProject(string name, string type, DefaultQueryParams defaultQueryParameters = null);
DetailedResponse<ProjectDetails> GetProject(string projectId);
DetailedResponse<ProjectDetails> UpdateProject(string projectId, string name = null);
DetailedResponse<object> DeleteProject(string projectId);
DetailedResponse<ListFieldsResponse> ListFields(string projectId, List<string> collectionIds = null);
DetailedResponse<ListCollectionsResponse> ListCollections(string projectId);
DetailedResponse<CollectionDetails> CreateCollection(string projectId, string name, string description = null, string language = null, List<CollectionEnrichment> enrichments = null);
DetailedResponse<CollectionDetails> CreateCollection(string projectId, string name, string description = null, string language = null, List<CollectionEnrichment> enrichments = null, CollectionDetailsSmartDocumentUnderstanding smartDocumentUnderstanding = null);
DetailedResponse<CollectionDetails> GetCollection(string projectId, string collectionId);
DetailedResponse<CollectionDetails> UpdateCollection(string projectId, string collectionId, string name = null, string description = null, List<CollectionEnrichment> enrichments = null);
DetailedResponse<object> DeleteCollection(string projectId, string collectionId);
DetailedResponse<QueryResponse> Query(string projectId, List<string> collectionIds = null, string filter = null, string query = null, string naturalLanguageQuery = null, string aggregation = null, long? count = null, List<string> _return = null, long? offset = null, string sort = null, bool? highlight = null, bool? spellingSuggestions = null, QueryLargeTableResults tableResults = null, QueryLargeSuggestedRefinements suggestedRefinements = null, QueryLargePassages passages = null);
DetailedResponse<ListDocumentsResponse> ListDocuments(string projectId, string collectionId, long? count = null, string status = null, bool? hasNotices = null, bool? isParent = null, string parentDocumentId = null, string sha256 = null);
DetailedResponse<DocumentAccepted> AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null);
DetailedResponse<DocumentDetails> GetDocument(string projectId, string collectionId, string documentId);
DetailedResponse<DocumentAccepted> UpdateDocument(string projectId, string collectionId, string documentId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null);
DetailedResponse<DeleteDocumentResponse> DeleteDocument(string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null);
DetailedResponse<QueryResponse> Query(string projectId, List<string> collectionIds = null, string filter = null, string query = null, string naturalLanguageQuery = null, string aggregation = null, long? count = null, List<string> _return = null, long? offset = null, string sort = null, bool? highlight = null, bool? spellingSuggestions = null, QueryLargeTableResults tableResults = null, QueryLargeSuggestedRefinements suggestedRefinements = null, QueryLargePassages passages = null, QueryLargeSimilar similar = null);
DetailedResponse<Completions> GetAutocompletion(string projectId, string prefix, List<string> collectionIds = null, string field = null, long? count = null);
DetailedResponse<QueryNoticesResponse> QueryCollectionNotices(string projectId, string collectionId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null);
DetailedResponse<QueryNoticesResponse> QueryNotices(string projectId, string filter = null, string query = null, string naturalLanguageQuery = null, long? count = null, long? offset = null);
DetailedResponse<ListFieldsResponse> ListFields(string projectId, List<string> collectionIds = null);
DetailedResponse<StopWordList> GetStopwordList(string projectId, string collectionId);
DetailedResponse<StopWordList> CreateStopwordList(string projectId, string collectionId, List<string> stopwords = null);
DetailedResponse<object> DeleteStopwordList(string projectId, string collectionId);
DetailedResponse<Expansions> ListExpansions(string projectId, string collectionId);
DetailedResponse<Expansions> CreateExpansions(string projectId, string collectionId, List<Expansion> expansions);
DetailedResponse<object> DeleteExpansions(string projectId, string collectionId);
DetailedResponse<ComponentSettingsResponse> GetComponentSettings(string projectId);
DetailedResponse<DocumentAccepted> AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null);
DetailedResponse<DocumentAccepted> UpdateDocument(string projectId, string collectionId, string documentId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null);
DetailedResponse<DeleteDocumentResponse> DeleteDocument(string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce = null);
DetailedResponse<TrainingQuerySet> ListTrainingQueries(string projectId);
DetailedResponse<object> DeleteTrainingQueries(string projectId);
DetailedResponse<TrainingQuery> CreateTrainingQuery(string projectId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null);
DetailedResponse<TrainingQuery> GetTrainingQuery(string projectId, string queryId);
DetailedResponse<TrainingQuery> UpdateTrainingQuery(string projectId, string queryId, string naturalLanguageQuery, List<TrainingExample> examples, string filter = null);
DetailedResponse<object> DeleteTrainingQuery(string projectId, string queryId);
DetailedResponse<AnalyzedDocument> AnalyzeDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null);
DetailedResponse<Enrichments> ListEnrichments(string projectId);
DetailedResponse<Enrichment> CreateEnrichment(string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file = null);
DetailedResponse<Enrichment> GetEnrichment(string projectId, string enrichmentId);
DetailedResponse<Enrichment> UpdateEnrichment(string projectId, string enrichmentId, string name, string description = null);
DetailedResponse<object> DeleteEnrichment(string projectId, string enrichmentId);
DetailedResponse<ListProjectsResponse> ListProjects();
DetailedResponse<ProjectDetails> CreateProject(string name, string type, DefaultQueryParams defaultQueryParameters = null);
DetailedResponse<ProjectDetails> GetProject(string projectId);
DetailedResponse<ProjectDetails> UpdateProject(string projectId, string name = null);
DetailedResponse<object> DeleteProject(string projectId);
DetailedResponse<DocumentClassifiers> ListDocumentClassifiers(string projectId);
DetailedResponse<DocumentClassifier> CreateDocumentClassifier(string projectId, System.IO.MemoryStream trainingData, CreateDocumentClassifier classifier, System.IO.MemoryStream testData = null);
DetailedResponse<DocumentClassifier> GetDocumentClassifier(string projectId, string classifierId);
DetailedResponse<DocumentClassifier> UpdateDocumentClassifier(string projectId, string classifierId, UpdateDocumentClassifier classifier, System.IO.MemoryStream trainingData = null, System.IO.MemoryStream testData = null);
DetailedResponse<object> DeleteDocumentClassifier(string projectId, string classifierId);
DetailedResponse<DocumentClassifierModels> ListDocumentClassifierModels(string projectId, string classifierId);
DetailedResponse<DocumentClassifierModel> CreateDocumentClassifierModel(string projectId, string classifierId, string name, string description = null, double? learningRate = null, List<double?> l1RegularizationStrengths = null, List<double?> l2RegularizationStrengths = null, long? trainingMaxSteps = null, double? improvementRatio = null);
DetailedResponse<DocumentClassifierModel> GetDocumentClassifierModel(string projectId, string classifierId, string modelId);
DetailedResponse<DocumentClassifierModel> UpdateDocumentClassifierModel(string projectId, string classifierId, string modelId, string name = null, string description = null);
DetailedResponse<object> DeleteDocumentClassifierModel(string projectId, string classifierId, string modelId);
DetailedResponse<AnalyzedDocument> AnalyzeDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null);
DetailedResponse<object> DeleteUserData(string customerId);
}
}
7 changes: 4 additions & 3 deletions src/IBM.Watson.Discovery.v2/Model/AnalyzedDocument.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2020, 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 @@ -21,12 +21,13 @@
namespace IBM.Watson.Discovery.v2.Model
{
/// <summary>
/// An object that contains the converted document and any identified enrichments.
/// An object that contains the converted document and any identified enrichments. Root-level fields from the
/// original file are returned also.
/// </summary>
public class AnalyzedDocument
{
/// <summary>
/// Array of document results that match the query.
/// Array of notices that are triggered when the files are processed.
/// </summary>
[JsonProperty("notices", NullValueHandling = NullValueHandling.Ignore)]
public List<Notice> Notices { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/IBM.Watson.Discovery.v2/Model/AnalyzedResult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2020.
* (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 @@ -27,7 +27,7 @@ namespace IBM.Watson.Discovery.v2.Model
public class AnalyzedResult : DynamicModel<object>
{
/// <summary>
/// Metadata of the document.
/// Metadata that was specified with the request.
/// </summary>
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<string, object> Metadata { get; set; }
Expand Down
35 changes: 35 additions & 0 deletions src/IBM.Watson.Discovery.v2/Model/ClassifierFederatedModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* (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.v2.Model
{
/// <summary>
/// An object with details for creating federated document classifier models.
/// </summary>
public class ClassifierFederatedModel
{
/// <summary>
/// Name of the field that contains the values from which multiple classifier models are defined. For example,
/// you can specify a field that lists product lines to create a separate model per product line.
/// </summary>
[JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)]
public string Field { get; set; }
}

}
48 changes: 48 additions & 0 deletions src/IBM.Watson.Discovery.v2/Model/ClassifierModelEvaluation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* (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.v2.Model
{
/// <summary>
/// An object that contains information about a trained document classifier model.
/// </summary>
public class ClassifierModelEvaluation
{
/// <summary>
/// A micro-average aggregates the contributions of all classes to compute the average metric. Classes refers to
/// the classification labels that are specified in the **answer_field**.
/// </summary>
[JsonProperty("micro_average", NullValueHandling = NullValueHandling.Ignore)]
public ModelEvaluationMicroAverage MicroAverage { get; set; }
/// <summary>
/// A macro-average computes metric independently for each class and then takes the average. Class refers to the
/// classification label that is specified in the **answer_field**.
/// </summary>
[JsonProperty("macro_average", NullValueHandling = NullValueHandling.Ignore)]
public ModelEvaluationMacroAverage MacroAverage { get; set; }
/// <summary>
/// An array of evaluation metrics, one set of metrics for each class, where class refers to the classification
/// label that is specified in the **answer_field**.
/// </summary>
[JsonProperty("per_class", NullValueHandling = NullValueHandling.Ignore)]
public List<PerClassModelEvaluation> PerClass { get; set; }
}

}
17 changes: 14 additions & 3 deletions src/IBM.Watson.Discovery.v2/Model/CollectionDetails.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2018, 2020.
* (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 @@ -47,15 +47,26 @@ public class CollectionDetails
[JsonProperty("created", NullValueHandling = NullValueHandling.Ignore)]
public virtual DateTime? Created { get; private set; }
/// <summary>
/// The language of the collection.
/// The language of the collection. For a list of supported languages, see the [product
/// documentation](/docs/discovery-data?topic=discovery-data-language-support).
/// </summary>
[JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)]
public string Language { get; set; }
/// <summary>
/// An array of enrichments that are applied to this collection.
/// An array of enrichments that are applied to this collection. To get a list of enrichments that are available
/// for a project, use the [List enrichments](#listenrichments) method.
///
/// If no enrichments are specified when the collection is created, the default enrichments for the project type
/// are applied. For more information about project default settings, see the [product
/// documentation](/docs/discovery-data?topic=discovery-data-project-defaults).
/// </summary>
[JsonProperty("enrichments", NullValueHandling = NullValueHandling.Ignore)]
public List<CollectionEnrichment> Enrichments { get; set; }
/// <summary>
/// An object that describes the Smart Document Understanding model for a collection.
/// </summary>
[JsonProperty("smart_document_understanding", NullValueHandling = NullValueHandling.Ignore)]
public CollectionDetailsSmartDocumentUnderstanding SmartDocumentUnderstanding { get; set; }
}

}
Loading

0 comments on commit 495295f

Please sign in to comment.