@@ -96,6 +96,7 @@ Usage briefly described below, but you can also refer to the test package for ex
9696+ [ Java HttpsURLConnection] ( #java-httpsurlconnection )
9797+ [ Apache HTTP Client 4] ( #apache-http-client-4 )
9898+ [ OkHttp 3] ( #okhttp-3 )
99+ + [ Spring Webflux] ( #spring-webflux )
99100
100101#### Java HttpsURLConnection <a name =" java-httpsurlconnection " ></a >
101102``` java
@@ -138,6 +139,19 @@ OkHttpSigner signer = new OkHttpSigner(consumerKey, signingKey);
138139signer. sign(request);
139140```
140141
142+ #### Spring Webflux <a name =" spring-webflux " ></a >
143+ ``` java
144+ WebClient client = WebClient . create();
145+ ClientRequest request = ClientRequest . create(HttpMethod . POST , URI . create(" https://api.mastercard.com/service" ))
146+ .header(" Content-Type" , MediaType . APPLICATION_JSON_VALUE )
147+ .body(BodyInserters . fromValue(yourRequestObject))
148+ .build();
149+
150+ SpringWebfluxSigner signer = new SpringWebfluxSigner (consumerKey, signingKey);
151+ ClientRequest signedRequest = signer. sign(request);
152+ client. exchange(signedRequest);
153+ ```
154+
141155### Integrating with OpenAPI Generator API Client Libraries <a name =" integrating-with-openapi-generator-api-client-libraries " ></a >
142156
143157[ OpenAPI Generator] ( https://github.com/OpenAPITools/openapi-generator ) generates API client libraries from [ OpenAPI Specs] ( https://github.com/OAI/OpenAPI-Specification ) .
@@ -151,6 +165,7 @@ Library options currently supported for the `java` generator:
151165+ [ retrofit] ( #retrofit )
152166+ [ retrofit2] ( #retrofit2 )
153167+ [ google-api-client] ( #google-api-client )
168+ + [ spring-webflux] ( #spring-webflux-interceptor )
154169
155170See also:
156171* [ OpenAPI Generator (maven Plugin)] ( https://mvnrepository.com/artifact/org.openapitools/openapi-generator-maven-plugin )
@@ -284,3 +299,25 @@ ApiClient client = new ApiClient("https://sandbox.api.mastercard.com", null, ini
284299ServiceApi serviceApi = client. serviceApi();
285300// ...
286301```
302+
303+ #### spring-webflux <a name =" spring-webflux-interceptor " ></a >
304+ ##### OpenAPI Generator Plugin Configuration
305+ ``` xml
306+ <configuration >
307+ <inputSpec >${project.basedir}/src/main/resources/openapi-spec.yaml</inputSpec >
308+ <generatorName >spring</generatorName >
309+ <library >spring-cloud</library >
310+ <!-- ... -->
311+ </configuration >
312+ ```
313+
314+ ##### Usage of the ` HttpExecuteOAuth1Interceptor `
315+ ``` java
316+ WebClient . Builder webClientBuilder = WebClient . builder()
317+ .baseUrl(" https://api.mastercard.com/service" )
318+ .filter(new SpringWebfluxOAuth1Interceptor (consumerKey, signingKey));
319+
320+ ApiClient apiClient = new ApiClient (webClientBuilder);
321+ ServiceApi serviceApi = client. serviceApi();
322+ // ...
323+ ```
0 commit comments