You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/03/22 16:51:53 UTC

[camel] 04/14: CAMEL-17792: Add doc about the message headers of camel-github

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 42090072313cf79307a64ca6e5f637c5cfd1e39c
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Mar 22 12:15:40 2022 +0100

    CAMEL-17792: Add doc about the message headers of camel-github
---
 .../org/apache/camel/component/github/github.json   | 11 +++++++++++
 .../src/main/docs/github-component.adoc             |  4 ++++
 .../camel/component/github/GitHubConstants.java     | 21 ++++++++++++---------
 .../camel/component/github/GitHubEndpoint.java      |  2 +-
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json b/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
index 813114a..84737ae 100644
--- a/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
+++ b/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
@@ -27,6 +27,17 @@
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
     "oauthToken": { "kind": "property", "displayName": "Oauth Token", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "GitHub OAuth token. Must be configured on either component or endpoint." }
   },
+  "headers": {
+    "GitHubPullRequest": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "PullRequest or Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The pull request" },
+    "GitHubInResponseTo": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the comment to reply to" },
+    "GitHubPullRequestHeadCommitSHA": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The sha of the head of the pull request" },
+    "GitHubIssueTitle": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The title of the issue" },
+    "CamelGitHubCommitAuthor": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit author" },
+    "CamelGitHubCommitCommitter": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The committer name" },
+    "CamelGitHubCommitSha": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit sha" },
+    "CamelGitHubCommitUrl": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The commit URL" },
+    "CamelGitHubEventPayload": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "org.eclipse.egit.github.core.event.EventPayload", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The event payload" }
+  },
   "properties": {
     "type": { "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.github.GitHubType", "enum": [ "CLOSEPULLREQUEST", "PULLREQUESTCOMMENT", "COMMIT", "PULLREQUEST", "TAG", "PULLREQUESTSTATE", "PULLREQUESTFILES", "GETCOMMITFILE", "CREATEISSUE", "EVENT" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "What git operation to execute" },
     "branchName": { "kind": "path", "displayName": "Branch Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of branch" },
diff --git a/components/camel-github/src/main/docs/github-component.adoc b/components/camel-github/src/main/docs/github-component.adoc
index 71d0eb3..6782cf9 100644
--- a/components/camel-github/src/main/docs/github-component.adoc
+++ b/components/camel-github/src/main/docs/github-component.adoc
@@ -63,6 +63,10 @@ include::partial$component-endpoint-options.adoc[]
 
 // endpoint options: END
 
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
+
 == Configuring authentication
 
 The github component requires to be configured with an authentication token on either the component or endpoint level.
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
index 3b01c29..42a90b4 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubConstants.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.github;
 
+import org.apache.camel.spi.Metadata;
+
 public interface GitHubConstants {
 
     String GITHUB_REPOSITORY_SERVICE = "githubRepositoryService";
@@ -27,24 +29,25 @@ public interface GitHubConstants {
     String GITHUB_PULL_REQUEST_SERVICE = "githubPullRequestService";
 
     String GITHUB_ISSUE_SERVICE = "githbIssueService";
-
+    @Metadata(description = "The pull request", javaType = "PullRequest or Integer")
     String GITHUB_PULLREQUEST = "GitHubPullRequest";
-
+    @Metadata(label = "producer", description = "The id of the comment to reply to", javaType = "Integer")
     String GITHUB_INRESPONSETO = "GitHubInResponseTo";
-
+    @Metadata(description = "The sha of the head of the pull request", javaType = "String")
     String GITHUB_PULLREQUEST_HEAD_COMMIT_SHA = "GitHubPullRequestHeadCommitSHA";
-
+    @Metadata(label = "producer", description = "The title of the issue", javaType = "String")
     String GITHUB_ISSUE_TITLE = "GitHubIssueTitle";
 
     String GITHUB_EVENT_SERVICE = "GitHubEventService";
-
+    @Metadata(label = "consumer", description = "The commit author", javaType = "String")
     String GITHUB_COMMIT_AUTHOR = "CamelGitHubCommitAuthor";
-
+    @Metadata(label = "consumer", description = "The committer name", javaType = "String")
     String GITHUB_COMMIT_COMMITTER = "CamelGitHubCommitCommitter";
-
+    @Metadata(label = "consumer", description = "The commit sha", javaType = "String")
     String GITHUB_COMMIT_SHA = "CamelGitHubCommitSha";
-
+    @Metadata(label = "consumer", description = "The commit URL", javaType = "String")
     String GITHUB_COMMIT_URL = "CamelGitHubCommitUrl";
-
+    @Metadata(label = "consumer", description = "The event payload",
+              javaType = "org.eclipse.egit.github.core.event.EventPayload")
     String GITHUB_EVENT_PAYLOAD = "CamelGitHubEventPayload";
 }
diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
index ad2465a..25434b4 100644
--- a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
+++ b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
@@ -61,7 +61,7 @@ import org.apache.camel.util.StringHelper;
  * publicly accessible where a webhook would fail
  */
 @UriEndpoint(firstVersion = "2.15.0", scheme = "github", title = "GitHub", syntax = "github:type/branchName",
-             category = { Category.FILE, Category.CLOUD, Category.API })
+             category = { Category.FILE, Category.CLOUD, Category.API }, headersClass = GitHubConstants.class)
 public class GitHubEndpoint extends ScheduledPollEndpoint {
 
     @UriPath