Setup
import ai.stats.gen.Client;
import java.net.http.HttpClient;
import java.util.HashMap;
import java.util.Map;
String apiKey = System.getenv("AI_STATS_API_KEY");
String baseUrl = System.getenv("AI_STATS_BASE_URL");
if (baseUrl == null || baseUrl.isEmpty()) {
baseUrl = "https://api.phaseo.app/v1";
}
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "Bearer " + apiKey);
Client client = new Client(baseUrl, HttpClient.newHttpClient(), headers);
Pattern
Most calls follow this shape:
Object response = Operations.someMethod(client, path, query, extraHeaders, bodyJsonString);
path: Map<String, String> for path params, or null.
query: Map<String, String> for query params, or null.
extraHeaders: extra request headers, or null.
bodyJsonString: raw JSON body string for POST/PATCH, or null.
Recommended
- Keep a small helper that builds path/query maps.
- Centralize JSON serialization in your app layer.
- Start from endpoint-specific examples in this section.
Last modified on March 16, 2026