2525
2626package kong .unirest .core ;
2727
28+ /**
29+ * Static entry point for the primary Unirest client.
30+ * <p>
31+ * Use this facade to access the default shared {@link UnirestInstance}, configure
32+ * the global client, create requests, or spawn isolated instances when you need
33+ * separate configuration.
34+ * </p>
35+ *
36+ * <h2>Typical usage</h2>
37+ * <pre>{@code
38+ * Unirest.config().defaultBaseUrl("https://api.example.com");
39+ * String body = Unirest.get("/status").asString().getBody();
40+ * }</pre>
41+ *
42+ * @see UnirestInstance
43+ * @see Config
44+ */
2845public class Unirest {
2946
3047 private static UnirestInstance primaryInstance = new UnirestInstance (new Config ());
@@ -116,6 +133,11 @@ public static HttpRequestWithBody put(String url) {
116133 return primaryInstance .put (url );
117134 }
118135
136+ /**
137+ * Start a QUERY HttpRequest from the primary config.
138+ * @param url the endpoint to access. Can include placeholders for path params using curly braces {}
139+ * @return A HttpRequest builder
140+ */
119141 public static HttpRequestWithBody query (String url ){
120142 return primaryInstance .query (url );
121143 }
@@ -130,14 +152,30 @@ public static JsonPatchRequest jsonPatch(String url) {
130152 return primaryInstance .jsonPatch (url );
131153 }
132154
155+ /**
156+ * Start an HttpRequest for the given HTTP method from the primary config.
157+ * @param method the HTTP method name
158+ * @param url the endpoint to access. Can include placeholders for path params using curly braces {}
159+ * @return A HttpRequest builder
160+ */
133161 public static HttpRequestWithBody request (String method , String url ) {
134162 return primaryInstance .request (method , url );
135163 }
136164
165+ /**
166+ * Start a WebSocket request from the primary config.
167+ * @param url the endpoint to access
168+ * @return a WebSocket request builder
169+ */
137170 public static WebSocketRequest webSocket (String url ) {
138171 return primaryInstance .webSocket (url );
139172 }
140173
174+ /**
175+ * Start a Server-Sent Events request from the primary config.
176+ * @param url the endpoint to access
177+ * @return an SSE request builder
178+ */
141179 public static SseRequest sse (String url ) {
142180 return primaryInstance .sse (url );
143181 }
@@ -154,9 +192,8 @@ public static UnirestInstance spawnInstance() {
154192 }
155193
156194 /**
157- * return the primary UnirestInstance.
158- *
159- * @return a new UnirestInstance
195+ * Return the shared primary {@link UnirestInstance}.
196+ * @return the primary instance
160197 */
161198 public static UnirestInstance primaryInstance () {
162199 return primaryInstance ;
0 commit comments