Skip to content

Commit 1e2682f

Browse files
jeff-arnapaparazzi0329
authored andcommitted
feat(discoveryv2): update based on api definitions
contains some breaking model changes and new approach to handling discriminators for aggregation types BREAKING CHANGE: enrichmentId is now a required param for 'DocumentClassifierEnrichment' model. 'confidence' property has been removed from 'QueryResponsePassage' and 'QueryResultPassage' models. Breaking interface changes to handling aggregation discriminators.
1 parent a810f01 commit 1e2682f

File tree

160 files changed

+1298
-839
lines changed

Some content is hidden

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

160 files changed

+1298
-839
lines changed

discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java

+32-35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/*
15-
* IBM OpenAPI SDK Code Generator Version: 3.53.0-9710cac3-20220713-193508
15+
* IBM OpenAPI SDK Code Generator Version: 3.64.1-cee95189-20230124-211647
1616
*/
1717

1818
package com.ibm.watson.discovery.v2;
@@ -107,17 +107,19 @@
107107
import okhttp3.MultipartBody;
108108

109109
/**
110-
* IBM Watson™ Discovery is a cognitive search and content analytics engine that you can
111-
* add to applications to identify patterns, trends and actionable insights to drive better
110+
* IBM Watson® Discovery is a cognitive search and content analytics engine that you can add
111+
* to applications to identify patterns, trends and actionable insights to drive better
112112
* decision-making. Securely unify structured and unstructured data with pre-enriched content, and
113113
* use a simplified query language to eliminate the need for manual filtering of results.
114114
*
115115
* <p>API Version: 2.0 See: https://cloud.ibm.com/docs/discovery-data
116116
*/
117117
public class Discovery extends BaseService {
118118

119+
/** Default service name used when configuring the `Discovery` client. */
119120
public static final String DEFAULT_SERVICE_NAME = "discovery";
120121

122+
/** Default service endpoint URL. */
121123
public static final String DEFAULT_SERVICE_URL =
122124
"https://api.us-south.discovery.watson.cloud.ibm.com";
123125

@@ -465,12 +467,6 @@ public ServiceCall<CollectionDetails> createCollection(
465467
com.ibm.cloud.sdk.core.util.GsonSingleton.getGson()
466468
.toJsonTree(createCollectionOptions.enrichments()));
467469
}
468-
if (createCollectionOptions.smartDocumentUnderstanding() != null) {
469-
contentJson.add(
470-
"smart_document_understanding",
471-
com.ibm.cloud.sdk.core.util.GsonSingleton.getGson()
472-
.toJsonTree(createCollectionOptions.smartDocumentUnderstanding()));
473-
}
474470
builder.bodyJson(contentJson);
475471
ResponseConverter<CollectionDetails> responseConverter =
476472
ResponseConverterUtils.getValue(
@@ -597,7 +593,8 @@ public ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollecti
597593
* each document and returns information for up to 10,000 documents.
598594
*
599595
* <p>**Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later
600-
* installed instances and from Plus and Enterprise plan IBM Cloud-managed instances.
596+
* installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not
597+
* currently available from Premium plan instances.
601598
*
602599
* @param listDocumentsOptions the {@link ListDocumentsOptions} containing the options for the
603600
* call
@@ -653,8 +650,8 @@ public ServiceCall<ListDocumentsResponse> listDocuments(
653650
*
654651
* <p>Returns immediately after the system has accepted the document for processing.
655652
*
656-
* <p>This operation works with a file upload collection. It cannot be used to modify a collection
657-
* that crawls an external data source.
653+
* <p>Use this method to upload a file to the collection. You cannot use this method to crawl an
654+
* external data source.
658655
*
659656
* <p>* For a list of supported file types, see the [product
660657
* documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
@@ -731,7 +728,8 @@ public ServiceCall<DocumentAccepted> addDocument(AddDocumentOptions addDocumentO
731728
* by crawling an external data source.
732729
*
733730
* <p>**Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later
734-
* installed instances and from Plus and Enterprise plan IBM Cloud-managed instances.
731+
* installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not
732+
* currently available from Premium plan instances.
735733
*
736734
* @param getDocumentOptions the {@link GetDocumentOptions} containing the options for the call
737735
* @return a {@link ServiceCall} with a result of type {@link DocumentDetails}
@@ -767,8 +765,8 @@ public ServiceCall<DocumentDetails> getDocument(GetDocumentOptions getDocumentOp
767765
* <p>Replace an existing document or add a document with a specified document ID. Starts
768766
* ingesting a document with optional metadata.
769767
*
770-
* <p>This operation works with a file upload collection. It cannot be used to modify a collection
771-
* that crawls an external data source.
768+
* <p>Use this method to upload a file to a collection. You cannot use this method to crawl an
769+
* external data source.
772770
*
773771
* <p>If the document is uploaded to a collection that shares its data with another collection,
774772
* the **X-Watson-Discovery-Force** header must be set to `true`.
@@ -832,15 +830,17 @@ public ServiceCall<DocumentAccepted> updateDocument(UpdateDocumentOptions update
832830
/**
833831
* Delete a document.
834832
*
835-
* <p>If the given document ID is invalid, or if the document is not found, then the a success
836-
* response is returned (HTTP status code `200`) with the status set to 'deleted'.
837-
*
838-
* <p>**Note:** This operation only works on collections created to accept direct file uploads. It
839-
* cannot be used to modify a collection that connects to an external source such as Microsoft
840-
* SharePoint.
833+
* <p>Deletes the document with the document ID that you specify from the collection. Removes
834+
* uploaded documents from the collection permanently. If you delete a document that was added by
835+
* crawling an external data source, the document will be added again with the next scheduled
836+
* crawl of the data source. The delete function removes the document from the collection, not
837+
* from the external data source.
841838
*
842-
* <p>**Note:** Segments of an uploaded document cannot be deleted individually. Delete all
843-
* segments by deleting using the `parent_document_id` of a segment result.
839+
* <p>**Note:** Files such as CSV or JSON files generate subdocuments when they are added to a
840+
* collection. If you delete a subdocument, and then repeat the action that created it, the
841+
* deleted document is added back in to your collection. To remove subdocuments that are generated
842+
* by an uploaded file, delete the original document instead. You can get the document ID of the
843+
* original document from the `parent_document_id` of the subdocument result.
844844
*
845845
* @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the
846846
* call
@@ -880,12 +880,11 @@ public ServiceCall<DeleteDocumentResponse> deleteDocument(
880880
*
881881
* <p>Search your data by submitting queries that are written in natural language or formatted in
882882
* the Discovery Query Language. For more information, see the [Discovery
883-
* documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts).
884-
* The default query parameters differ by project type. For more information about the project
885-
* default settings, see the [Discovery
886-
* documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-defaults).
887-
* See [the Projects API documentation](#create-project) for details about how to set custom
888-
* default query settings.
883+
* documentation](/docs/discovery-data?topic=discovery-data-query-concepts). The default query
884+
* parameters differ by project type. For more information about the project default settings, see
885+
* the [Discovery documentation](/docs/discovery-data?topic=discovery-data-query-defaults). See
886+
* [the Projects API documentation](#create-project) for details about how to set custom default
887+
* query settings.
889888
*
890889
* <p>The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is
891890
* roughly equivalent to 10,000 characters in English.
@@ -1163,10 +1162,8 @@ public ServiceCall<StopWordList> getStopwordList(GetStopwordListOptions getStopw
11631162
* indexing time and at query time. A custom stop words list that you add is used at query time
11641163
* only.
11651164
*
1166-
* <p>The custom stop words list replaces the default stop words list. Therefore, if you want to
1167-
* keep the stop words that were used when the collection was indexed, get the default stop words
1168-
* list for the language of the collection first and edit it to create your custom list. For
1169-
* information about the default stop words lists per language, see [the product
1165+
* <p>The custom stop words list augments the default stop words list; you cannot remove stop
1166+
* words. For information about the default stop words lists per language, see [the product
11701167
* documentation](/docs/discovery-data?topic=discovery-data-stopwords).
11711168
*
11721169
* @param createStopwordListOptions the {@link CreateStopwordListOptions} containing the options
@@ -2260,7 +2257,7 @@ public ServiceCall<AnalyzedDocument> analyzeDocument(
22602257
* <p>You associate a customer ID with data by passing the **X-Watson-Metadata** header with a
22612258
* request that passes data. For more information about personal data and customer IDs, see
22622259
* [Information
2263-
* security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security).
2260+
* security](/docs/discovery-data?topic=discovery-data-information-security#information-security).
22642261
*
22652262
* <p>**Note:** This method is only supported on IBM Cloud instances of Discovery.
22662263
*

discovery/src/main/java/com/ibm/watson/discovery/v2/model/AddDocumentOptions.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -39,6 +39,11 @@ public static class Builder {
3939
private String metadata;
4040
private Boolean xWatsonDiscoveryForce;
4141

42+
/**
43+
* Instantiates a new Builder from an existing AddDocumentOptions instance.
44+
*
45+
* @param addDocumentOptions the instance to initialize the Builder with
46+
*/
4247
private Builder(AddDocumentOptions addDocumentOptions) {
4348
this.projectId = addDocumentOptions.projectId;
4449
this.collectionId = addDocumentOptions.collectionId;
@@ -218,7 +223,7 @@ public String collectionId() {
218223
*
219224
* <p>When adding a document, the content of the document to ingest. For maximum supported file
220225
* size limits, see [the
221-
* documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-collections#collections-doc-limits).
226+
* documentation](/docs/discovery-data?topic=discovery-data-collections#collections-doc-limits).
222227
*
223228
* <p>When analyzing a document, the content of the document to analyze but not ingest. Only the
224229
* `application/json` content type is supported currently. For maximum supported file size limits,

discovery/src/main/java/com/ibm/watson/discovery/v2/model/AnalyzeDocumentOptions.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -37,6 +37,11 @@ public static class Builder {
3737
private String fileContentType;
3838
private String metadata;
3939

40+
/**
41+
* Instantiates a new Builder from an existing AnalyzeDocumentOptions instance.
42+
*
43+
* @param analyzeDocumentOptions the instance to initialize the Builder with
44+
*/
4045
private Builder(AnalyzeDocumentOptions analyzeDocumentOptions) {
4146
this.projectId = analyzeDocumentOptions.projectId;
4247
this.collectionId = analyzeDocumentOptions.collectionId;
@@ -203,7 +208,7 @@ public String collectionId() {
203208
*
204209
* <p>When adding a document, the content of the document to ingest. For maximum supported file
205210
* size limits, see [the
206-
* documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-collections#collections-doc-limits).
211+
* documentation](/docs/discovery-data?topic=discovery-data-collections#collections-doc-limits).
207212
*
208213
* <p>When analyzing a document, the content of the document to analyze but not ingest. Only the
209214
* `application/json` content type is supported currently. For maximum supported file size limits,

discovery/src/main/java/com/ibm/watson/discovery/v2/model/AnalyzedDocument.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -24,6 +24,8 @@ public class AnalyzedDocument extends GenericModel {
2424
protected List<Notice> notices;
2525
protected AnalyzedResult result;
2626

27+
protected AnalyzedDocument() {}
28+
2729
/**
2830
* Gets the notices.
2931
*

discovery/src/main/java/com/ibm/watson/discovery/v2/model/ClassifierFederatedModel.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -23,6 +23,11 @@ public class ClassifierFederatedModel extends GenericModel {
2323
public static class Builder {
2424
private String field;
2525

26+
/**
27+
* Instantiates a new Builder from an existing ClassifierFederatedModel instance.
28+
*
29+
* @param classifierFederatedModel the instance to initialize the Builder with
30+
*/
2631
private Builder(ClassifierFederatedModel classifierFederatedModel) {
2732
this.field = classifierFederatedModel.field;
2833
}

discovery/src/main/java/com/ibm/watson/discovery/v2/model/ClassifierModelEvaluation.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -28,6 +28,8 @@ public class ClassifierModelEvaluation extends GenericModel {
2828
@SerializedName("per_class")
2929
protected List<PerClassModelEvaluation> perClass;
3030

31+
protected ClassifierModelEvaluation() {}
32+
3133
/**
3234
* Gets the microAverage.
3335
*

discovery/src/main/java/com/ibm/watson/discovery/v2/model/Collection.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2020.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -23,6 +23,8 @@ public class Collection extends GenericModel {
2323

2424
protected String name;
2525

26+
protected Collection() {}
27+
2628
/**
2729
* Gets the collectionId.
2830
*

discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionDetails.java

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -39,14 +39,17 @@ public static class Builder {
3939
private String description;
4040
private String language;
4141
private List<CollectionEnrichment> enrichments;
42-
private CollectionDetailsSmartDocumentUnderstanding smartDocumentUnderstanding;
4342

43+
/**
44+
* Instantiates a new Builder from an existing CollectionDetails instance.
45+
*
46+
* @param collectionDetails the instance to initialize the Builder with
47+
*/
4448
private Builder(CollectionDetails collectionDetails) {
4549
this.name = collectionDetails.name;
4650
this.description = collectionDetails.description;
4751
this.language = collectionDetails.language;
4852
this.enrichments = collectionDetails.enrichments;
49-
this.smartDocumentUnderstanding = collectionDetails.smartDocumentUnderstanding;
5053
}
5154

5255
/** Instantiates a new builder. */
@@ -128,18 +131,6 @@ public Builder enrichments(List<CollectionEnrichment> enrichments) {
128131
this.enrichments = enrichments;
129132
return this;
130133
}
131-
132-
/**
133-
* Set the smartDocumentUnderstanding.
134-
*
135-
* @param smartDocumentUnderstanding the smartDocumentUnderstanding
136-
* @return the CollectionDetails builder
137-
*/
138-
public Builder smartDocumentUnderstanding(
139-
CollectionDetailsSmartDocumentUnderstanding smartDocumentUnderstanding) {
140-
this.smartDocumentUnderstanding = smartDocumentUnderstanding;
141-
return this;
142-
}
143134
}
144135

145136
protected CollectionDetails() {}
@@ -150,7 +141,6 @@ protected CollectionDetails(Builder builder) {
150141
description = builder.description;
151142
language = builder.language;
152143
enrichments = builder.enrichments;
153-
smartDocumentUnderstanding = builder.smartDocumentUnderstanding;
154144
}
155145

156146
/**

discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionDetailsSmartDocumentUnderstanding.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -51,6 +51,13 @@ public static class Builder {
5151
private Boolean enabled;
5252
private String model;
5353

54+
/**
55+
* Instantiates a new Builder from an existing CollectionDetailsSmartDocumentUnderstanding
56+
* instance.
57+
*
58+
* @param collectionDetailsSmartDocumentUnderstanding the instance to initialize the Builder
59+
* with
60+
*/
5461
private Builder(
5562
CollectionDetailsSmartDocumentUnderstanding collectionDetailsSmartDocumentUnderstanding) {
5663
this.enabled = collectionDetailsSmartDocumentUnderstanding.enabled;

discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionEnrichment.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -30,6 +30,11 @@ public static class Builder {
3030
private String enrichmentId;
3131
private List<String> fields;
3232

33+
/**
34+
* Instantiates a new Builder from an existing CollectionEnrichment instance.
35+
*
36+
* @param collectionEnrichment the instance to initialize the Builder with
37+
*/
3338
private Builder(CollectionEnrichment collectionEnrichment) {
3439
this.enrichmentId = collectionEnrichment.enrichmentId;
3540
this.fields = collectionEnrichment.fields;

discovery/src/main/java/com/ibm/watson/discovery/v2/model/Completions.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2019, 2021.
2+
* (C) Copyright IBM Corp. 2023.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -20,6 +20,8 @@ public class Completions extends GenericModel {
2020

2121
protected List<String> completions;
2222

23+
protected Completions() {}
24+
2325
/**
2426
* Gets the completions.
2527
*

0 commit comments

Comments
 (0)