Package io.higgs.http.client

Examples of io.higgs.http.client.POST


        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("ID is required get a historics query");
        }
        FutureData<HistoricsQuery> future = new FutureData<HistoricsQuery>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(GET));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new HistoricsQuery())))
                .form("id", id)
                .form("with_estimate", withEstimate ? 1 : 0);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here


     * @return an iterable list of {@link HistoricsQuery}s
     */
    public FutureData<HistoricsQueryList> get(int max, int page, boolean withEstimate) {
        FutureData<HistoricsQueryList> future = new FutureData<HistoricsQueryList>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(GET));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new HistoricsQueryList())))
                .form("with_estimate", withEstimate ? 1 : 0);
        if (max > 0) {
            request.form("max", max);
        }
        if (page > 0) {
            request.form("page", page);
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

    public FutureData<PreparedHistoricsQuery> prepare(String hash, long start, long end, String name, int sample,
                                                      String... sources) {
        FutureData<PreparedHistoricsQuery> future = new FutureData<PreparedHistoricsQuery>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(PREPARE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PreparedHistoricsQuery())))
                .form("hash", hash)
                .form("start", start)
                .form("end", end)
                .form("name", name);
        if (sample > 0) {
            request.form("sample", sample);
        }
        if (sources == null || sources.length == 0) {
            sources = new String[]{ "twitter" };
        }
        StringBuilder b = new StringBuilder();
        for (String source : sources) {
            b.append(source).append(",");
        }
        request.form("sources", b.toString().substring(0, b.length() - 1));
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (name == null || source == null) {
            throw new IllegalArgumentException("Name and a data source are both required");
        }
        FutureData<ManagedSource> future = new FutureData<ManagedSource>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(id == null ? CREATE : UPDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource())))
                .form("source_type", source.type().value())
                .form("name", name);
        if (source.hasParams()) {
            request.form("parameters", source.getURLEncodedParameters());
        }
        if (source.hasResources()) {
            request.form("resources", source.getURLEncodedResources());
        }
        if (source.hasAuth()) {
            request.form("auth", source.getURLEncodedAuth());
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        final FutureData<DataSiftResult> future = new FutureData<DataSiftResult>();
        final DataSiftResult res = new DataSiftResult();
        unwrapFuture(source, future, res, new FutureResponse<ManagedSource>() {
            public void apply(ManagedSource data) {
                URI uri = newParams().forURL(config.newAPIEndpointURI(START));
                POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, data)))
                        .form("id", data.getId());
                applyConfig(request).execute();
            }
        });
        return future;
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A push subscription ID is required");
        }
        FutureData<PushSubscription> future = new FutureData<PushSubscription>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(PAUSE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushSubscription())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null) {
            throw new IllegalArgumentException("A data source is required");
        }
        FutureData<ManagedSource> future = new FutureData<ManagedSource>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(STOP));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A push subscription ID is required");
        }
        FutureData<PushSubscription> future = new FutureData<PushSubscription>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(RESUME));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushSubscription())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A push subscription ID is required");
        }
        FutureData<PushSubscription> future = new FutureData<PushSubscription>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(STOP));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushSubscription())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null) {
            throw new IllegalArgumentException("A data source is required");
        }
        FutureData<DataSiftResult> future = new FutureData<DataSiftResult>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(DELETE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new DataSiftResult())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

TOP

Related Classes of io.higgs.http.client.POST

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.