From a6fc895c03ef2b176d94bf798cb1e451e4f6fa06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Thu, 16 Jun 2022 17:30:39 +0200 Subject: [PATCH] Document Reactive Rest Client support of dynamic query parameters Documents: [24783](https://github.com/quarkusio/quarkus/pull/24783) Reactive Rest Client sending query paramters passed as a `Map`, however I can't see this in documentation. There should be at least reference to this feature. --- .../main/asciidoc/rest-client-reactive.adoc | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/src/main/asciidoc/rest-client-reactive.adoc b/docs/src/main/asciidoc/rest-client-reactive.adoc index dbf183349b5137..0ab2724a27c222 100644 --- a/docs/src/main/asciidoc/rest-client-reactive.adoc +++ b/docs/src/main/asciidoc/rest-client-reactive.adoc @@ -134,6 +134,44 @@ The `getById` method above is a blocking call. It should not be invoked on the e The <> section describes how to make non-blocking calls. ==== +=== Query Parameters + +The easiest way to specify a query parameter is to annotate a client method parameter with the `@QueryParam`. Query parameters +can be also passed as a `Map`, which is convenient if parameters are not known in advance. + +[source, java] +---- +package org.acme.rest.client; + +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; +import org.jboss.resteasy.reactive.RestQuery; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MultivaluedMap; +import java.util.Map; +import java.util.Set; + +@Path("/extensions") +@RegisterRestClient(configKey = "extensions-api") +public interface ExtensionsService { + + @GET + Set getByIdAndName(@QueryParam("id") String id, @RestQuery String name); <1> + + @GET + Set getByFilter(@RestQuery Map filter); <2> + + @GET + Set getByFilters(@RestQuery MultivaluedMap filters); <3> + +} +---- +<1> Request query will include query parameters id and title +<2> Each `Map` entry represents exactly one query parameter +<3> `MultivaluedMap` allows you to send array values + === Path Parameters If the GET request requires path parameters you can leverage the `@PathParam("parameter-name")` annotation instead of