mmodzelewski commented on code in PR #2630:
URL: https://github.com/apache/iggy/pull/2630#discussion_r2740647535
##########
foreign/java/java-sdk/src/main/java/org/apache/iggy/Iggy.java:
##########
@@ -19,13 +19,135 @@
package org.apache.iggy;
-import org.apache.iggy.client.blocking.IggyClientBuilder;
+import org.apache.iggy.builder.HttpClientBuilder;
+import org.apache.iggy.builder.TcpClientBuilder;
+import org.apache.iggy.client.blocking.http.IggyHttpClient;
+import org.apache.iggy.client.blocking.tcp.IggyTcpClient;
+/**
+ * Main entry point for creating Iggy clients.
+ *
+ * <p>Iggy provides a fluent API for creating clients with protocol-first
design:
+ *
+ * <h2>TCP Clients (recommended for performance)</h2>
+ * <pre>{@code
+ * // Blocking TCP client
+ * var client = Iggy.tcp().blocking()
+ * .host("localhost")
+ * .port(8090)
+ * .build();
+ * client.connect();
+ * client.users().login("iggy", "iggy");
+ *
+ * // Async TCP client
+ * var asyncClient = Iggy.tcp().async()
+ * .host("localhost")
+ * .build();
+ * asyncClient.connect().join();
+ * asyncClient.users().login("iggy", "iggy").join();
+ * }</pre>
+ *
+ * <h2>HTTP Clients</h2>
+ * <pre>{@code
+ * var httpClient = Iggy.http().blocking()
+ * .url("http://localhost:3000")
+ * .build();
+ *
+ * // Login after creating the client
+ * httpClient.users().login("iggy", "iggy");
+ * }</pre>
+ *
+ * <h2>Quick Factory Methods</h2>
+ * <pre>{@code
+ * // Local TCP client (localhost:8090)
+ * var client = Iggy.localTcp();
+ *
+ * // Local HTTP client (localhost:3000)
+ * var httpClient = Iggy.localHttp();
+ * }</pre>
+ *
+ * <h2>Version Information</h2>
+ * <pre>{@code
+ * String version = Iggy.version(); // e.g., "1.0.0"
+ * IggyVersion info = Iggy.versionInfo(); // Full version details
+ * }</pre>
+ *
+ * @see org.apache.iggy.builder.TcpClientBuilder
+ * @see org.apache.iggy.builder.HttpClientBuilder
+ * @see IggyVersion
+ */
public final class Iggy {
+ private static final String DEFAULT_HOST = "localhost";
+ private static final int DEFAULT_TCP_PORT = 8090;
+ private static final int DEFAULT_HTTP_PORT = 3000;
+
private Iggy() {}
- public static IggyClientBuilder clientBuilder() {
- return new IggyClientBuilder();
+ /**
+ * Creates a builder for TCP clients.
+ *
+ * <p>TCP provides the best performance and is recommended for most use
cases.
+ *
+ * @return a TCP client builder
+ */
+ public static TcpClientBuilder tcp() {
+ return new TcpClientBuilder();
+ }
+
+ /**
+ * Creates a builder for HTTP clients.
+ *
+ * <p>HTTP is useful when TCP is blocked by firewalls or when HTTP
semantics are preferred.
+ *
+ * @return an HTTP client builder
+ */
+ public static HttpClientBuilder http() {
+ return new HttpClientBuilder();
+ }
+
+ /**
+ * Creates a local blocking TCP client connected to localhost:8090.
+ *
+ * <p>This is a convenience method for local development and testing.
+ * Call {@code client.users().login(username, password)} to authenticate.
+ *
+ * @return a connected IggyTcpClient
+ */
+ public static IggyTcpClient localTcp() {
+ IggyTcpClient client =
+
tcp().blocking().host(DEFAULT_HOST).port(DEFAULT_TCP_PORT).build();
Review Comment:
makes sense, I'll remove these helpers
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]