use of com.couchbase.client.core.endpoint.http.CoreHttpPath in project couchbase-jvm-clients by couchbase.
the class CoreAnalyticsLinkManager method sendLink.
private CompletableFuture<Void> sendLink(HttpMethod method, Map<String, String> link, CoreCommonOptions options, String tracingId) {
// ensure mutability, and don't modify caller's map
link = new HashMap<>(link);
CoreHttpPath path = getLinkPathAndAdjustMap(link);
UrlQueryStringBuilder form = newForm();
link.forEach(form::set);
return httpClient.newRequest(method, path, options).trace(tracingId).form(form).exec(core).exceptionally(t -> {
throw translateCompilationFailureToInvalidArgument(t);
}).thenApply(result -> null);
}
use of com.couchbase.client.core.endpoint.http.CoreHttpPath in project couchbase-jvm-clients by couchbase.
the class CoreAnalyticsLinkManager method getLinks.
/**
* @param dataverseName (nullable)
* @param linkType (nullable)
* @param linkName (nullable) if present, dataverseName must also be present
*/
public CompletableFuture<byte[]> getLinks(String dataverseName, String linkType, String linkName, CoreCommonOptions options) {
if (linkName != null && dataverseName == null) {
throw InvalidArgumentException.fromMessage("When link name is specified, must also specify dataverse");
}
UrlQueryStringBuilder queryString = newQueryString().setIfNotNull("type", linkType);
CoreHttpPath path = path("/analytics/link");
if (dataverseName != null && dataverseName.contains("/")) {
path = path.plus("/{dataverse}", mapOf("dataverse", dataverseName));
if (linkName != null) {
path = path.plus("/{linkName}", mapOf("linkName", linkName));
}
} else {
queryString.setIfNotNull("dataverse", dataverseName).setIfNotNull("name", linkName);
}
return httpClient.get(path, options).queryString(queryString).trace(TracingIdentifiers.SPAN_REQUEST_MA_GET_ALL_LINKS).exec(core).thenApply(CoreHttpResponse::content);
}
Aggregations