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

org.zalando.riptide.RequestArguments Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package org.zalando.riptide;

import org.apiguardian.api.API;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpOutputMessage;

import javax.annotation.Nullable;
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
public interface RequestArguments {

    interface Entity {

        void writeTo(HttpOutputMessage message) throws IOException;

        default boolean isEmpty() {
            return false;
        }

    }

    URI getBaseUrl();

    UrlResolution getUrlResolution();

    HttpMethod getMethod();

    String getUriTemplate();

    List getUriVariables();

    URI getUri();

     Optional getAttribute(Attribute attribute);

    Map> getQueryParams();

    URI getRequestUri();

    Map> getHeaders();

    Object getBody();

    Entity getEntity();

    Route getRoute();

    RequestArguments withBaseUrl(@Nullable URI baseUrl);

    RequestArguments withUrlResolution(@Nullable UrlResolution resolution);

    RequestArguments withMethod(@Nullable HttpMethod method);

    RequestArguments withUriTemplate(@Nullable String uriTemplate);

    RequestArguments replaceUriVariables(List uriVariables);

    RequestArguments withUri(@Nullable URI uri);

     RequestArguments withAttribute(Attribute attribute, T value);

    RequestArguments withQueryParam(String name, String value);

    RequestArguments withQueryParams(Map> queryParams);

    RequestArguments withoutQueryParam(String name);

    RequestArguments replaceQueryParams(Map> queryParams);

    RequestArguments withHeader(String name, String value);

    RequestArguments withHeaders(Map> headers);

    RequestArguments withoutHeader(String name);

    RequestArguments replaceHeaders(Map> headers);

    RequestArguments withBody(@Nullable Object body);

    RequestArguments withEntity(@Nullable Entity entity);

    RequestArguments withRoute(Route route);

    static RequestArguments create() {
        return new DefaultRequestArguments();
    }

}