Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.algolia.api.InsightsClient Maven / Gradle / Ivy
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
package com.algolia.api;
import com.algolia.ApiClient;
import com.algolia.config.*;
import com.algolia.config.ClientOptions;
import com.algolia.exceptions.*;
import com.algolia.model.insights.*;
import com.algolia.utils.*;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
public class InsightsClient extends ApiClient {
private static final String[] allowedRegions = { "de", "us" };
public InsightsClient(String appId, String apiKey) {
this(appId, apiKey, null, null);
}
public InsightsClient(String appId, String apiKey, ClientOptions options) {
this(appId, apiKey, null, options);
}
public InsightsClient(String appId, String apiKey, String region) {
this(appId, apiKey, region, null);
}
public InsightsClient(String appId, String apiKey, String region, ClientOptions options) {
super(appId, apiKey, "Insights", options, getDefaultHosts(region));
}
private static List getDefaultHosts(String region) throws AlgoliaRuntimeException {
List hosts = new ArrayList<>();
boolean found = region == null;
if (region != null) {
for (String allowed : allowedRegions) {
if (allowed.equals(region)) {
found = true;
break;
}
}
}
if (!found) {
throw new AlgoliaRuntimeException("`region` must be one of the following: de, us");
}
String url = region == null ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
hosts.add(new Host(url, EnumSet.of(CallType.READ, CallType.WRITE)));
return hosts;
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object del(String path, Map parameters, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return LaunderThrowable.await(delAsync(path, parameters, requestOptions));
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object del(String path, Map parameters) throws AlgoliaRuntimeException {
return this.del(path, parameters, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object del(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.del(path, null, requestOptions);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object del(String path) throws AlgoliaRuntimeException {
return this.del(path, null, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture delAsync(String path, Map parameters, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
if (path == null) {
throw new AlgoliaRuntimeException("Parameter `path` is required when calling `del`.");
}
HttpRequest request = HttpRequest.builder().setPathEncoded("/1{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
return executeAsync(request, requestOptions, new TypeReference() {});
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture delAsync(String path, Map parameters) throws AlgoliaRuntimeException {
return this.delAsync(path, parameters, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture delAsync(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.delAsync(path, null, requestOptions);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture delAsync(String path) throws AlgoliaRuntimeException {
return this.delAsync(path, null, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object get(String path, Map parameters, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return LaunderThrowable.await(getAsync(path, parameters, requestOptions));
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object get(String path, Map parameters) throws AlgoliaRuntimeException {
return this.get(path, parameters, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object get(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.get(path, null, requestOptions);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object get(String path) throws AlgoliaRuntimeException {
return this.get(path, null, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture getAsync(String path, Map parameters, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
if (path == null) {
throw new AlgoliaRuntimeException("Parameter `path` is required when calling `get`.");
}
HttpRequest request = HttpRequest.builder().setPathEncoded("/1{path}", path).setMethod("GET").addQueryParameters(parameters).build();
return executeAsync(request, requestOptions, new TypeReference() {});
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture getAsync(String path, Map parameters) throws AlgoliaRuntimeException {
return this.getAsync(path, parameters, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture getAsync(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.getAsync(path, null, requestOptions);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture getAsync(String path) throws AlgoliaRuntimeException {
return this.getAsync(path, null, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object post(String path, Map parameters, Object body, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(postAsync(path, parameters, body, requestOptions));
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object post(String path, Map parameters, Object body) throws AlgoliaRuntimeException {
return this.post(path, parameters, body, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object post(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.post(path, null, null, requestOptions);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object post(String path) throws AlgoliaRuntimeException {
return this.post(path, null, null, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture postAsync(String path, Map parameters, Object body, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
if (path == null) {
throw new AlgoliaRuntimeException("Parameter `path` is required when calling `post`.");
}
HttpRequest request = HttpRequest
.builder()
.setPathEncoded("/1{path}", path)
.setMethod("POST")
.setBody(body)
.addQueryParameters(parameters)
.build();
return executeAsync(request, requestOptions, new TypeReference() {});
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture postAsync(String path, Map parameters, Object body) throws AlgoliaRuntimeException {
return this.postAsync(path, parameters, body, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture postAsync(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.postAsync(path, null, null, requestOptions);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture postAsync(String path) throws AlgoliaRuntimeException {
return this.postAsync(path, null, null, null);
}
/**
* Send a list of events to the Insights API. You can include up to 1,000 events in a single
* request, but the request body must be smaller than 2 MB.
*
* @param insightsEvents (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public EventsResponse pushEvents(InsightsEvents insightsEvents, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return LaunderThrowable.await(pushEventsAsync(insightsEvents, requestOptions));
}
/**
* Send a list of events to the Insights API. You can include up to 1,000 events in a single
* request, but the request body must be smaller than 2 MB.
*
* @param insightsEvents (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public EventsResponse pushEvents(InsightsEvents insightsEvents) throws AlgoliaRuntimeException {
return this.pushEvents(insightsEvents, null);
}
/**
* (asynchronously) Send a list of events to the Insights API. You can include up to 1,000 events
* in a single request, but the request body must be smaller than 2 MB.
*
* @param insightsEvents (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture pushEventsAsync(InsightsEvents insightsEvents, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
if (insightsEvents == null) {
throw new AlgoliaRuntimeException("Parameter `insightsEvents` is required when calling `pushEvents`.");
}
HttpRequest request = HttpRequest.builder().setPath("/1/events").setMethod("POST").setBody(insightsEvents).build();
return executeAsync(request, requestOptions, new TypeReference() {});
}
/**
* (asynchronously) Send a list of events to the Insights API. You can include up to 1,000 events
* in a single request, but the request body must be smaller than 2 MB.
*
* @param insightsEvents (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture pushEventsAsync(InsightsEvents insightsEvents) throws AlgoliaRuntimeException {
return this.pushEventsAsync(insightsEvents, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object put(String path, Map parameters, Object body, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(putAsync(path, parameters, body, requestOptions));
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object put(String path, Map parameters, Object body) throws AlgoliaRuntimeException {
return this.put(path, parameters, body, null);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object put(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.put(path, null, null, requestOptions);
}
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public Object put(String path) throws AlgoliaRuntimeException {
return this.put(path, null, null, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture putAsync(String path, Map parameters, Object body, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
if (path == null) {
throw new AlgoliaRuntimeException("Parameter `path` is required when calling `put`.");
}
HttpRequest request = HttpRequest
.builder()
.setPathEncoded("/1{path}", path)
.setMethod("PUT")
.setBody(body)
.addQueryParameters(parameters)
.build();
return executeAsync(request, requestOptions, new TypeReference() {});
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param parameters Query parameters to apply to the current query. (optional)
* @param body Parameters to send with the custom request. (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture putAsync(String path, Map parameters, Object body) throws AlgoliaRuntimeException {
return this.putAsync(path, parameters, body, null);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture putAsync(String path, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.putAsync(path, null, null, requestOptions);
}
/**
* (asynchronously) This method allow you to send requests to the Algolia REST API.
*
* @param path Path of the endpoint, anything after \"/1\" must be specified. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture putAsync(String path) throws AlgoliaRuntimeException {
return this.putAsync(path, null, null, null);
}
}