com.rockset.client.api.IntegrationsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rockset-java Show documentation
Show all versions of rockset-java Show documentation
The official Rockset Java client library
/*
* REST API
* Rockset's REST API allows for creating and managing all resources in Rockset. Each supported endpoint is documented below. All requests must be authorized with a Rockset API key, which can be created in the [Rockset console](https://console.rockset.com). The API key must be provided as `ApiKey ` in the `Authorization` request header. For example: ``` Authorization: ApiKey aB35kDjg93J5nsf4GjwMeErAVd832F7ad4vhsW1S02kfZiab42sTsfW5Sxt25asT ``` All endpoints are only accessible via https. Build something awesome!
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.rockset.client.api;
import com.rockset.client.ApiCallback;
import com.rockset.client.ApiClient;
import com.rockset.client.ApiResponse;
import com.rockset.client.Configuration;
import com.rockset.client.Pair;
import com.rockset.client.ProgressRequestBody;
import com.rockset.client.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.rockset.client.model.CreateIntegrationRequest;
import com.rockset.client.model.CreateIntegrationResponse;
import com.rockset.client.model.DeleteIntegrationResponse;
import com.rockset.client.model.ErrorModel;
import com.rockset.client.model.GetIntegrationResponse;
import com.rockset.client.model.ListIntegrationsResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IntegrationsApi {
private ApiClient apiClient;
public IntegrationsApi() {
this(Configuration.getDefaultApiClient());
}
public IntegrationsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for create
* @param body integration credentials (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws Exception If fail to serialize the request body object
*/
public com.squareup.okhttp.Call createCall(CreateIntegrationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/v1/orgs/self/integrations";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call createValidateBeforeCall(CreateIntegrationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'body' is set
if (body == null) {
throw new Exception("Missing the required parameter 'body' when calling create(Async)");
}
com.squareup.okhttp.Call call = createCall(body, progressListener, progressRequestListener);
return call;
}
/**
* Create Integration
* Create a new integration.
* @param body integration credentials (required)
* @return CreateIntegrationResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CreateIntegrationResponse create(CreateIntegrationRequest body) throws Exception {
ApiResponse resp = createWithHttpInfo(body);
return resp.getData();
}
/**
* Create Integration
* Create a new integration.
* @param body integration credentials (required)
* @return ApiResponse<CreateIntegrationResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse createWithHttpInfo(CreateIntegrationRequest body) throws Exception {
com.squareup.okhttp.Call call = createValidateBeforeCall(body, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Create Integration (asynchronously)
* Create a new integration.
* @param body integration credentials (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws Exception If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call createAsync(CreateIntegrationRequest body, final ApiCallback callback) throws Exception {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = createValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for delete
* @param integration name of the integration (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws Exception If fail to serialize the request body object
*/
public com.squareup.okhttp.Call deleteCall(String integration, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/integrations/{integration}"
.replaceAll("\\{" + "integration" + "\\}", apiClient.escapeString(integration.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call deleteValidateBeforeCall(String integration, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'integration' is set
if (integration == null) {
throw new Exception("Missing the required parameter 'integration' when calling delete(Async)");
}
com.squareup.okhttp.Call call = deleteCall(integration, progressListener, progressRequestListener);
return call;
}
/**
* Delete Integration
* Remove an integration.
* @param integration name of the integration (required)
* @return DeleteIntegrationResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public DeleteIntegrationResponse delete(String integration) throws Exception {
ApiResponse resp = deleteWithHttpInfo(integration);
return resp.getData();
}
/**
* Delete Integration
* Remove an integration.
* @param integration name of the integration (required)
* @return ApiResponse<DeleteIntegrationResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse deleteWithHttpInfo(String integration) throws Exception {
com.squareup.okhttp.Call call = deleteValidateBeforeCall(integration, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Delete Integration (asynchronously)
* Remove an integration.
* @param integration name of the integration (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws Exception If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call deleteAsync(String integration, final ApiCallback callback) throws Exception {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = deleteValidateBeforeCall(integration, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for get
* @param integration name of the integration (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws Exception If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getCall(String integration, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/integrations/{integration}"
.replaceAll("\\{" + "integration" + "\\}", apiClient.escapeString(integration.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getValidateBeforeCall(String integration, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'integration' is set
if (integration == null) {
throw new Exception("Missing the required parameter 'integration' when calling get(Async)");
}
com.squareup.okhttp.Call call = getCall(integration, progressListener, progressRequestListener);
return call;
}
/**
* Retrieve Integration
* Retrieve information about a single integration.
* @param integration name of the integration (required)
* @return GetIntegrationResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public GetIntegrationResponse get(String integration) throws Exception {
ApiResponse resp = getWithHttpInfo(integration);
return resp.getData();
}
/**
* Retrieve Integration
* Retrieve information about a single integration.
* @param integration name of the integration (required)
* @return ApiResponse<GetIntegrationResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getWithHttpInfo(String integration) throws Exception {
com.squareup.okhttp.Call call = getValidateBeforeCall(integration, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Retrieve Integration (asynchronously)
* Retrieve information about a single integration.
* @param integration name of the integration (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws Exception If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getAsync(String integration, final ApiCallback callback) throws Exception {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getValidateBeforeCall(integration, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for list
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws Exception If fail to serialize the request body object
*/
public com.squareup.okhttp.Call listCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/integrations";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call listValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
com.squareup.okhttp.Call call = listCall(progressListener, progressRequestListener);
return call;
}
/**
* List Integrations
* List all integrations in an organization.
* @return ListIntegrationsResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ListIntegrationsResponse list() throws Exception {
ApiResponse resp = listWithHttpInfo();
return resp.getData();
}
/**
* List Integrations
* List all integrations in an organization.
* @return ApiResponse<ListIntegrationsResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse listWithHttpInfo() throws Exception {
com.squareup.okhttp.Call call = listValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* List Integrations (asynchronously)
* List all integrations in an organization.
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws Exception If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call listAsync(final ApiCallback callback) throws Exception {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = listValidateBeforeCall(progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}