@@ -60,9 +60,17 @@ public UnregisteredClient(final ClientOptions clientOptions) {
6060 );
6161 feignBuilder .errorDecoder (new ServerErrorRetryDecoder ());
6262 apiClient .setFeignBuilder (feignBuilder );
63+ feignBuilder .requestInterceptor (
64+ (requestTemplate ) -> clientOptions .getRequestHeaders ().forEach (requestTemplate ::header )
65+ );
6366
6467 this .defaultApi = apiClient .buildClient (DefaultApi .class );
6568 }
69+
70+ public UnregisteredClient (final ClientOptions clientOptions , final DefaultApi openApiClient ) {
71+ this .clientOptions = clientOptions ;
72+ this .defaultApi = openApiClient ;
73+ }
6674
6775 /**
6876 * @param workflowType required
@@ -323,6 +331,10 @@ private List<StateCompletionOutput> getWorkflowResults(
323331 .workflowId (workflowId )
324332 .workflowRunId (workflowRunId );
325333
334+ if (withWait && clientOptions .getLongPollApiMaxWaitTimeSeconds ().isPresent ()) {
335+ request .waitTimeSeconds (clientOptions .getLongPollApiMaxWaitTimeSeconds ().get ());
336+ }
337+
326338 final WorkflowGetResponse workflowGetResponse ;
327339 try {
328340 if (withWait ) {
@@ -352,6 +364,11 @@ public <T> T waitForStateExecutionCompletion(
352364 final WorkflowWaitForStateCompletionRequest request = new WorkflowWaitForStateCompletionRequest ()
353365 .stateExecutionId (stateExecutionId )
354366 .workflowId (workflowId );
367+
368+ if (clientOptions .getLongPollApiMaxWaitTimeSeconds ().isPresent ()) {
369+ request .waitTimeSeconds (clientOptions .getLongPollApiMaxWaitTimeSeconds ().get ());
370+ }
371+
355372 final WorkflowWaitForStateCompletionResponse response ;
356373 try {
357374 response = defaultApi .apiV1WorkflowWaitForStateCompletionPost (request );
0 commit comments