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

com.aaronbedra.web.request.RestClient Maven / Gradle / Ivy

package com.aaronbedra.web.request;

import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.monad.MonadRec;
import com.jnape.palatable.lambda.monad.transformer.builtin.ReaderT;
import okhttp3.HttpUrl;

import java.util.List;

public class RestClient, RequestType, ResponseType, CookieType> {
    private final ReaderT requestReader;
    private final Fn1> cookieFn;

    public RestClient(ReaderT requestReader, Fn1> cookieFn) {
        this.requestReader = requestReader;
        this.cookieFn = cookieFn;
    }

    public MonadRec request(RequestType request) {
        return requestReader.runReaderT(request);
    }

    public List getCookies(HttpUrl url) {
        return cookieFn.apply(url);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy