You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/05/30 05:48:01 UTC

[GitHub] [camel] oscerd commented on a diff in pull request #7683: ✨ camel-whatsapp component

oscerd commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884437945


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * 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.whatsapp;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+
+@Component("whatsapp")
+public class WhatsAppComponent extends DefaultComponent {
+
+    public static final String API_DEFAULT_URL = "https://graph.facebook.com";
+    public static final String API_DEFAULT_VERSION = "v13.0";
+
+    @Metadata(required = true, description = "TODO")
+    private String phoneNumberId;
+    @Metadata(label = "security", secret = true, required = true, description = "TODO")
+    private String authorizationToken;
+
+    @Metadata(label = "advanced", description = "TODO")
+    private AsyncHttpClient client;
+    @Metadata(label = "advanced", description = "TODO")
+    private AsyncHttpClientConfig clientConfig;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_URL,
+              description = "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API")
+    private String baseUri = API_DEFAULT_URL;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_VERSION, description = "TODO")

Review Comment:
   Please remove the TODO here.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+
+public final class WhatsAppConstants {
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")
+    public static final String WHATSAPP_PHONE_NUMBER_ID = "CamelWhatsAppPhoneNumberId";
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")

Review Comment:
   Remove todo



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIJDKAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+import org.asynchttpclient.DefaultAsyncHttpClient;
+import org.asynchttpclient.DefaultAsyncHttpClientConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send and receive messages.
+ */
+@UriEndpoint(firstVersion = "2.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",

Review Comment:
   First version is 3.18.0



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+
+public final class WhatsAppConstants {
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")

Review Comment:
   Remove todo



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIJDKAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+import org.asynchttpclient.DefaultAsyncHttpClient;
+import org.asynchttpclient.DefaultAsyncHttpClientConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send and receive messages.
+ */
+@UriEndpoint(firstVersion = "2.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",
+             category = {
+                     Category.CLOUD, Category.API,
+                     Category.CHAT },
+             headersClass = WhatsAppConstants.class)
+public class WhatsAppEndpoint extends ScheduledPollEndpoint {
+    private static final Logger LOG = LoggerFactory.getLogger(WhatsAppEndpoint.class);
+
+    @UriParam
+    private WhatsAppConfiguration configuration;
+    @UriParam(label = "advanced", description = "TODO")

Review Comment:
   Please remove the todo



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org