This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ac892fc4de6b CAMEL-26243: camel-google-sheets - remove
spreadsheets/developerMetadata, sheets and values, the accessors of
sub-resources that failed with a ClassCastException, and document that
splitResult has no effect (#28959)
ac892fc4de6b is described below
commit ac892fc4de6bb6d1b0f44472744954e858be536e
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Nov 2 22:51:50 2026 +0100
CAMEL-26243: camel-google-sheets - remove spreadsheets/developerMetadata,
sheets and values, the accessors of sub-resources that failed with a
ClassCastException, and document that splitResult has no effect (#28959)
* CAMEL-26243: camel-google-sheets - remove spreadsheets/developerMetadata,
sheets and values, the accessors of sub-resources that failed with a
ClassCastException, and document that splitResult has no effect
* CAMEL-26243: camel-google-sheets - the methodName enum lists all the
method names of the APIs, so the catalog accepts data/batchGet and the other
batch and data filter methods
Signed-off-by: Andrea Cosentino <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../camel/catalog/components/google-sheets.json | 8 +-
.../catalog/docs/google-sheets-component.adoc | 9 ++
.../camel-google/camel-google-sheets/pom.xml | 3 +
.../SheetsSpreadsheetsEndpointConfiguration.java | 2 +-
.../internal/SheetsSpreadsheetsApiMethod.java | 14 +--
.../component/google/sheets/google-sheets.json | 8 +-
.../src/main/docs/google-sheets-component.adoc | 9 ++
.../google/sheets/GoogleSheetsConfiguration.java | 2 +-
.../google/sheets/GoogleSheetsEndpoint.java | 4 +-
.../google/sheets/GoogleSheetsApiMethodsTest.java | 114 +++++++++++++++++++++
.../GoogleSheetsConsumerSplitResultTest.java | 37 +++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 4 +
.../builder/endpoint/StaticEndpointBuilders.java | 10 +-
.../dsl/GoogleSheetsEndpointBuilderFactory.java | 10 +-
14 files changed, 202 insertions(+), 32 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json
index becaa89b4015..d228cb2fa04d 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/google-sheets.json
@@ -42,13 +42,13 @@
"serviceAccountKey": { "index": 13, "kind": "property", "displayName":
"Service Account Key", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Sets .json file with
credentials for Service account" }
},
"bodyTypes": {
- "consumerOut": { "carriers": [ "pojo" ], "description": "One message per
poll with the return value of the method: a Google Sheets model object, such as
the ValueRange of data\/get, which is one message and not split per row. The
model classes are GenericJson, which is also a Map of the JSON fields" },
+ "consumerOut": { "carriers": [ "pojo" ], "description": "One message per
poll with the return value of the method: a Google Sheets model object, such as
the ValueRange of data\/get, which is one message and not split per row. No
method returns a list, so splitResult has no effect: google-sheets-stream with
splitResults gives one message per row. The model classes are GenericJson,
which is also a Map of the JSON fields" },
"producerIn": { "carriers": [ "any" ], "dependsOn": [ "inBody" ],
"description": "The body is used only when inBody names a parameter of the
method, and must then be of the type of that parameter: a ValueRange for values
of data\/append and data\/update, a Spreadsheet for content of
spreadsheets\/create, or text for spreadsheetId. A List of rows, JSON text or a
Map is not turned into a model object: put the rows in a ValueRange, or use the
google-sheets:application-x-struct transform [...]
"producerOut": { "carriers": [ "pojo" ], "description": "The return value
of the method: a Google Sheets model object, such as the ValueRange of
data\/get, the AppendValuesResponse of data\/append or the Spreadsheet of
spreadsheets\/get. The model classes are GenericJson, which is also a Map of
the JSON fields" }
},
"properties": {
"apiName": { "index": 0, "kind": "path", "displayName": "Api Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.google.sheets.internal.GoogleSheetsApiName",
"enum": [ "SPREADSHEETS", "DATA" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "What [...]
- "methodName": { "index": 1, "kind": "path", "displayName": "Method Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"java.lang.String", "enum": [ "create", "get", "update", "append",
"batchUpdate", "clear" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "What sub operat [...]
+ "methodName": { "index": 1, "kind": "path", "displayName": "Method Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"java.lang.String", "enum": [ "append", "batchClear", "batchClearByDataFilter",
"batchGet", "batchGetByDataFilter", "batchUpdate", "batchUpdateByDataFilter",
"clear", "create", "get", "getByDataFilter", "update" ], "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false,
"configurationClass": "org.apache.camel. [...]
"applicationName": { "index": 2, "kind": "parameter", "displayName":
"Application Name", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Google Sheets
application name. Example would be camel-google-sheets\/1.0" },
"clientId": { "index": 3, "kind": "parameter", "displayName": "Client Id",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Client ID of the sheets
application" },
"delegate": { "index": 4, "kind": "parameter", "displayName": "Delegate",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Delegate for wide-domain
service account" },
@@ -82,10 +82,10 @@
},
"apis": {
"data": { "consumerOnly": false, "producerOnly": false, "description":
"The values collection of methods", "methods": { "append": { "description":
"Appends values to a spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$Values$Append
append(String spreadsheetId, String range,
com.google.api.services.sheets.v4.model.ValueRange content)" ] }, "batchClear":
{ "description": "Clears one or more ranges of values from a spreadsheet",
"signatures": [ "com.go [...]
- "spreadsheets": { "consumerOnly": false, "producerOnly": false,
"description": "The spreadsheets collection of methods", "methods": {
"batchUpdate": { "description": "Applies one or more updates to the
spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest content)"
] }, "create": { "description": "Creates a spreadsheet, returning the newly
[...]
+ "spreadsheets": { "consumerOnly": false, "producerOnly": false,
"description": "The spreadsheets collection of methods", "methods": {
"batchUpdate": { "description": "Applies one or more updates to the
spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest content)"
] }, "create": { "description": "Creates a spreadsheet, returning the newly
[...]
},
"apiProperties": {
"data": { "methods": { "append": { "properties": {
"includeValuesInResponse": { "index": 0, "kind": "parameter", "displayName":
"Include Values In Response", "group": "common", "label": "", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Determines if the update response should include the values of the cells that
were appended", "optional": true }, "insertDataOptio [...]
- "spreadsheets": { "methods": { "batchUpdate": { "properties": {
"batchUpdateSpreadsheetRequest": { "index": 0, "kind": "parameter",
"displayName": "Batch Update Spreadsheet Request", "group": "common", "label":
"", "required": false, "type": "object", "javaType":
"com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest",
"deprecated": false, "autowired": false, "secret": false, "description": "The
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest", " [...]
+ "spreadsheets": { "methods": { "batchUpdate": { "properties": {
"batchUpdateSpreadsheetRequest": { "index": 0, "kind": "parameter",
"displayName": "Batch Update Spreadsheet Request", "group": "common", "label":
"", "required": false, "type": "object", "javaType":
"com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest",
"deprecated": false, "autowired": false, "secret": false, "description": "The
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest", " [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-sheets-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-sheets-component.adoc
index a2a3101ff17f..c31e37b19f4b 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-sheets-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/google-sheets-component.adoc
@@ -103,6 +103,15 @@ The following route reads a range of a spreadsheet; the
result is a `ValueRange`
message: "Rows: ${body.values}"
----
+The values of a spreadsheet are read and written with the `data` API, such as
`data/get`, `data/update` and
+`data/append`; the `spreadsheets` API works on the spreadsheet itself, such as
`spreadsheets/create` and
+`spreadsheets/get`.
+
+The consumer calls the method on every poll and sends one message with the
result, such as the `ValueRange` of
+`data/get` with all the rows of the range. No method returns a list, so the
`splitResult` option has no effect on
+this component: it does not give one message per row. For one message per row,
use the
+xref:google-sheets-stream-component.adoc[Google Sheets Stream] component with
`splitResults=true`.
+
== ValueInputOption
Many of the APIs with Google sheets require including the following header,
diff --git a/components/camel-google/camel-google-sheets/pom.xml
b/components/camel-google/camel-google-sheets/pom.xml
index de8c58ceace4..f1e05fa4f320 100644
--- a/components/camel-google/camel-google-sheets/pom.xml
+++ b/components/camel-google/camel-google-sheets/pom.xml
@@ -188,6 +188,9 @@
<proxyClass>com.google.api.services.sheets.v4.Sheets$Spreadsheets</proxyClass>
<fromJavasource>
<includeSetters>true</includeSetters>
+ <!-- developerMetadata(), sheets() and
values() return a sub-resource, not a
+ request: the methods of values()
are the data API -->
+
<excludeMethods>\s(developerMetadata|sheets|values)\(\)$</excludeMethods>
</fromJavasource>
</api>
<api>
diff --git
a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfiguration.java
b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfiguration.java
index b386bff5e074..91cd455b4dbf 100644
---
a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfiguration.java
+++
b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/SheetsSpreadsheetsEndpointConfiguration.java
@@ -17,7 +17,7 @@ import org.apache.camel.spi.UriParams;
*/
@ApiParams(apiName = "spreadsheets",
description = "The spreadsheets collection of methods",
- apiMethods = {@ApiMethod(methodName = "batchUpdate",
description="Applies one or more updates to the spreadsheet",
signatures={"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest
content)"}), @ApiMethod(methodName = "create", description="Creates a
spreadsheet, returning the newly created spreadsheet",
signatures={"com.google.api.services.sheets.v4.Sheets$Spre [...]
+ apiMethods = {@ApiMethod(methodName = "batchUpdate",
description="Applies one or more updates to the spreadsheet",
signatures={"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest
content)"}), @ApiMethod(methodName = "create", description="Creates a
spreadsheet, returning the newly created spreadsheet",
signatures={"com.google.api.services.sheets.v4.Sheets$Spre [...]
@UriParams
@Configurer(extended = true)
@Generated("org.apache.camel.maven.ApiComponentGeneratorMojo")
diff --git
a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/internal/SheetsSpreadsheetsApiMethod.java
b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/internal/SheetsSpreadsheetsApiMethod.java
index 92754e2a3ac3..42b97de5e575 100644
---
a/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/internal/SheetsSpreadsheetsApiMethod.java
+++
b/components/camel-google/camel-google-sheets/src/generated/java/org/apache/camel/component/google/sheets/internal/SheetsSpreadsheetsApiMethod.java
@@ -33,10 +33,6 @@ public enum SheetsSpreadsheetsApiMethod implements ApiMethod
{
"create",
arg("content",
com.google.api.services.sheets.v4.model.Spreadsheet.class)),
- DEVELOPER_METADATA(
-
com.google.api.services.sheets.v4.Sheets.Spreadsheets.DeveloperMetadata.class,
- "developerMetadata"),
-
GET(
com.google.api.services.sheets.v4.Sheets.Spreadsheets.Get.class,
"get",
@@ -49,15 +45,7 @@ public enum SheetsSpreadsheetsApiMethod implements ApiMethod
{
com.google.api.services.sheets.v4.Sheets.Spreadsheets.GetByDataFilter.class,
"getByDataFilter",
arg("spreadsheetId", String.class),
- arg("getSpreadsheetByDataFilterRequest",
com.google.api.services.sheets.v4.model.GetSpreadsheetByDataFilterRequest.class)),
-
- SHEETS(
-
com.google.api.services.sheets.v4.Sheets.Spreadsheets.SheetsOperations.class,
- "sheets"),
-
- VALUES(
- com.google.api.services.sheets.v4.Sheets.Spreadsheets.Values.class,
- "values");
+ arg("getSpreadsheetByDataFilterRequest",
com.google.api.services.sheets.v4.model.GetSpreadsheetByDataFilterRequest.class));
private final ApiMethod apiMethod;
diff --git
a/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json
b/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json
index becaa89b4015..d228cb2fa04d 100644
---
a/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json
+++
b/components/camel-google/camel-google-sheets/src/generated/resources/META-INF/org/apache/camel/component/google/sheets/google-sheets.json
@@ -42,13 +42,13 @@
"serviceAccountKey": { "index": 13, "kind": "property", "displayName":
"Service Account Key", "group": "security", "label": "security", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Sets .json file with
credentials for Service account" }
},
"bodyTypes": {
- "consumerOut": { "carriers": [ "pojo" ], "description": "One message per
poll with the return value of the method: a Google Sheets model object, such as
the ValueRange of data\/get, which is one message and not split per row. The
model classes are GenericJson, which is also a Map of the JSON fields" },
+ "consumerOut": { "carriers": [ "pojo" ], "description": "One message per
poll with the return value of the method: a Google Sheets model object, such as
the ValueRange of data\/get, which is one message and not split per row. No
method returns a list, so splitResult has no effect: google-sheets-stream with
splitResults gives one message per row. The model classes are GenericJson,
which is also a Map of the JSON fields" },
"producerIn": { "carriers": [ "any" ], "dependsOn": [ "inBody" ],
"description": "The body is used only when inBody names a parameter of the
method, and must then be of the type of that parameter: a ValueRange for values
of data\/append and data\/update, a Spreadsheet for content of
spreadsheets\/create, or text for spreadsheetId. A List of rows, JSON text or a
Map is not turned into a model object: put the rows in a ValueRange, or use the
google-sheets:application-x-struct transform [...]
"producerOut": { "carriers": [ "pojo" ], "description": "The return value
of the method: a Google Sheets model object, such as the ValueRange of
data\/get, the AppendValuesResponse of data\/append or the Spreadsheet of
spreadsheets\/get. The model classes are GenericJson, which is also a Map of
the JSON fields" }
},
"properties": {
"apiName": { "index": 0, "kind": "path", "displayName": "Api Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.google.sheets.internal.GoogleSheetsApiName",
"enum": [ "SPREADSHEETS", "DATA" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "What [...]
- "methodName": { "index": 1, "kind": "path", "displayName": "Method Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"java.lang.String", "enum": [ "create", "get", "update", "append",
"batchUpdate", "clear" ], "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "What sub operat [...]
+ "methodName": { "index": 1, "kind": "path", "displayName": "Method Name",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"java.lang.String", "enum": [ "append", "batchClear", "batchClearByDataFilter",
"batchGet", "batchGetByDataFilter", "batchUpdate", "batchUpdateByDataFilter",
"clear", "create", "get", "getByDataFilter", "update" ], "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false,
"configurationClass": "org.apache.camel. [...]
"applicationName": { "index": 2, "kind": "parameter", "displayName":
"Application Name", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Google Sheets
application name. Example would be camel-google-sheets\/1.0" },
"clientId": { "index": 3, "kind": "parameter", "displayName": "Client Id",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Client ID of the sheets
application" },
"delegate": { "index": 4, "kind": "parameter", "displayName": "Delegate",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.google.sheets.GoogleSheetsConfiguration",
"configurationField": "configuration", "description": "Delegate for wide-domain
service account" },
@@ -82,10 +82,10 @@
},
"apis": {
"data": { "consumerOnly": false, "producerOnly": false, "description":
"The values collection of methods", "methods": { "append": { "description":
"Appends values to a spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$Values$Append
append(String spreadsheetId, String range,
com.google.api.services.sheets.v4.model.ValueRange content)" ] }, "batchClear":
{ "description": "Clears one or more ranges of values from a spreadsheet",
"signatures": [ "com.go [...]
- "spreadsheets": { "consumerOnly": false, "producerOnly": false,
"description": "The spreadsheets collection of methods", "methods": {
"batchUpdate": { "description": "Applies one or more updates to the
spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest content)"
] }, "create": { "description": "Creates a spreadsheet, returning the newly
[...]
+ "spreadsheets": { "consumerOnly": false, "producerOnly": false,
"description": "The spreadsheets collection of methods", "methods": {
"batchUpdate": { "description": "Applies one or more updates to the
spreadsheet", "signatures": [
"com.google.api.services.sheets.v4.Sheets$Spreadsheets$BatchUpdate
batchUpdate(String spreadsheetId,
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest content)"
] }, "create": { "description": "Creates a spreadsheet, returning the newly
[...]
},
"apiProperties": {
"data": { "methods": { "append": { "properties": {
"includeValuesInResponse": { "index": 0, "kind": "parameter", "displayName":
"Include Values In Response", "group": "common", "label": "", "required":
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Determines if the update response should include the values of the cells that
were appended", "optional": true }, "insertDataOptio [...]
- "spreadsheets": { "methods": { "batchUpdate": { "properties": {
"batchUpdateSpreadsheetRequest": { "index": 0, "kind": "parameter",
"displayName": "Batch Update Spreadsheet Request", "group": "common", "label":
"", "required": false, "type": "object", "javaType":
"com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest",
"deprecated": false, "autowired": false, "secret": false, "description": "The
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest", " [...]
+ "spreadsheets": { "methods": { "batchUpdate": { "properties": {
"batchUpdateSpreadsheetRequest": { "index": 0, "kind": "parameter",
"displayName": "Batch Update Spreadsheet Request", "group": "common", "label":
"", "required": false, "type": "object", "javaType":
"com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest",
"deprecated": false, "autowired": false, "secret": false, "description": "The
com.google.api.services.sheets.v4.model.BatchUpdateSpreadsheetRequest", " [...]
}
}
diff --git
a/components/camel-google/camel-google-sheets/src/main/docs/google-sheets-component.adoc
b/components/camel-google/camel-google-sheets/src/main/docs/google-sheets-component.adoc
index a2a3101ff17f..c31e37b19f4b 100644
---
a/components/camel-google/camel-google-sheets/src/main/docs/google-sheets-component.adoc
+++
b/components/camel-google/camel-google-sheets/src/main/docs/google-sheets-component.adoc
@@ -103,6 +103,15 @@ The following route reads a range of a spreadsheet; the
result is a `ValueRange`
message: "Rows: ${body.values}"
----
+The values of a spreadsheet are read and written with the `data` API, such as
`data/get`, `data/update` and
+`data/append`; the `spreadsheets` API works on the spreadsheet itself, such as
`spreadsheets/create` and
+`spreadsheets/get`.
+
+The consumer calls the method on every poll and sends one message with the
result, such as the `ValueRange` of
+`data/get` with all the rows of the range. No method returns a list, so the
`splitResult` option has no effect on
+this component: it does not give one message per row. For one message per row,
use the
+xref:google-sheets-stream-component.adoc[Google Sheets Stream] component with
`splitResults=true`.
+
== ValueInputOption
Many of the APIs with Google sheets require including the following header,
diff --git
a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java
b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java
index 40aaa1306384..b1c136618853 100644
---
a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java
+++
b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsConfiguration.java
@@ -38,7 +38,7 @@ public class GoogleSheetsConfiguration extends
AbstractApiConfiguration implemen
@UriPath
@Metadata(required = true)
private GoogleSheetsApiName apiName;
- @UriPath(enums = "create,get,update,append,batchUpdate,clear")
+ @UriPath(enums =
"append,batchClear,batchClearByDataFilter,batchGet,batchGetByDataFilter,batchUpdate,batchUpdateByDataFilter,clear,create,get,getByDataFilter,update")
@Metadata(required = true)
private String methodName;
@UriParam
diff --git
a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpoint.java
b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpoint.java
index 3f184a39c5f4..14d77cde6dbf 100644
---
a/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpoint.java
+++
b/components/camel-google/camel-google-sheets/src/main/java/org/apache/camel/component/google/sheets/GoogleSheetsEndpoint.java
@@ -49,7 +49,9 @@ import org.apache.camel.util.ObjectHelper;
@BodyTypes(consumerOut = @BodyType(value = Carrier.POJO,
description = "One message per poll with
the return value of the method: a Google"
+ " Sheets model object, such
as the ValueRange of data/get, which is one"
- + " message and not split per
row. The model classes are GenericJson, which"
+ + " message and not split per
row. No method returns a list, so"
+ + " splitResult has no
effect: google-sheets-stream with splitResults"
+ + " gives one message per
row. The model classes are GenericJson, which"
+ " is also a Map of the JSON
fields"),
producerIn = @BodyType(value = Carrier.ANY, dependsOn = "inBody",
description = "The body is used only when
inBody names a parameter of the method, and"
diff --git
a/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsApiMethodsTest.java
b/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsApiMethodsTest.java
new file mode 100644
index 000000000000..7409bffdedb9
--- /dev/null
+++
b/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsApiMethodsTest.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.camel.component.google.sheets;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
+import com.google.api.client.json.Json;
+import com.google.api.client.testing.http.MockLowLevelHttpResponse;
+import com.google.api.services.sheets.v4.model.ValueRange;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ResolveEndpointFailedException;
+import
org.apache.camel.component.google.sheets.internal.GoogleSheetsApiCollection;
+import org.apache.camel.component.google.sheets.internal.GoogleSheetsApiName;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.component.ApiMethod;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The producer and the consumer execute the request that the method of the
API builds. The accessors of the
+ * sub-resources of Sheets.Spreadsheets, such as values(), build no request,
so they must not be methods of the
+ * component.
+ */
+class GoogleSheetsApiMethodsTest {
+
+ private static final String OAUTH =
"clientId=id&clientSecret=secret&refreshToken=token";
+
+ @Test
+ void shouldOnlyHaveMethodsThatBuildARequest() {
+ List<String> notRequests = new ArrayList<>();
+ for (Map.Entry<Class<? extends ApiMethod>, GoogleSheetsApiName> api :
GoogleSheetsApiCollection.getCollection()
+ .getApiMethods().entrySet()) {
+ for (ApiMethod method : api.getKey().getEnumConstants()) {
+ if
(!AbstractGoogleClientRequest.class.isAssignableFrom(method.getResultType())) {
+ notRequests.add(api.getValue().getName() + "/" +
method.getName());
+ }
+ }
+ }
+
+ assertEquals(List.of(), notRequests, "These methods build no request");
+ }
+
+ @Test
+ void shouldListTheMethodNamesOfTheApisInTheMethodNameOption() throws
Exception {
+ Set<String> methodNames = new TreeSet<>();
+ for (Class<? extends ApiMethod> api :
GoogleSheetsApiCollection.getCollection().getApiMethods().keySet()) {
+ for (ApiMethod method : api.getEnumConstants()) {
+ methodNames.add(method.getName());
+ }
+ }
+ String enums =
GoogleSheetsConfiguration.class.getDeclaredField("methodName").getAnnotation(UriPath.class).enums();
+
+ assertEquals(methodNames, new
TreeSet<>(Arrays.asList(enums.split(","))));
+ }
+
+ @ParameterizedTest
+ @ValueSource(strings = { "developerMetadata", "sheets", "values" })
+ void shouldRejectTheSubResourceAccessorsOfSpreadsheets(String accessor)
throws Exception {
+ try (CamelContext context = createContext(new
MockLowLevelHttpResponse())) {
+ // the accessors take no argument, so no option is given that
would rule them out
+ ResolveEndpointFailedException e =
assertThrows(ResolveEndpointFailedException.class,
+ () -> context.getEndpoint("google-sheets://spreadsheets/"
+ accessor + "?" + OAUTH));
+
+ assertTrue(e.getMessage().contains("No matching method for
spreadsheets/" + accessor), e.getMessage());
+ }
+ }
+
+ @Test
+ void shouldReadTheValuesWithTheDataApi() throws Exception {
+ MockLowLevelHttpResponse response = new
MockLowLevelHttpResponse().setContentType(Json.MEDIA_TYPE)
+ .setContent(
+
"{\"range\":\"Sheet1!A1:B2\",\"majorDimension\":\"ROWS\",\"values\":[[\"a\",\"b\"],[\"c\",\"d\"]]}");
+ try (CamelContext context = createContext(response)) {
+ ValueRange body = context.createProducerTemplate().requestBody(
+
"google-sheets://data/get?spreadsheetId=abc&range=Sheet1!A1:B2&" + OAUTH, null,
ValueRange.class);
+
+ assertEquals(List.of(List.of("a", "b"), List.of("c", "d")),
body.getValues());
+ }
+ }
+
+ private static CamelContext createContext(MockLowLevelHttpResponse
response) {
+ CamelContext context = new DefaultCamelContext();
+ context.getComponent("google-sheets", GoogleSheetsComponent.class)
+ .setClientFactory(new MockGoogleSheetsClientFactory(response));
+ context.start();
+ return context;
+ }
+}
diff --git
a/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsConsumerSplitResultTest.java
b/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsConsumerSplitResultTest.java
index d0af95e07cb9..4ed56ce6b220 100644
---
a/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsConsumerSplitResultTest.java
+++
b/components/camel-google/camel-google-sheets/src/test/java/org/apache/camel/component/google/sheets/GoogleSheetsConsumerSplitResultTest.java
@@ -17,14 +17,21 @@
package org.apache.camel.component.google.sheets;
import java.util.Collection;
+import java.util.List;
import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.Json;
import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.testing.http.MockLowLevelHttpResponse;
import com.google.api.services.sheets.v4.Sheets;
+import com.google.api.services.sheets.v4.model.ValueRange;
import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -49,6 +56,36 @@ class GoogleSheetsConsumerSplitResultTest {
}
}
+ @Test
+ void shouldSendTheResultAsOneMessageAlthoughSplitResultIsOn() throws
Exception {
+ // no method returns a list: the ValueRange of data/get is one message
with all the rows
+ MockLowLevelHttpResponse response = new
MockLowLevelHttpResponse().setContentType(Json.MEDIA_TYPE)
+
.setContent("{\"range\":\"Sheet1!A1:A3\",\"values\":[[\"a\"],[\"b\"],[\"c\"]]}");
+ try (CamelContext context = new DefaultCamelContext()) {
+ context.getComponent("google-sheets", GoogleSheetsComponent.class)
+ .setClientFactory(new
MockGoogleSheetsClientFactory(response));
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+
from("google-sheets://data/get?spreadsheetId=abc&range=Sheet1!A1:A3&repeatCount=1"
+ +
"&clientId=id&clientSecret=secret&refreshToken=token")
+ .to("mock:result");
+ }
+ });
+ MockEndpoint mock = context.getEndpoint("mock:result",
MockEndpoint.class);
+ mock.expectedMessageCount(1);
+ // a split result would send the other rows right after the first
one
+ mock.setAssertPeriod(500);
+
+ context.start();
+
+ mock.assertIsSatisfied();
+
+ ValueRange body =
mock.getReceivedExchanges().get(0).getIn().getBody(ValueRange.class);
+ assertEquals(List.of(List.of("a"), List.of("b"), List.of("c")),
body.getValues());
+ }
+ }
+
private static CamelContext createContext() {
CamelContext context = new DefaultCamelContext();
context.getComponent("google-sheets",
GoogleSheetsComponent.class).setClientFactory(new TestClientFactory());
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 385197422a05..dbaab987052d 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -2593,6 +2593,10 @@ of a `JsonArray`.
A route that needs the old single header of the producer can set the header to
a String, for example with
`String.valueOf(list)`.
+=== camel-google-sheets - spreadsheets/developerMetadata, sheets and values
removed
+
+The `developerMetadata`, `sheets` and `values` methods of the `spreadsheets`
API are removed. They were accessors of sub-resources and not requests, so
every call failed with a `ClassCastException`; a route with one of these
endpoints now fails when it starts. Read and write the values of a spreadsheet
with the `data` API, such as `data/get` and `data/update`.
+
=== camel-http - a header with several values is sent as several headers
A message header whose value is a `java.util.Collection` or an object array
(as the HTTP consumers map a request
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
index 754f13ec2b02..215d8348c841 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java
@@ -6845,8 +6845,9 @@ public class StaticEndpointBuilders {
*
* Path parameter: methodName (required)
* What sub operation to use for the selected operation
- * There are 6 enums and the value can be one of: create, get, update,
- * append, batchUpdate, clear
+ * There are 12 enums and the value can be one of: append, batchClear,
+ * batchClearByDataFilter, batchGet, batchGetByDataFilter, batchUpdate,
+ * batchUpdateByDataFilter, clear, create, get, getByDataFilter, update
*
* @param path apiName/methodName
* @return the dsl builder
@@ -6870,8 +6871,9 @@ public class StaticEndpointBuilders {
*
* Path parameter: methodName (required)
* What sub operation to use for the selected operation
- * There are 6 enums and the value can be one of: create, get, update,
- * append, batchUpdate, clear
+ * There are 12 enums and the value can be one of: append, batchClear,
+ * batchClearByDataFilter, batchGet, batchGetByDataFilter, batchUpdate,
+ * batchUpdateByDataFilter, clear, create, get, getByDataFilter, update
*
* @param componentName to use a custom component name for the endpoint
* instead of the default name
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java
index 170ca391df03..15b22543bc5e 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GoogleSheetsEndpointBuilderFactory.java
@@ -1244,8 +1244,9 @@ public interface GoogleSheetsEndpointBuilderFactory {
*
* Path parameter: methodName (required)
* What sub operation to use for the selected operation
- * There are 6 enums and the value can be one of: create, get, update,
- * append, batchUpdate, clear
+ * There are 12 enums and the value can be one of: append, batchClear,
+ * batchClearByDataFilter, batchGet, batchGetByDataFilter, batchUpdate,
+ * batchUpdateByDataFilter, clear, create, get, getByDataFilter, update
*
* @param path apiName/methodName
* @return the dsl builder
@@ -1269,8 +1270,9 @@ public interface GoogleSheetsEndpointBuilderFactory {
*
* Path parameter: methodName (required)
* What sub operation to use for the selected operation
- * There are 6 enums and the value can be one of: create, get, update,
- * append, batchUpdate, clear
+ * There are 12 enums and the value can be one of: append, batchClear,
+ * batchClearByDataFilter, batchGet, batchGetByDataFilter, batchUpdate,
+ * batchUpdateByDataFilter, clear, create, get, getByDataFilter, update
*
* @param componentName to use a custom component name for the endpoint
* instead of the default name