Interface IPublicPromaCallInvoker

  • All Known Subinterfaces:
    IPublicPromaCallInvokerAsync, IPublicPromaCallInvokerSync

    public interface IPublicPromaCallInvoker
    An invoker that is responsible for sending API calls to PROMA. It translates an API calls to an ApiResponse in an asynchronous fashion. This interface allows custom logic to be implemented for the API call. An invoker might prepare an API call by adding certain properties etc. or running the call in a different thread.
    Since:
    8.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • invoke

        <T,​C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,​R> StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,​R> invoke​(C call,
                                                                                                                                                           Function<? super C,​? extends de.xima.proma.restclient.pub.gen.ApiInvocation<T>> invocationBuilder,
                                                                                                                                                           Duration timeout)
        Translates an API call into the corresponding API response. The usual steps are as follows:
        • Apply any desired pre-processing to the given ApiCall.
        • Use the provided invocation builder to obtain an ApiInvocation instance.
        • Decide on how and when to execute the API invocation, e.g. synchronously via invoke() or asynchronously via rx(). For the latter case, you could also provide an Executor to execute the invocation in a different context or thread.
        • Return a CompletionStage with the result.
        Type Parameters:
        T - Type of the response body.
        C - Type of the API call.
        R - Type of the final result.
        Parameters:
        call - API call to invoke.
        invocationBuilder - A builder that creates an invocation with a specific configuration from an API call.
        timeout - Timeout for the request.
        Returns:
        A CompletionStage that completes with the eventual result from the API call.
      • invoke

        default <T,​C extends de.xima.proma.restclient.pub.gen.ApiCall<?>,​R> StageChain<de.xima.proma.restclient.pub.gen.ApiResponse<T>,​R> invoke​(PublicPromaInvokableCall<T,​C> invokableCall,
                                                                                                                                                                   Duration timeout)
        Shortcut for invoke(ApiCall, Function, Duration), see the JavaDocs for that method.
        Type Parameters:
        T - Type of the response body.
        C - Type of the API call.
        R - Type of the final result.
        Parameters:
        invokableCall - API call to invoke, together with the builder that creates an invocation from an API call.
        timeout - Timeout for the request.
        Returns:
        A CompletionStage that completes with the eventual result from the API call.