private CompletionStage < List < Map < String , Result < R > > > > callSyncHelperNonBlock ( final SaltClient client , Target < ? > target , AuthMethod auth , Optional < Batch > batch ) { Map < String , Object > customArgs = new HashMap <> ( ) ; batch . ifPresent ( v -> customArgs . putAll ( v . getParams ( ) ) ) ; Client clientType = batch . isPresent ( ) ? Client . LOCAL_BATCH : Client . LOCAL ; Type xor = parameterizedType ( null , Result . class , getReturnType ( ) . getType ( ) ) ; Type map = parameterizedType ( null , Map . class , String . class , xor ) ; Type listType = parameterizedType ( null , List . class , map ) ; Type wrapperType = parameterizedType ( null , Return . class , listType ) ; TypeToken < Return < List < Map < String , Result < R > > > > > typeToken = ( TypeToken < Return < List < Map < String , Result < R > > > > > ) TypeToken . get ( wrapperType ) ; if ( batch . isPresent ( ) ) { return client . call ( this , clientType , Optional . of ( target ) , customArgs , typeToken , auth ) . thenApply ( Return :: getResult ) . thenApply ( results -> handleRetcodeBatchingHack ( results , xor ) ) ; } else { return client . call ( this , clientType , Optional . of ( target ) , customArgs , typeToken , auth ) . thenApply ( Return :: getResult ) ; } }
Helper to call an execution module function on the given target for batched or unbatched while also providing an option to use the given credentials or to use a prior created token . Synchronously waits for the result .