{8.2.0-new} Request Query Parameters

Per-client or per-request query parameters can be specified using the following methods:

- {@link oajr.client2.RestClientBuilder}
  - {@link oajr.client2.RestClientBuilder#query(String,Object) query(String,Object)}
  - {@link oajr.client2.RestClientBuilder#query(String,Object,HttpPartSchema) query(String,Object,HttpPartSchema)}
  - {@link oajr.client2.RestClientBuilder#query(String,Supplier) query(String,Supplier<?>)}
  - {@link oajr.client2.RestClientBuilder#query(String,Supplier,HttpPartSchema) query(String,Supplier<?>,HttpPartSchema)}
  - {@link oajr.client2.RestClientBuilder#queries(Object...) queries(Object...)}
  - {@link oajr.client2.RestClientBuilder#queryPairs(Object...) queryPairs(Object...)}
- {@link oajr.client2.RestRequest}
  - {@link oajr.client2.RestRequest#query(String,Object) query(String,Object)}
  - {@link oajr.client2.RestRequest#query(AddFlag,String,Object) query(AddFlag,String,Object)}
  - {@link oajr.client2.RestRequest#queries(Object...) queries(Object...)}
  - {@link oajr.client2.RestRequest#queries(AddFlag,Object...) queries(AddFlag,Object...)}
  - {@link oajr.client2.RestRequest#queryPairs(Object...) queryPairs(Object...)}
  - {@link oajr.client2.RestRequest#queryCustom(Object) queryCustom(Object)}

##### Example:

// Create a client that adds a ?foo=bar query parameter to every request. RestClient client = RestClient.create().query("foo","bar").build(); // Or do it on every request. String response = client.get(URI).query("foo","bar").run().getBody().asString();

{@link oajr.client2.RestClientBuilder#queries(Object...) queries(Object...)} allows you to pass in a variety of query parameter objects, and {@link oajr.client2.RestClientBuilder#queryPairs(Object...) queryPairs(Object...)} allows you to specify several query parameters in a compact fashion.

##### Example:

// Create a client that adds a bunch of query parameters to every request. RestClient client = RestClient .create() .queries( AMap.of("foo","bar","baz","qux") // Arbitrary key/value pairs. BasicNameValuePair.of("foo","bar") // A NameValuePair object. BasicNameValuePair.of("foo",()->getBar()) // A dynamic NameValuePair object. NameValuePairSupplier.ofPairs("foo","bar") // A dynamically changing list of NameValuePair objects. AList.of(BasicNameValuePair.of("foo","bar")) // A list of anything else on this list. ) .queryPairs("foo","bar","baz","qux") .build();

The {@link oaj.httppart.HttpPartSchema} API allows you to define OpenAPI schemas to POJO data structures on query parameters.

##### Example:

// Create a client that adds a query parameter "foo=bar|baz" to every request. RestClient client = RestClient .create() .query("foo", AList.of("bar","baz"), T_ARRAY_PIPES) .build();

The methods with {@link oaj.AddFlag} parameters allow you to control whether new query parameters get appended, prepended, or replace existing query parameters with the same name.

- Methods that pass in POJOs convert values to strings using the part serializers. Methods that pass in NameValuePair objects use the values returned by that bean directly.