Run the example
Extract the archive and run these commands inside its directory. The example lists public models by default. To submit a job, set BEATO_API_KEY and BEATO_IDEMPOTENCY_KEY in your environment.
mvn -q compile dependency:copy-dependencies
java -cp 'target/classes:target/dependency/*' beato.Example
Example source
package beato;
import com.google.gson.Gson;
public final class Example {
public static void main(String[] args) throws Exception {
var client = new Beato(System.getenv("BEATO_API_KEY"), System.getenv("BEATO_API_BASE_URL"));
String key = System.getenv("BEATO_IDEMPOTENCY_KEY");
var json = new Gson();
if (key == null || key.isEmpty()) {
System.out.println(json.toJson(client.models()));
return;
}
var input = new Beato.JobInput("nano-banana", "A watercolor of a rainy street", null, null);
var job = client.createJob(input, key);
for (int i = 0; i < 60 && !job.status().equals("succeeded") && !job.status().equals("failed"); i++) {
Thread.sleep(5000);
job = client.getJob(job.id());
}
System.out.println(json.toJson(job));
}
}