Package io.higgs.http.client

Examples of io.higgs.http.client.POST


     * to list the hash for the compiled CSDL
     */
    public FutureData<Stream> compile(String csdl) {
        FutureData<Stream> future = new FutureData<Stream>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(COMPILE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Stream(), config)))
                .form("csdl", csdl);
        performRequest(future, request);
        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<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(id == null ? CREATE : UPDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)))
                .form("source_type", source.type().value())
                .form("name", name);
        if (source.hasParams()) {
            request.form("parameters", source.getParametersAsJSON());
        }
        if (source.hasResources()) {
            request.form("resources", source.getResourcesAsJSON());
        }
        if (source.hasAuth()) {
            request.form("auth", source.getAuthAsJSON());
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        final FutureData<DataSiftResult> future = new FutureData<>();
        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, config)))
                        .form("id", data.getId());
                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<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(STOP));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)))
                .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<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(DELETE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new DataSiftResult(), config)))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A valid ID is required to start a Historics query");
        }
        FutureData<DataSiftResult> future = f != null ? f : new FutureData<DataSiftResult>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(START));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new DataSiftResult())))
                .form("id", id);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A valid ID is required to stop a Historics query");
        }
        FutureData<DataSiftResult> future = new FutureData<DataSiftResult>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(STOP));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new DataSiftResult())))
                .form("id", id);
        if (reason != null) {
            request.form("reason", reason);
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

        if (id == null || id.isEmpty()) {
            throw new IllegalArgumentException("A valid ID is required to delete a Historics query");
        }
        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

        if (id == null || name == null || id.isEmpty() || name.isEmpty()) {
            throw new IllegalArgumentException("A valid ID AND name is required to update a Historics query");
        }
        FutureData<DataSiftResult> future = new FutureData<DataSiftResult>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(UPDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new DataSiftResult())))
                .form("id", id)
                .form("name", name);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

     * @return a report of the current status/availability of data for the given time period
     */
    public FutureData<HistoricsStatus> status(DateTime start, DateTime end, String... sources) {
        FutureData<HistoricsStatus> future = new FutureData<HistoricsStatus>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(STATUS));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new HistoricsStatus())))
                .form("start", MILLISECONDS.toSeconds(start.getMillis()))
                .form("end", MILLISECONDS.toSeconds(end.getMillis()));
        if (sources != null && sources.length > 0) {
            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

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.