All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClientBuilder Maven / Gradle / Ivy

Go to download

SmallRye specific Client API, extending the MicroProfile client api, allowing us to play with the api first before we move it to the spec

There is a newer version: 2.11.0
Show newest version
package io.smallrye.graphql.client.dynamic.api;

import java.util.Iterator;
import java.util.Map;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;

import io.smallrye.graphql.client.websocket.WebsocketSubprotocol;

public interface DynamicGraphQLClientBuilder {

    DynamicGraphQLClientBuilder url(String url);

    DynamicGraphQLClientBuilder websocketUrl(String url);

    DynamicGraphQLClientBuilder executeSingleOperationsOverWebsocket(boolean value);

    DynamicGraphQLClientBuilder configKey(String configKey);

    DynamicGraphQLClientBuilder header(String key, String value);

    DynamicGraphQLClientBuilder initPayload(Map payload);

    DynamicGraphQLClientBuilder subprotocols(WebsocketSubprotocol... subprotocols);

    DynamicGraphQLClientBuilder allowUnexpectedResponseFields(boolean value);

    /**
     * Maximum time (in milliseconds) allowed between initializing a subscription websocket and receiving
     * a subscription start acknowledgement from the server.
     */
    DynamicGraphQLClientBuilder websocketInitializationTimeout(Integer timeoutInMilliseconds);

    DynamicGraphQLClient build();

    static DynamicGraphQLClientBuilder newBuilder() {
        ServiceLoader loader = ServiceLoader.load(DynamicGraphQLClientBuilder.class);
        Iterator iterator = loader.iterator();
        if (!iterator.hasNext())
            throw new ServiceConfigurationError(
                    "no " + DynamicGraphQLClientBuilder.class.getName() + " implementation found via ServiceLoader," +
                            "do you have a smallrye-graphql-client-implementation-* artifact in classpath?");
        DynamicGraphQLClientBuilder graphQlClientBuilder = iterator.next();
        if (iterator.hasNext())
            throw new ServiceConfigurationError(
                    "more than one " + DynamicGraphQLClientBuilder.class.getName() + " in classpath");
        return graphQlClientBuilder;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy