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();
}