Package io.higgs.http.client

Examples of io.higgs.http.client.POST


     */
    public FutureData<PushCollection> get(HistoricsQuery historics, int page, int perPage, String orderBy,
                                          String orderDirection, boolean includeFinished) {
        FutureData<PushCollection> future = new FutureData<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(GET));
        POST request = config.http()
                .POST(uri, new PageReader(newRequestCallback(future, new PushCollection(), config)));
        request.form("historics_id", historics.getId()).form("include_finished", includeFinished ? 1 : 0);
        if (page > 0) {
            request.form("page", page);
        }
        if (perPage > 0) {
            request.form("per_page", perPage);
        }
        if (orderBy != null && !orderBy.isEmpty()) {
            request.form("order_by", orderBy);
        }
        if (orderDirection != null && !orderDirection.isEmpty()) {
            request.form("order_dir", orderDirection);
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here


     * @return the results of the validation
     */
    public <T extends PushConnector> FutureData<PushValidation> validate(T connector) {
        FutureData<PushValidation> future = new FutureData<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new PushValidation(), config)))
                .form("output_type", connector.type().value());
        for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) {
            request.form(e.getKey(), e.getValue());
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

                                                              FutureData<PushSubscription> future,
                                                              PushSubscription subscription,
                                                              PreparedHistoricsQuery historics,
                                                              Stream stream) {
        URI uri = newParams().forURL(config.newAPIEndpointURI(CREATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, subscription, config)))
                .form("output_type", connector.type().value())
                .form("name", name);

        for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) {
            request.form(e.getKey(), e.getValue());
        }

        if (historics != null) {
            request.form("historics_id", historics.getId());
        } else {
            request.form("hash", stream.hash());
        }
        if (initialStatus != null) {
            request.form("initial_status", initialStatus.val());
        }
        if (start > 0) {
            request.form("start", start);
        }
        if (end > 0) {
            request.form("end", end);
        }
        applyConfig(request).execute();
    }
View Full Code Here

        if (parameters.length > 20) {
            throw new IllegalArgumentException("No more than 20 historics preview parameters are allowed");
        }
        FutureData<HistoricsPreview> future = new FutureData<HistoricsPreview>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(CREATE));
        POST request = config.http()
                .POST(uri, new PageReader(newRequestCallback(future, new HistoricsPreview(), config)))
                .form("start", start)
                .form("hash", stream.hash());
        StringBuilder b = new StringBuilder();
        for (String p : parameters) {
            b.append(p).append(',');
        }
        request.form("parameters", b.toString().substring(0, b.length() - 1));
        if (end > 0) {
            request.form("end", end);
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

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

        if (parameters.length > 20) {
            throw new IllegalArgumentException("No more than 20 historics preview parameters are allowed");
        }
        FutureData<HistoricsPreview> future = new FutureData<HistoricsPreview>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(CREATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new HistoricsPreview())))
                .form("start", start)
                .form("hash", stream.hash());
        StringBuilder b = new StringBuilder();
        for (String p : parameters) {
            b.append(p).append(',');
        }
        request.form("parameters", b.toString().substring(0, b.length() - 1));
        if (end > 0) {
            request.form("end", end);
        }
        applyConfig(request).execute();
        return future;
    }
View Full Code Here

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

     * validation was successful or not
     */
    public FutureData<Validation> validate(String csdl) {
        FutureData<Validation> future = new FutureData<Validation>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(VALIDATE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Validation(), config)))
                .form("csdl", csdl);
        performRequest(future, request);
        return future;
    }
View Full Code Here

     * 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 (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 BaseDataSiftResult(), config)))
                .form("id", id);
        performRequest(future, request);
        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.