This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit a3635bfe5fa60da26d4648a82eaadb62838e149a Author: Nicolas Filotto <[email protected]> AuthorDate: Wed Apr 6 09:46:44 2022 +0200 CAMEL-17792: Add doc about the message headers of camel-twitter --- .../directmessage/twitter-directmessage.json | 4 ++++ .../component/twitter/search/twitter-search.json | 9 ++++++++ .../twitter/timeline/twitter-timeline.json | 3 +++ .../main/docs/twitter-directmessage-component.adoc | 4 +++- .../src/main/docs/twitter-search-component.adoc | 4 +++- .../src/main/docs/twitter-timeline-component.adoc | 4 +++- .../camel/component/twitter/TwitterConstants.java | 25 ++++++++++++++++++++++ .../TwitterDirectMessageEndpoint.java | 7 ++++-- .../twitter/search/TwitterSearchEndpoint.java | 8 +++++-- .../twitter/timeline/TwitterTimelineEndpoint.java | 6 ++++-- 10 files changed, 65 insertions(+), 9 deletions(-) diff --git a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/directmessage/twitter-directmessage.json b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/directmessage/twitter-directmessage.json index a8810fb1769..2ffe4ede779 100644 --- a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/directmessage/twitter-directmessage.json +++ b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/directmessage/twitter-directmessage.json @@ -35,6 +35,10 @@ "consumerKey": { "kind": "property", "displayName": "Consumer Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer key" }, "consumerSecret": { "kind": "property", "displayName": "Consumer Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer secret" } }, + "headers": { + "CamelTwitterUser": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The user" }, + "CamelTwitterEventType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of event. The supported values are the values of the enum org.apache.camel.component.twitter.consumer.TwitterEventType" } + }, "properties": { "user": { "kind": "path", "displayName": "User", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The user name to send a direct message. This will be ignored for consumer." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...] diff --git a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/search/twitter-search.json b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/search/twitter-search.json index a53d3268905..de7de1d79c3 100644 --- a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/search/twitter-search.json +++ b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/search/twitter-search.json @@ -35,6 +35,15 @@ "consumerKey": { "kind": "property", "displayName": "Consumer Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer key" }, "consumerSecret": { "kind": "property", "displayName": "Consumer Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer secret" } }, + "headers": { + "CamelTwitterKeywords": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The keywords to search" }, + "CamelTwitterSearchLanguage": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The lang string ISO_639-1 which will be used for searching" }, + "CamelTwitterCount": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Limiting number of results per page." }, + "CamelTwitterNumberOfPages": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of pages result which you want camel-twitter to consume." }, + "CamelTwitterSinceId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The last tweet id which will be used for pulling the tweets. It is useful when the camel route is restarted after a long-running." }, + "CamelTwitterMaxId": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "If specified, returns tweets with status ids less than the given id." }, + "CamelTwitterEventType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of event. The supported values are the values of the enum org.apache.camel.component.twitter.consumer.TwitterEventType" } + }, "properties": { "keywords": { "kind": "path", "displayName": "Keywords", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The search query, use the keywords AND, OR, - and () to narrow the search results." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...] diff --git a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/timeline/twitter-timeline.json b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/timeline/twitter-timeline.json index 554a239c3a8..916bfff1eaf 100644 --- a/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/timeline/twitter-timeline.json +++ b/components/camel-twitter/src/generated/resources/org/apache/camel/component/twitter/timeline/twitter-timeline.json @@ -35,6 +35,9 @@ "consumerKey": { "kind": "property", "displayName": "Consumer Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer key" }, "consumerSecret": { "kind": "property", "displayName": "Consumer Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "The consumer secret" } }, + "headers": { + "CamelTwitterEventType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of event. The supported values are the values of the enum org.apache.camel.component.twitter.consumer.TwitterEventType" } + }, "properties": { "timelineType": { "kind": "path", "displayName": "Timeline Type", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.twitter.data.TimelineType", "enum": [ "PUBLIC", "HOME", "USER", "MENTIONS", "RETWEETSOFME", "LIST", "UNKNOWN" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The timeline type to produce\/consume." }, "list": { "kind": "parameter", "displayName": "List", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The list name when using timelineType=list" }, diff --git a/components/camel-twitter/src/main/docs/twitter-directmessage-component.adoc b/components/camel-twitter/src/main/docs/twitter-directmessage-component.adoc index db33c431e1d..a5c8d1694c2 100644 --- a/components/camel-twitter/src/main/docs/twitter-directmessage-component.adoc +++ b/components/camel-twitter/src/main/docs/twitter-directmessage-component.adoc @@ -35,7 +35,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END diff --git a/components/camel-twitter/src/main/docs/twitter-search-component.adoc b/components/camel-twitter/src/main/docs/twitter-search-component.adoc index 36083192a5c..aafadff14b5 100644 --- a/components/camel-twitter/src/main/docs/twitter-search-component.adoc +++ b/components/camel-twitter/src/main/docs/twitter-search-component.adoc @@ -27,7 +27,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END diff --git a/components/camel-twitter/src/main/docs/twitter-timeline-component.adoc b/components/camel-twitter/src/main/docs/twitter-timeline-component.adoc index 3500bc7e567..9d2bfee6e3f 100644 --- a/components/camel-twitter/src/main/docs/twitter-timeline-component.adoc +++ b/components/camel-twitter/src/main/docs/twitter-timeline-component.adoc @@ -28,7 +28,9 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: START // endpoint options: END - +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END include::spring-boot:partial$starter.adoc[] diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConstants.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConstants.java index 3f06b2683da..0c7ca2cd1bd 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConstants.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConstants.java @@ -16,17 +16,42 @@ */ package org.apache.camel.component.twitter; +import org.apache.camel.spi.Metadata; + /** * Defines common constants */ public interface TwitterConstants { + + // The schemes + String SCHEME_TIMELINE = "twitter-timeline"; + String SCHEME_SEARCH = "twitter-search"; + String SCHEME_DIRECT_MESSAGE = "twitter-directmessage"; + + @Metadata(description = "The keywords to search", javaType = "String", applicableFor = SCHEME_SEARCH) String TWITTER_KEYWORDS = "CamelTwitterKeywords"; + @Metadata(description = "The lang string ISO_639-1 which will be used for searching", javaType = "String", + applicableFor = SCHEME_SEARCH) String TWITTER_SEARCH_LANGUAGE = "CamelTwitterSearchLanguage"; + @Metadata(description = "Limiting number of results per page.", javaType = "Integer", applicableFor = SCHEME_SEARCH) String TWITTER_COUNT = "CamelTwitterCount"; + @Metadata(description = "The number of pages result which you want camel-twitter to consume.", javaType = "Integer", + applicableFor = SCHEME_SEARCH) String TWITTER_NUMBER_OF_PAGES = "CamelTwitterNumberOfPages"; + /** + * The last tweet id which will be used for pulling the tweets. It is useful when the camel route is restarted after + * a long-running. + */ + @Metadata(javaType = "Long", applicableFor = SCHEME_SEARCH) String TWITTER_SINCEID = "CamelTwitterSinceId"; + @Metadata(description = "If specified, returns tweets with status ids less than the given id.", javaType = "Long", + applicableFor = SCHEME_SEARCH) String TWITTER_MAXID = "CamelTwitterMaxId"; + @Metadata(description = "The user", javaType = "String", applicableFor = SCHEME_DIRECT_MESSAGE) String TWITTER_USER = "CamelTwitterUser"; String TWITTER_USER_ROLE = "CamelTwitterUserRole"; + @Metadata(description = "The type of event. The supported values are the values of the enum " + + "org.apache.camel.component.twitter.consumer.TwitterEventType", + javaType = "String") String TWITTER_EVENT_TYPE = "CamelTwitterEventType"; } diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java index ac8bdb24a9e..ddb382f77c9 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java @@ -22,17 +22,20 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.twitter.AbstractTwitterEndpoint; import org.apache.camel.component.twitter.TwitterConfiguration; +import org.apache.camel.component.twitter.TwitterConstants; import org.apache.camel.component.twitter.TwitterHelper; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriPath; +import static org.apache.camel.component.twitter.TwitterConstants.SCHEME_DIRECT_MESSAGE; + /** * Send and receive Twitter direct messages. */ -@UriEndpoint(firstVersion = "2.10.0", scheme = "twitter-directmessage", title = "Twitter Direct Message", +@UriEndpoint(firstVersion = "2.10.0", scheme = SCHEME_DIRECT_MESSAGE, title = "Twitter Direct Message", syntax = "twitter-directmessage:user", - category = { Category.CLOUD, Category.API, Category.SOCIAL, Category.CHAT }) + category = { Category.CLOUD, Category.API, Category.SOCIAL, Category.CHAT }, headersClass = TwitterConstants.class) public class TwitterDirectMessageEndpoint extends AbstractTwitterEndpoint { @UriPath(description = "The user name to send a direct message. This will be ignored for consumer.") diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/search/TwitterSearchEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/search/TwitterSearchEndpoint.java index a438c94ad57..42b2883c420 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/search/TwitterSearchEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/search/TwitterSearchEndpoint.java @@ -22,16 +22,20 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.twitter.AbstractTwitterEndpoint; import org.apache.camel.component.twitter.TwitterConfiguration; +import org.apache.camel.component.twitter.TwitterConstants; import org.apache.camel.component.twitter.TwitterHelper; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriPath; +import static org.apache.camel.component.twitter.TwitterConstants.SCHEME_SEARCH; + /** * Access Twitter Search. */ -@UriEndpoint(firstVersion = "2.10.0", scheme = "twitter-search", title = "Twitter Search", syntax = "twitter-search:keywords", - category = { Category.CLOUD, Category.API, Category.SEARCH, Category.SOCIAL }) +@UriEndpoint(firstVersion = "2.10.0", scheme = SCHEME_SEARCH, title = "Twitter Search", syntax = "twitter-search:keywords", + category = { Category.CLOUD, Category.API, Category.SEARCH, Category.SOCIAL }, + headersClass = TwitterConstants.class) public class TwitterSearchEndpoint extends AbstractTwitterEndpoint { @UriPath(description = "The search query, use the keywords AND, OR, - and () to narrow the search results.") diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/TwitterTimelineEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/TwitterTimelineEndpoint.java index ac59f21253f..0b19032b80e 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/TwitterTimelineEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/timeline/TwitterTimelineEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.twitter.AbstractTwitterEndpoint; import org.apache.camel.component.twitter.TwitterConfiguration; +import org.apache.camel.component.twitter.TwitterConstants; import org.apache.camel.component.twitter.TwitterHelper; import org.apache.camel.component.twitter.consumer.AbstractTwitterConsumerHandler; import org.apache.camel.component.twitter.data.TimelineType; @@ -30,14 +31,15 @@ import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; +import static org.apache.camel.component.twitter.TwitterConstants.SCHEME_TIMELINE; import static org.apache.camel.component.twitter.data.TimelineType.USER; /** * Send tweets and receive tweets from user's timeline. */ -@UriEndpoint(firstVersion = "2.10.0", scheme = "twitter-timeline", title = "Twitter Timeline", +@UriEndpoint(firstVersion = "2.10.0", scheme = SCHEME_TIMELINE, title = "Twitter Timeline", syntax = "twitter-timeline:timelineType", - category = { Category.API, Category.CLOUD, Category.SOCIAL }) + category = { Category.API, Category.CLOUD, Category.SOCIAL }, headersClass = TwitterConstants.class) public class TwitterTimelineEndpoint extends AbstractTwitterEndpoint { @UriPath(description = "The timeline type to produce/consume.")
