Skip to content

Improve Javadoc only #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions http-client/src/main/java/io/avaje/http/client/DHttpApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ private <T> HttpApiProvider<T> lookup(Class<T> type) {
}

@SuppressWarnings("unchecked")
<T> T provideFor(Class<T> type, HttpClient clientContext) {
<T> T provideFor(Class<T> type, HttpClient httpClient) {
final HttpApiProvider<T> apiProvider = lookup(type);
if (apiProvider == null) {
throw new IllegalArgumentException("No registered HttpApiProvider for type: " + type);
}
return apiProvider.provide(clientContext);
return apiProvider.provide(httpClient);
}

/**
* Return the client implementation via service loading.
*/
static <T> T provide(Class<T> type, HttpClient clientContext) {
return INSTANCE.provideFor(type, clientContext);
static <T> T provide(Class<T> type, HttpClient httpClient) {
return INSTANCE.provideFor(type, httpClient);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* <h4>Example using .join() for testing purposes</h4>
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .bean(HelloDto.class)
Expand All @@ -38,7 +38,7 @@
* In this example POST async that will return a bean converted from json response.
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .bean(HelloDto.class)
Expand Down Expand Up @@ -80,7 +80,7 @@ public interface HttpAsyncResponse {
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .async().asVoid()
Expand Down Expand Up @@ -115,7 +115,7 @@ public interface HttpAsyncResponse {
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .async().asDiscarding()
Expand All @@ -140,7 +140,7 @@ public interface HttpAsyncResponse {
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .async().asString()
Expand Down Expand Up @@ -191,7 +191,7 @@ public interface HttpAsyncResponse {
* </p>
* <pre>{@code
*
* CompletableFuture<HttpResponse<Void>> future = clientContext.request()
* CompletableFuture<HttpResponse<Void>> future = client.request()
* .path("hello/lineStream")
* .GET().async()
* .handler(HttpResponse.BodyHandlers.fromLineSubscriber(new Flow.Subscriber<>() {
Expand Down Expand Up @@ -240,7 +240,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .as(HelloDto.class)
Expand Down Expand Up @@ -280,7 +280,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .bean(HelloDto.class)
Expand Down Expand Up @@ -314,7 +314,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .asList(HelloDto.class)
Expand Down Expand Up @@ -356,7 +356,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .GET().async()
* .list(HelloDto.class)
Expand Down Expand Up @@ -387,7 +387,7 @@ default <E> CompletableFuture<HttpResponse<E>> withHandler(HttpResponse.BodyHand
*
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .asStream(HelloDto.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface HttpCallResponse {
* <pre>{@code
*
* HttpCall<HttpResponse<Void>> call =
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .call().asVoid();
Expand All @@ -54,7 +54,7 @@ public interface HttpCallResponse {
* <pre>{@code
*
* HttpCall<HttpResponse<Void>> call =
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .call().asDiscarding();
Expand All @@ -71,7 +71,7 @@ public interface HttpCallResponse {
* <pre>{@code
*
* HttpCall<HttpResponse<String>> call =
* clientContext.request()
* client.request()
* .path("hello/world")
* .GET()
* .call().asString();
Expand Down Expand Up @@ -107,7 +107,7 @@ public interface HttpCallResponse {
* Call using any given {@code HttpResponse.BodyHandler}.
* <pre>{@code
*
* HttpCall<E> call = clientContext.request()
* HttpCall<E> call = client.request()
* .path("hello/lineStream")
* .GET()
* .call().handler(HttpResponse.BodyHandler<E> ...);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
*
* <pre>{@code
*
* HelloDto dto = clientContext.request()
* HelloDto dto = client.request()
* .path("hello").queryParam("name", "Rob").queryParam("say", "Whats up")
* .GET()
* .bean(HelloDto.class);
*
* }</pre>
*
* @see HttpClientContext
* @see HttpClient
*/
public interface HttpClientRequest {

Expand Down Expand Up @@ -113,7 +113,7 @@ public interface HttpClientRequest {
* Add the header to the request implicitly converting the value to a String. If the value is a
* collection then it's values are appended with the same key
*
* @param name The header name
* @param name The header name
* @param value The header value
* @return The request being built
*/
Expand All @@ -130,7 +130,7 @@ public interface HttpClientRequest {
/**
* Add the headers to the request via Collection.
*
* @param name The header name
* @param name The header name
* @param value The header values
* @return The request being built
*/
Expand All @@ -155,7 +155,7 @@ public interface HttpClientRequest {
* Set the URL to use replacing the base URL.
* <pre>{code
*
* HttpResponse<String> res = clientContext.request()
* HttpResponse<String> res = client.request()
* .url("http://127.0.0.1:8889")
* .path("hello")
* .GET()
Expand All @@ -165,7 +165,7 @@ public interface HttpClientRequest {
*
* @param url The url effectively replacing the base url.
* @return The request being built
* @see HttpClientContext.Builder#baseUrl(String)
* @see HttpClient.Builder#baseUrl(String)
*/
HttpClientRequest url(String url);

Expand Down Expand Up @@ -248,8 +248,8 @@ public interface HttpClientRequest {
/**
* Add a query parameter with multiple values
*
* @param name The name of the query parameter
* @param value The values of the query parameter which can be null
* @param name The name of the query parameter
* @param values The values of the query parameter which can be null
* @return The request being built
*/
default HttpClientRequest queryParam(String name, Collection<String> values) {
Expand Down Expand Up @@ -293,24 +293,41 @@ default HttpClientRequest queryParam(String name, Collection<String> values) {
HttpClientRequest body(Object bean, String contentType);

/**
* Set the body as a bean using the default content type. The default
* content type will often be <code>application/json; charset=utf8</code>.
* Set the body as a bean using the default content type.
* <p>
* The default content type will often be {@code application/json; charset=utf8}.
*/
HttpClientRequest body(Object bean);

/**
* Set the body as a bean with the given content type using a BodyWriter.
* Used for JsonbAdapter
* Set the body as a bean additionally specifying the type that will be
* used to serialise the content (e.g. JsonbAdapter).
* <p>
* Specifying the type allows the bean instance to be a type that extends
* a type that is known to JsonbAdapter / the body content adapter used.
*
* @param bean The body content as an instance
* @param type The type used by the body content adapter to write the body content
* @return The request being built
*/
HttpClientRequest body(Object bean, Class<?> type);

/**
* Set the body as a bean with the given content type using a BodyWriter.
* Set the body as a bean with the given content type and additionally specifying
* the type that will be used to serialise the content (e.g. JsonbAdapter).
* <p>
* Specifying the type allows the bean instance to be a type that extends
* a type that is known to JsonbAdapter / the body content adapter used.
*
* @param bean The body content as an instance
* @param type The type used by the body content adapter to write the body content
* @param contentType The content type of the body
* @return The request being built
*/
HttpClientRequest body(Object bean, Class<?> type, String contentType);

/**
* Set the body content as a string.
* Set the body content as a string using the default content type.
*
* @param body The body content
* @return The request being built
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface HttpClientResponse {
* In this example POST async that will return a bean converted from json response.
* <pre>{@code
*
* clientContext.request()
* client.request()
* ...
* .POST().async()
* .bean(HelloDto.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* <pre>{@code
*
* try {
* clientContext.request()
* client.request()
* .path("hello/saveForm")
* .formParam("email", "user@foo.com")
* .formParam("url", "notAValidUrl")
Expand Down Expand Up @@ -115,7 +115,7 @@ public String bodyAsString() {
return new String(body.content(), StandardCharsets.UTF_8);
}

/**
/**
* Return the response body content as raw bytes, or else null if body content doesn't exist.
*/
public byte[] bodyAsBytes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* <pre>{@code
*
* HttpClientContext.builder()
* HttpClient.builder()
* .baseUrl(baseUrl)
* .bodyAdapter(new JacksonBodyAdapter())
* .build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* <pre>{@code
*
* HttpClientContext.builder()
* HttpClient.builder()
* .baseUrl(baseUrl)
* .bodyAdapter(new JsonbBodyAdapter())
* .build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*
* <pre>{@code
*
* HttpClientContext ctx = HttpClientContext.builder()
* HttpClient client = HttpClient.builder()
* .baseUrl("http://localhost:8080")
* .bodyAdapter(new JacksonBodyAdapter())
* .build();
*
* HelloDto dto = ctx.request()
* HelloDto dto = client.request()
* .path("hello")
* .queryParam("say", "Whats up")
* .GET()
Expand Down