# Quackathon feedback
## George
### Creating a Zulip Bot - feedback
I chose to use Apache HTTP Client (`quarkus-apache-httpclient`) to perform the REST calls because I couldn't find a way to set the Authentication headers using the REST Client (`quarkus-resteasy-client`)
### Twillio
Their API is not free. When I signed up I got a credit of $15,50.
Using the Camel Twilio component was the easiest path to achieve this:
1. Add the following to the application.properties :
```properties
camel.component.twilio.username=TWILIO_ACCOUNT_SID
camel.component.twilio.password=TWILIO_PASSWORD
```
1. Add a dependency to Camel Twilio component:
```xml=
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-timer</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-twilio</artifactId>
</dependency>
```
1. Create a `RouteBuilder`:
```java=
package org.acme;
import org.apache.camel.builder.RouteBuilder;
public class SendSMSRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:foo?period=10000")
.log("Sending SMS message")
.to("twilio://message/create?from=RAW(+14422569115)&to=RAW(+5547997111000)&body=\u2705 Hello! Greetings from Quarkus! \u2728");
}
}
```
## Max
Goal, make a jbang based app interacting with some apis found on https://github.com/public-apis/public-apis
cli version text - https://github.com/quarkusio/quarkus/issues/18155
list,ls in quarkus help has extraordinary space
quarkus create app --help should have some examples listed.
quarkus create downloads platform everytime https://github.com/quarkusio/quarkus/issues/18156
readme for jbang projects is referring to wrong .java.
should just be `jbang src`
quarkus dev mode not working for jbang - https://github.com/quarkusio/quarkus/issues/18157 and https://github.com/quarkusio/quarkus/pull/16783
jbang edit --open=idea does not generate proper gradle for pom projecs - https://github.com/jbangdev/jbang/issues/945
idea no longer seem to save changes in symbolic linked files?
eclipse complains about main being a constructor name ...(stupid :)
run from eclipse picks up build.gradle and gets confused
jbang edit src does not behave like jbang edit src/main.java
keeps resulting in overrides - https://github.com/jbangdev/jbang/issues/946
can't search docs
- rest gives tons of options
- rest client gives good options
- http gives no rest
rest client docs does not mention reactive options
dependencies only listed with maven syntax, no gradle (that would work for jbang too)
docs for resteasy reactive client does not say what is the extension to use - is says rest-client-reactive-jackson but its actually quarkus-rest-client-reactive-jackson.
no docs about how to just get a url endpoint.
surprising behavior for quarkus.run:
```java=
@QuarkusMain
public class main implements QuarkusApplication {
@Override
public int run(String... args) throws Exception {
System.out.println("start");
var result = ClientBuilder.newClient().target("https://place.dog/300/200").request().get();
System.out.println(result);
return 0;
}
public static void main(String[] args) {
System.out.println("main");
Quarkus.run(args);
}
}
```
hangs- never enters run. but remove main method and it works
Trying to locate info on saving files/output ...nothing in quarkus
and https://download.eclipse.org/microprofile/microprofile-rest-client-1.3/microprofile-rest-client-1.3.html#_messagebodywriter is not helping
trying:
var result = ClientBuilder.newClient().target("https://place.dog/300/200").request().get();
System.out.println(result.getEntity().getClass());
gives NPE ...not helpful :)
stackoverflow to rescue: https://stackoverflow.com/questions/31414482/download-file-from-rest-service-using-jax-rs-client
use readEntity(inputStream);
Success:
```java
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus:quarkus-bom:2.0.0.Final@pom
//DEPS io.quarkus:quarkus-rest-client-reactive
//DEPS io.quarkus:quarkus-rest-client-reactive-jackson
//JAVAC_OPTIONS -parameters
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;
import io.vertx.core.file.CopyOptions;
import java.io.InputStream;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import javax.ws.rs.client.ClientBuilder;
@QuarkusMain
public class main implements QuarkusApplication {
@Override
public int run(String... args) throws Exception {
System.out.println("start");
var result = ClientBuilder.newClient().target("https://place.dog/300/200").request().get();
InputStream in = result.readEntity(InputStream.class);
String test = result.getHeaderString("Content-Disposition");
System.out.println(test);
Path path = Paths.get(".", "test.jpg");
Files.copy(in, path, StandardCopyOption.REPLACE_EXISTING);
return 0;
}
}
```