Skip to content

Commit

Permalink
feat(discov2): add ocrEnabled parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
apaparazzi0329 committed May 20, 2024
1 parent ebad4d0 commit 45ec51d
Show file tree
Hide file tree
Showing 62 changed files with 330 additions and 205 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2019, 2024.
* (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
Expand Down Expand Up @@ -461,6 +461,9 @@ public ServiceCall<CollectionDetails> createCollection(
if (createCollectionOptions.language() != null) {
contentJson.addProperty("language", createCollectionOptions.language());
}
if (createCollectionOptions.ocrEnabled() != null) {
contentJson.addProperty("ocr_enabled", createCollectionOptions.ocrEnabled());
}
if (createCollectionOptions.enrichments() != null) {
contentJson.add(
"enrichments",
Expand Down Expand Up @@ -555,6 +558,9 @@ public ServiceCall<CollectionDetails> updateCollection(
if (updateCollectionOptions.description() != null) {
contentJson.addProperty("description", updateCollectionOptions.description());
}
if (updateCollectionOptions.ocrEnabled() != null) {
contentJson.addProperty("ocr_enabled", updateCollectionOptions.ocrEnabled());
}
if (updateCollectionOptions.enrichments() != null) {
contentJson.add(
"enrichments",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2019, 2024.
* (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
Expand Down Expand Up @@ -198,8 +198,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand All @@ -210,7 +210,7 @@ public String projectId() {
/**
* Gets the collectionId.
*
* <p>The ID of the collection.
* <p>The Universally Unique Identifier (UUID) of the collection.
*
* @return the collectionId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2024.
* (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
Expand Down Expand Up @@ -183,8 +183,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand All @@ -195,7 +195,7 @@ public String projectId() {
/**
* Gets the collectionId.
*
* <p>The ID of the collection.
* <p>The Universally Unique Identifier (UUID) of the collection.
*
* @return the collectionId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2019, 2023.
* (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
Expand Down Expand Up @@ -28,7 +28,7 @@ protected Collection() {}
/**
* Gets the collectionId.
*
* <p>The unique identifier of the collection.
* <p>The Universally Unique Identifier (UUID) of the collection.
*
* @return the collectionId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2024.
* (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
Expand Down Expand Up @@ -28,6 +28,10 @@ public class CollectionDetails extends GenericModel {
protected String description;
protected Date created;
protected String language;

@SerializedName("ocr_enabled")
protected Boolean ocrEnabled;

protected List<CollectionEnrichment> enrichments;

@SerializedName("smart_document_understanding")
Expand All @@ -38,6 +42,7 @@ public static class Builder {
private String name;
private String description;
private String language;
private Boolean ocrEnabled;
private List<CollectionEnrichment> enrichments;

/**
Expand All @@ -49,6 +54,7 @@ private Builder(CollectionDetails collectionDetails) {
this.name = collectionDetails.name;
this.description = collectionDetails.description;
this.language = collectionDetails.language;
this.ocrEnabled = collectionDetails.ocrEnabled;
this.enrichments = collectionDetails.enrichments;
}

Expand Down Expand Up @@ -121,6 +127,17 @@ public Builder language(String language) {
return this;
}

/**
* Set the ocrEnabled.
*
* @param ocrEnabled the ocrEnabled
* @return the CollectionDetails builder
*/
public Builder ocrEnabled(Boolean ocrEnabled) {
this.ocrEnabled = ocrEnabled;
return this;
}

/**
* Set the enrichments. Existing enrichments will be replaced.
*
Expand All @@ -140,6 +157,7 @@ protected CollectionDetails(Builder builder) {
name = builder.name;
description = builder.description;
language = builder.language;
ocrEnabled = builder.ocrEnabled;
enrichments = builder.enrichments;
}

Expand All @@ -155,7 +173,7 @@ public Builder newBuilder() {
/**
* Gets the collectionId.
*
* <p>The unique identifier of the collection.
* <p>The Universally Unique Identifier (UUID) of the collection.
*
* @return the collectionId
*/
Expand Down Expand Up @@ -208,6 +226,18 @@ public String language() {
return language;
}

/**
* Gets the ocrEnabled.
*
* <p>If set to `true`, optical character recognition (OCR) is enabled. For more information, see
* [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
*
* @return the ocrEnabled
*/
public Boolean ocrEnabled() {
return ocrEnabled;
}

/**
* Gets the enrichments.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class CreateCollectionOptions extends GenericModel {
protected String name;
protected String description;
protected String language;
protected Boolean ocrEnabled;
protected List<CollectionEnrichment> enrichments;

/** Builder. */
Expand All @@ -31,6 +32,7 @@ public static class Builder {
private String name;
private String description;
private String language;
private Boolean ocrEnabled;
private List<CollectionEnrichment> enrichments;

/**
Expand All @@ -43,6 +45,7 @@ private Builder(CreateCollectionOptions createCollectionOptions) {
this.name = createCollectionOptions.name;
this.description = createCollectionOptions.description;
this.language = createCollectionOptions.language;
this.ocrEnabled = createCollectionOptions.ocrEnabled;
this.enrichments = createCollectionOptions.enrichments;
}

Expand Down Expand Up @@ -128,6 +131,17 @@ public Builder language(String language) {
return this;
}

/**
* Set the ocrEnabled.
*
* @param ocrEnabled the ocrEnabled
* @return the CreateCollectionOptions builder
*/
public Builder ocrEnabled(Boolean ocrEnabled) {
this.ocrEnabled = ocrEnabled;
return this;
}

/**
* Set the enrichments. Existing enrichments will be replaced.
*
Expand All @@ -149,6 +163,7 @@ public Builder collectionDetails(CollectionDetails collectionDetails) {
this.name = collectionDetails.name();
this.description = collectionDetails.description();
this.language = collectionDetails.language();
this.ocrEnabled = collectionDetails.ocrEnabled();
this.enrichments = collectionDetails.enrichments();
return this;
}
Expand All @@ -163,6 +178,7 @@ protected CreateCollectionOptions(Builder builder) {
name = builder.name;
description = builder.description;
language = builder.language;
ocrEnabled = builder.ocrEnabled;
enrichments = builder.enrichments;
}

Expand All @@ -178,8 +194,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand Down Expand Up @@ -221,6 +237,18 @@ public String language() {
return language;
}

/**
* Gets the ocrEnabled.
*
* <p>If set to `true`, optical character recognition (OCR) is enabled. For more information, see
* [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
*
* @return the ocrEnabled
*/
public Boolean ocrEnabled() {
return ocrEnabled;
}

/**
* Gets the enrichments.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022, 2024.
* (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
Expand Down Expand Up @@ -247,8 +247,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand All @@ -259,7 +259,7 @@ public String projectId() {
/**
* Gets the classifierId.
*
* <p>The ID of the classifier.
* <p>The Universally Unique Identifier (UUID) of the classifier.
*
* @return the classifierId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022, 2023.
* (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
Expand Down Expand Up @@ -165,8 +165,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2024.
* (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
Expand Down Expand Up @@ -133,8 +133,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022, 2024.
* (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
Expand Down Expand Up @@ -149,8 +149,8 @@ public Builder newBuilder() {
/**
* Gets the projectId.
*
* <p>The ID of the project. This information can be found from the *Integrate and Deploy* page in
* Discovery.
* <p>The Universally Unique Identifier (UUID) of the project. This information can be found from
* the *Integrate and Deploy* page in Discovery.
*
* @return the projectId
*/
Expand All @@ -161,7 +161,7 @@ public String projectId() {
/**
* Gets the collectionId.
*
* <p>The ID of the collection.
* <p>The Universally Unique Identifier (UUID) of the collection.
*
* @return the collectionId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2023.
* (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
Expand All @@ -25,8 +25,13 @@ public class CreateProjectOptions extends GenericModel {
*
* <p>The `content_mining` and `content_intelligence` types are available with Premium plan
* managed deployments and installed deployments only.
*
* <p>The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed
* instances only.
*/
public interface Type {
/** intelligent_document_processing. */
String INTELLIGENT_DOCUMENT_PROCESSING = "intelligent_document_processing";
/** document_retrieval. */
String DOCUMENT_RETRIEVAL = "document_retrieval";
/** conversational_search. */
Expand Down Expand Up @@ -158,6 +163,9 @@ public String name() {
* <p>The `content_mining` and `content_intelligence` types are available with Premium plan
* managed deployments and installed deployments only.
*
* <p>The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed
* instances only.
*
* @return the type
*/
public String type() {
Expand Down
Loading

0 comments on commit 45ec51d

Please sign in to comment.