diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java index e341cfe8e2..83df9f00b5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java @@ -72,6 +72,8 @@ import com.ibm.watson.discovery.v2.model.GetProjectOptions; import com.ibm.watson.discovery.v2.model.GetStopwordListOptions; import com.ibm.watson.discovery.v2.model.GetTrainingQueryOptions; +import com.ibm.watson.discovery.v2.model.ListBatchesOptions; +import com.ibm.watson.discovery.v2.model.ListBatchesResponse; import com.ibm.watson.discovery.v2.model.ListCollectionsOptions; import com.ibm.watson.discovery.v2.model.ListCollectionsResponse; import com.ibm.watson.discovery.v2.model.ListDocumentClassifierModelsOptions; @@ -86,6 +88,9 @@ import com.ibm.watson.discovery.v2.model.ListProjectsResponse; import com.ibm.watson.discovery.v2.model.ListTrainingQueriesOptions; import com.ibm.watson.discovery.v2.model.ProjectDetails; +import com.ibm.watson.discovery.v2.model.PullBatchesOptions; +import com.ibm.watson.discovery.v2.model.PullBatchesResponse; +import com.ibm.watson.discovery.v2.model.PushBatchesOptions; import com.ibm.watson.discovery.v2.model.QueryCollectionNoticesOptions; import com.ibm.watson.discovery.v2.model.QueryNoticesOptions; import com.ibm.watson.discovery.v2.model.QueryNoticesResponse; @@ -1794,6 +1799,129 @@ public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichme return createServiceCall(builder.build(), responseConverter); } + /** + * List batches. + * + *

A batch is a set of documents that are ready for enrichment by an external application. + * After you apply a webhook enrichment to a collection, and then process or upload documents to + * the collection, Discovery creates a batch with a unique **batch_id**. + * + *

To start, you must register your external application as a **webhook** type by using the + * [Create enrichment API](/apidocs/discovery-data#createenrichment) method. + * + *

Use the List batches API to get the following: + * + *

* Notified batches that are not yet pulled by the external enrichment application. + * + *

* Batches that are pulled, but not yet pushed to Discovery by the external enrichment + * application. + * + * @param listBatchesOptions the {@link ListBatchesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListBatchesResponse} + */ + public ServiceCall listBatches(ListBatchesOptions listBatchesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + listBatchesOptions, "listBatchesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("project_id", listBatchesOptions.projectId()); + pathParamsMap.put("collection_id", listBatchesOptions.collectionId()); + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.resolveRequestUrl( + getServiceUrl(), + "/v2/projects/{project_id}/collections/{collection_id}/batches", + pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listBatches"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(this.version)); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Pull batches. + * + *

Pull a batch of documents from Discovery for enrichment by an external application. Ensure + * to include the `Accept-Encoding: gzip` header in this method to get the file. You can also + * implement retry logic when calling this method to avoid any network errors. + * + * @param pullBatchesOptions the {@link PullBatchesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link PullBatchesResponse} + */ + public ServiceCall pullBatches(PullBatchesOptions pullBatchesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + pullBatchesOptions, "pullBatchesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("project_id", pullBatchesOptions.projectId()); + pathParamsMap.put("collection_id", pullBatchesOptions.collectionId()); + pathParamsMap.put("batch_id", pullBatchesOptions.batchId()); + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.resolveRequestUrl( + getServiceUrl(), + "/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}", + pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "pullBatches"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(this.version)); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Push batches. + * + *

Push a batch of documents to Discovery after annotation by an external application. You can + * implement retry logic when calling this method to avoid any network errors. + * + * @param pushBatchesOptions the {@link PushBatchesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Boolean} + */ + public ServiceCall pushBatches(PushBatchesOptions pushBatchesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + pushBatchesOptions, "pushBatchesOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue( + (pushBatchesOptions.file() != null), "At least one of or file must be supplied."); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("project_id", pushBatchesOptions.projectId()); + pathParamsMap.put("collection_id", pushBatchesOptions.collectionId()); + pathParamsMap.put("batch_id", pushBatchesOptions.batchId()); + RequestBuilder builder = + RequestBuilder.post( + RequestBuilder.resolveRequestUrl( + getServiceUrl(), + "/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}", + pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "pushBatches"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("version", String.valueOf(this.version)); + MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); + multipartBuilder.setType(MultipartBody.FORM); + if (pushBatchesOptions.file() != null) { + okhttp3.RequestBody fileBody = + RequestUtils.inputStreamBody(pushBatchesOptions.file(), "application/octet-stream"); + multipartBuilder.addFormDataPart("file", pushBatchesOptions.filename(), fileBody); + } + builder.body(multipartBuilder.build()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); + return createServiceCall(builder.build(), responseConverter); + } + /** * List document classifiers. * diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/BatchDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/BatchDetails.java new file mode 100644 index 0000000000..24ce42cc15 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/BatchDetails.java @@ -0,0 +1,68 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.Date; + +/** + * A batch is a set of documents that are ready for enrichment by an external application. After you + * apply a webhook enrichment to a collection, and then process or upload documents to the + * collection, Discovery creates a batch with a unique **batch_id**. + */ +public class BatchDetails extends GenericModel { + + @SerializedName("batch_id") + protected String batchId; + + protected Date created; + + @SerializedName("enrichment_id") + protected String enrichmentId; + + protected BatchDetails() {} + + /** + * Gets the batchId. + * + *

The Universally Unique Identifier (UUID) for a batch of documents. + * + * @return the batchId + */ + public String getBatchId() { + return batchId; + } + + /** + * Gets the created. + * + *

The date and time (RFC3339) that the batch was created. + * + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * Gets the enrichmentId. + * + *

The Universally Unique Identifier (UUID) for the external enrichment. + * + * @return the enrichmentId + */ + public String getEnrichmentId() { + return enrichmentId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java index 2aa0f32359..2d6b35aed5 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java @@ -44,9 +44,7 @@ public class CreateEnrichment extends GenericModel { *

* `watson_knowledge_studio_model`: Creates an enrichment from a Watson Knowledge Studio * machine learning model that is defined in a ZIP file. * - *

* `webhook`: Connects to an external enrichment application by using a webhook. The feature - * is available from IBM Cloud-managed instances only. The external enrichment feature is beta - * functionality. Beta features are not supported by the SDKs. + *

* `webhook`: Connects to an external enrichment application by using a webhook. * *

* `sentence_classifier`: Use sentence classifier to classify sentences in your documents. * This feature is available in IBM Cloud-managed instances only. The sentence classifier feature @@ -221,9 +219,7 @@ public String description() { *

* `watson_knowledge_studio_model`: Creates an enrichment from a Watson Knowledge Studio * machine learning model that is defined in a ZIP file. * - *

* `webhook`: Connects to an external enrichment application by using a webhook. The feature - * is available from IBM Cloud-managed instances only. The external enrichment feature is beta - * functionality. Beta features are not supported by the SDKs. + *

* `webhook`: Connects to an external enrichment application by using a webhook. * *

* `sentence_classifier`: Use sentence classifier to classify sentences in your documents. * This feature is available in IBM Cloud-managed instances only. The sentence classifier feature diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesOptions.java new file mode 100644 index 0000000000..09f9323b67 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesOptions.java @@ -0,0 +1,125 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The listBatches options. */ +public class ListBatchesOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + + /** + * Instantiates a new Builder from an existing ListBatchesOptions instance. + * + * @param listBatchesOptions the instance to initialize the Builder with + */ + private Builder(ListBatchesOptions listBatchesOptions) { + this.projectId = listBatchesOptions.projectId; + this.collectionId = listBatchesOptions.collectionId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + */ + public Builder(String projectId, String collectionId) { + this.projectId = projectId; + this.collectionId = collectionId; + } + + /** + * Builds a ListBatchesOptions. + * + * @return the new ListBatchesOptions instance + */ + public ListBatchesOptions build() { + return new ListBatchesOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the ListBatchesOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the ListBatchesOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + } + + protected ListBatchesOptions() {} + + protected ListBatchesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + projectId = builder.projectId; + collectionId = builder.collectionId; + } + + /** + * New builder. + * + * @return a ListBatchesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The Universally Unique Identifier (UUID) of the project. This information can be found from + * the *Integrate and Deploy* page in Discovery. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The Universally Unique Identifier (UUID) of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesResponse.java new file mode 100644 index 0000000000..fb0ad853d1 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListBatchesResponse.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** + * An object that contains a list of batches that are ready for enrichment by the external + * application. + */ +public class ListBatchesResponse extends GenericModel { + + protected List batches; + + protected ListBatchesResponse() {} + + /** + * Gets the batches. + * + *

An array that lists the batches in a collection. + * + * @return the batches + */ + public List getBatches() { + return batches; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesOptions.java new file mode 100644 index 0000000000..3987301fbf --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesOptions.java @@ -0,0 +1,155 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The pullBatches options. */ +public class PullBatchesOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + protected String batchId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + private String batchId; + + /** + * Instantiates a new Builder from an existing PullBatchesOptions instance. + * + * @param pullBatchesOptions the instance to initialize the Builder with + */ + private Builder(PullBatchesOptions pullBatchesOptions) { + this.projectId = pullBatchesOptions.projectId; + this.collectionId = pullBatchesOptions.collectionId; + this.batchId = pullBatchesOptions.batchId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + * @param batchId the batchId + */ + public Builder(String projectId, String collectionId, String batchId) { + this.projectId = projectId; + this.collectionId = collectionId; + this.batchId = batchId; + } + + /** + * Builds a PullBatchesOptions. + * + * @return the new PullBatchesOptions instance + */ + public PullBatchesOptions build() { + return new PullBatchesOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the PullBatchesOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the PullBatchesOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Set the batchId. + * + * @param batchId the batchId + * @return the PullBatchesOptions builder + */ + public Builder batchId(String batchId) { + this.batchId = batchId; + return this; + } + } + + protected PullBatchesOptions() {} + + protected PullBatchesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.batchId, "batchId cannot be empty"); + projectId = builder.projectId; + collectionId = builder.collectionId; + batchId = builder.batchId; + } + + /** + * New builder. + * + * @return a PullBatchesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The Universally Unique Identifier (UUID) of the project. This information can be found from + * the *Integrate and Deploy* page in Discovery. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The Universally Unique Identifier (UUID) of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } + + /** + * Gets the batchId. + * + *

The Universally Unique Identifier (UUID) of the document batch that is being requested from + * Discovery. + * + * @return the batchId + */ + public String batchId() { + return batchId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesResponse.java new file mode 100644 index 0000000000..985d413dc5 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PullBatchesResponse.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A compressed newline delimited JSON (NDJSON) file containing the document. The NDJSON format is + * used to describe structured data. The file name format is `{batch_id}.ndjson.gz`. For more + * information, see [Binary attachment from the pull batches + * method](/docs/discovery-data?topic=discovery-data-external-enrichment#binary-attachment-pull-batches). + */ +public class PullBatchesResponse extends GenericModel { + + protected String file; + + protected PullBatchesResponse() {} + + /** + * Gets the file. + * + *

A compressed NDJSON file containing the document. + * + * @return the file + */ + public String getFile() { + return file; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PushBatchesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PushBatchesOptions.java new file mode 100644 index 0000000000..97700fd5c6 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/PushBatchesOptions.java @@ -0,0 +1,233 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +/** The pushBatches options. */ +public class PushBatchesOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + protected String batchId; + protected InputStream file; + protected String filename; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + private String batchId; + private InputStream file; + private String filename; + + /** + * Instantiates a new Builder from an existing PushBatchesOptions instance. + * + * @param pushBatchesOptions the instance to initialize the Builder with + */ + private Builder(PushBatchesOptions pushBatchesOptions) { + this.projectId = pushBatchesOptions.projectId; + this.collectionId = pushBatchesOptions.collectionId; + this.batchId = pushBatchesOptions.batchId; + this.file = pushBatchesOptions.file; + this.filename = pushBatchesOptions.filename; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + * @param batchId the batchId + */ + public Builder(String projectId, String collectionId, String batchId) { + this.projectId = projectId; + this.collectionId = collectionId; + this.batchId = batchId; + } + + /** + * Builds a PushBatchesOptions. + * + * @return the new PushBatchesOptions instance + */ + public PushBatchesOptions build() { + return new PushBatchesOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the PushBatchesOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the PushBatchesOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Set the batchId. + * + * @param batchId the batchId + * @return the PushBatchesOptions builder + */ + public Builder batchId(String batchId) { + this.batchId = batchId; + return this; + } + + /** + * Set the file. + * + * @param file the file + * @return the PushBatchesOptions builder + */ + public Builder file(InputStream file) { + this.file = file; + return this; + } + + /** + * Set the filename. + * + * @param filename the filename + * @return the PushBatchesOptions builder + */ + public Builder filename(String filename) { + this.filename = filename; + return this; + } + + /** + * Set the file. + * + * @param file the file + * @return the PushBatchesOptions builder + * @throws FileNotFoundException if the file could not be found + */ + public Builder file(File file) throws FileNotFoundException { + this.file = new FileInputStream(file); + this.filename = file.getName(); + return this; + } + } + + protected PushBatchesOptions() {} + + protected PushBatchesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.batchId, "batchId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.isTrue( + (builder.file == null) || (builder.filename != null), + "filename cannot be null if file is not null."); + projectId = builder.projectId; + collectionId = builder.collectionId; + batchId = builder.batchId; + file = builder.file; + filename = builder.filename; + } + + /** + * New builder. + * + * @return a PushBatchesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The Universally Unique Identifier (UUID) of the project. This information can be found from + * the *Integrate and Deploy* page in Discovery. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The Universally Unique Identifier (UUID) of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } + + /** + * Gets the batchId. + * + *

The Universally Unique Identifier (UUID) of the document batch that is being requested from + * Discovery. + * + * @return the batchId + */ + public String batchId() { + return batchId; + } + + /** + * Gets the file. + * + *

A compressed newline-delimited JSON (NDJSON), which is a JSON file with one row of data per + * line. For example, `{batch_id}.ndjson.gz`. For more information, see [Binary attachment in the + * push batches + * method](/docs/discovery-data?topic=discovery-data-external-enrichment#binary-attachment-push-batches). + * + *

There is no limitation on the name of the file because Discovery does not use the name for + * processing. The list of features in the document is specified in the `features` object. + * + * @return the file + */ + public InputStream file() { + return file; + } + + /** + * Gets the filename. + * + *

The filename for file. + * + * @return the filename + */ + public String filename() { + return filename; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryCollectionNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryCollectionNoticesOptions.java index 6065328419..d60a1076e9 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryCollectionNoticesOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryCollectionNoticesOptions.java @@ -178,8 +178,8 @@ public Builder newBuilder() { /** * Gets the projectId. * - *

The ID of the project. This information can be found from the *Integrate and Deploy* page in - * Discovery. + *

The Universally Unique Identifier (UUID) of the project. This information can be found from + * the *Integrate and Deploy* page in Discovery. * * @return the projectId */ @@ -190,7 +190,7 @@ public String projectId() { /** * Gets the collectionId. * - *

The ID of the collection. + *

The Universally Unique Identifier (UUID) of the collection. * * @return the collectionId */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryOptions.java index 4f6a614cd4..407dd01051 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryOptions.java @@ -446,8 +446,15 @@ public List xReturn() { /** * Gets the offset. * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. + *

The number of query results to skip at the beginning. Consider that the `count` is set to 10 + * (the default value) and the total number of results that are returned is 100. In this case, the + * following examples show the returned results for different `offset` values: + * + *

* If `offset` is set to 95, it returns the last 5 results. + * + *

* If `offset` is set to 10, it returns the second batch of 10 results. + * + *

* If `offset` is set to 100 or more, it returns empty results. * * @return the offset */ diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryTest.java index 9169adb714..7dcb74dd08 100644 --- a/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryTest.java +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/DiscoveryTest.java @@ -75,6 +75,8 @@ import com.ibm.watson.discovery.v2.model.GetProjectOptions; import com.ibm.watson.discovery.v2.model.GetStopwordListOptions; import com.ibm.watson.discovery.v2.model.GetTrainingQueryOptions; +import com.ibm.watson.discovery.v2.model.ListBatchesOptions; +import com.ibm.watson.discovery.v2.model.ListBatchesResponse; import com.ibm.watson.discovery.v2.model.ListCollectionsOptions; import com.ibm.watson.discovery.v2.model.ListCollectionsResponse; import com.ibm.watson.discovery.v2.model.ListDocumentClassifierModelsOptions; @@ -89,6 +91,9 @@ import com.ibm.watson.discovery.v2.model.ListProjectsResponse; import com.ibm.watson.discovery.v2.model.ListTrainingQueriesOptions; import com.ibm.watson.discovery.v2.model.ProjectDetails; +import com.ibm.watson.discovery.v2.model.PullBatchesOptions; +import com.ibm.watson.discovery.v2.model.PullBatchesResponse; +import com.ibm.watson.discovery.v2.model.PushBatchesOptions; import com.ibm.watson.discovery.v2.model.QueryCollectionNoticesOptions; import com.ibm.watson.discovery.v2.model.QueryLargePassages; import com.ibm.watson.discovery.v2.model.QueryLargeSimilar; @@ -2462,6 +2467,175 @@ public void testDeleteEnrichmentNoOptions() throws Throwable { discoveryService.deleteEnrichment(null).execute(); } + // Test the listBatches operation with a valid options model parameter + @Test + public void testListBatchesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = + "{\"batches\": [{\"batch_id\": \"batchId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"enrichment_id\": \"enrichmentId\"}]}"; + String listBatchesPath = "/v2/projects/testString/collections/testString/batches"; + server.enqueue( + new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListBatchesOptions model + ListBatchesOptions listBatchesOptionsModel = + new ListBatchesOptions.Builder().projectId("testString").collectionId("testString").build(); + + // Invoke listBatches() with a valid options model and verify the result + Response response = + discoveryService.listBatches(listBatchesOptionsModel).execute(); + assertNotNull(response); + ListBatchesResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listBatchesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "testString"); + } + + // Test the listBatches operation with and without retries enabled + @Test + public void testListBatchesWRetries() throws Throwable { + discoveryService.enableRetries(4, 30); + testListBatchesWOptions(); + + discoveryService.disableRetries(); + testListBatchesWOptions(); + } + + // Test the listBatches operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListBatchesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + discoveryService.listBatches(null).execute(); + } + + // Test the pullBatches operation with a valid options model parameter + @Test + public void testPullBatchesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"file\": \"file\"}"; + String pullBatchesPath = "/v2/projects/testString/collections/testString/batches/testString"; + server.enqueue( + new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the PullBatchesOptions model + PullBatchesOptions pullBatchesOptionsModel = + new PullBatchesOptions.Builder() + .projectId("testString") + .collectionId("testString") + .batchId("testString") + .build(); + + // Invoke pullBatches() with a valid options model and verify the result + Response response = + discoveryService.pullBatches(pullBatchesOptionsModel).execute(); + assertNotNull(response); + PullBatchesResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, pullBatchesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "testString"); + } + + // Test the pullBatches operation with and without retries enabled + @Test + public void testPullBatchesWRetries() throws Throwable { + discoveryService.enableRetries(4, 30); + testPullBatchesWOptions(); + + discoveryService.disableRetries(); + testPullBatchesWOptions(); + } + + // Test the pullBatches operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPullBatchesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + discoveryService.pullBatches(null).execute(); + } + + // Test the pushBatches operation with a valid options model parameter + @Test + public void testPushBatchesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "false"; + String pushBatchesPath = "/v2/projects/testString/collections/testString/batches/testString"; + server.enqueue( + new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(202) + .setBody(mockResponseBody)); + + // Construct an instance of the PushBatchesOptions model + PushBatchesOptions pushBatchesOptionsModel = + new PushBatchesOptions.Builder() + .projectId("testString") + .collectionId("testString") + .batchId("testString") + .file(TestUtilities.createMockStream("This is a mock file.")) + .filename("testString") + .build(); + + // Invoke pushBatches() with a valid options model and verify the result + Response response = discoveryService.pushBatches(pushBatchesOptionsModel).execute(); + assertNotNull(response); + Boolean responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, pushBatchesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("version"), "testString"); + } + + // Test the pushBatches operation with and without retries enabled + @Test + public void testPushBatchesWRetries() throws Throwable { + discoveryService.enableRetries(4, 30); + testPushBatchesWOptions(); + + discoveryService.disableRetries(); + testPushBatchesWOptions(); + } + + // Test the pushBatches operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPushBatchesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + discoveryService.pushBatches(null).execute(); + } + // Test the listDocumentClassifiers operation with a valid options model parameter @Test public void testListDocumentClassifiersWOptions() throws Throwable { diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/BatchDetailsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/BatchDetailsTest.java new file mode 100644 index 0000000000..5c1dcff29d --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/BatchDetailsTest.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; + +/** Unit test class for the BatchDetails model. */ +public class BatchDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testBatchDetails() throws Throwable { + BatchDetails batchDetailsModel = new BatchDetails(); + assertNull(batchDetailsModel.getEnrichmentId()); + } +} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesOptionsTest.java new file mode 100644 index 0000000000..eaa058224c --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesOptionsTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; + +/** Unit test class for the ListBatchesOptions model. */ +public class ListBatchesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListBatchesOptions() throws Throwable { + ListBatchesOptions listBatchesOptionsModel = + new ListBatchesOptions.Builder().projectId("testString").collectionId("testString").build(); + assertEquals(listBatchesOptionsModel.projectId(), "testString"); + assertEquals(listBatchesOptionsModel.collectionId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListBatchesOptionsError() throws Throwable { + new ListBatchesOptions.Builder().build(); + } +} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesResponseTest.java new file mode 100644 index 0000000000..8e60ce0928 --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/ListBatchesResponseTest.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; + +/** Unit test class for the ListBatchesResponse model. */ +public class ListBatchesResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListBatchesResponse() throws Throwable { + ListBatchesResponse listBatchesResponseModel = new ListBatchesResponse(); + assertNull(listBatchesResponseModel.getBatches()); + } +} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesOptionsTest.java new file mode 100644 index 0000000000..6f434b72ac --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesOptionsTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; + +/** Unit test class for the PullBatchesOptions model. */ +public class PullBatchesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPullBatchesOptions() throws Throwable { + PullBatchesOptions pullBatchesOptionsModel = + new PullBatchesOptions.Builder() + .projectId("testString") + .collectionId("testString") + .batchId("testString") + .build(); + assertEquals(pullBatchesOptionsModel.projectId(), "testString"); + assertEquals(pullBatchesOptionsModel.collectionId(), "testString"); + assertEquals(pullBatchesOptionsModel.batchId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPullBatchesOptionsError() throws Throwable { + new PullBatchesOptions.Builder().build(); + } +} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesResponseTest.java new file mode 100644 index 0000000000..e219749c1e --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PullBatchesResponseTest.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; + +/** Unit test class for the PullBatchesResponse model. */ +public class PullBatchesResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPullBatchesResponse() throws Throwable { + PullBatchesResponse pullBatchesResponseModel = new PullBatchesResponse(); + assertNull(pullBatchesResponseModel.getFile()); + } +} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PushBatchesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PushBatchesOptionsTest.java new file mode 100644 index 0000000000..3926863a99 --- /dev/null +++ b/discovery/src/test/java/com/ibm/watson/discovery/v2/model/PushBatchesOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (C) Copyright IBM Corp. 2024. + * + * 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. + */ + +package com.ibm.watson.discovery.v2.model; + +import static org.testng.Assert.*; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.watson.discovery.v2.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.apache.commons.io.IOUtils; +import org.testng.annotations.Test; + +/** Unit test class for the PushBatchesOptions model. */ +public class PushBatchesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = + TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPushBatchesOptions() throws Throwable { + PushBatchesOptions pushBatchesOptionsModel = + new PushBatchesOptions.Builder() + .projectId("testString") + .collectionId("testString") + .batchId("testString") + .file(TestUtilities.createMockStream("This is a mock file.")) + .filename("testString") + .build(); + assertEquals(pushBatchesOptionsModel.projectId(), "testString"); + assertEquals(pushBatchesOptionsModel.collectionId(), "testString"); + assertEquals(pushBatchesOptionsModel.batchId(), "testString"); + assertEquals( + IOUtils.toString(pushBatchesOptionsModel.file()), + IOUtils.toString(TestUtilities.createMockStream("This is a mock file."))); + assertEquals(pushBatchesOptionsModel.filename(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPushBatchesOptionsError() throws Throwable { + new PushBatchesOptions.Builder().build(); + } +}