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

io.descoped.dc.api.http.Request Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package io.descoped.dc.api.http;

import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.ServiceLoader;
import java.util.concurrent.Flow;

public interface Request {

    static Builder newRequestBuilder() {
        return ServiceLoader.load(Request.Builder.class).findFirst().orElseThrow();
    }

    String url();

    Method method();

    Headers headers();

    Object getDelegate();

    enum Method {
        PUT,
        POST,
        GET,
        DELETE,
        OPTIONS;
    }

    interface Builder {
        Builder url(String url);

        Builder PUT(byte[] bytes);

        Builder PUT(Flow.Publisher bodyPublisher);

        Builder POST(byte[] bytes);

        Builder POST(Flow.Publisher bodyPublisher);

        Builder GET();

        Builder DELETE();

        Builder header(String name, String value);

        Builder expectContinue(boolean enable);

        Builder timeout(Duration duration);

        Request build();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy