com.rockset.client.api.ViewsApi 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.CreateViewRequest;
import com.rockset.client.model.CreateViewResponse;
import com.rockset.client.model.DeleteViewResponse;
import com.rockset.client.model.ErrorModel;
import com.rockset.client.model.GetViewResponse;
import com.rockset.client.model.ListViewsResponse;
import com.rockset.client.model.UpdateViewRequest;
import com.rockset.client.model.UpdateViewResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ViewsApi {
private ApiClient apiClient;
public ViewsApi() {
this(Configuration.getDefaultApiClient());
}
public ViewsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for create
* @param workspace name of the workspace (required)
* @param body JSON object (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(String workspace, CreateViewRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/v1/orgs/self/ws/{workspace}/views"
.replaceAll("\\{" + "workspace" + "\\}", apiClient.escapeString(workspace.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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call createValidateBeforeCall(String workspace, CreateViewRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'workspace' is set
if (workspace == null) {
throw new Exception("Missing the required parameter 'workspace' when calling create(Async)");
}
// 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(workspace, body, progressListener, progressRequestListener);
return call;
}
/**
* Create View
* Create a view
* @param workspace name of the workspace (required)
* @param body JSON object (required)
* @return CreateViewResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public CreateViewResponse create(String workspace, CreateViewRequest body) throws Exception {
ApiResponse resp = createWithHttpInfo(workspace, body);
return resp.getData();
}
/**
* Create View
* Create a view
* @param workspace name of the workspace (required)
* @param body JSON object (required)
* @return ApiResponse<CreateViewResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse createWithHttpInfo(String workspace, CreateViewRequest body) throws Exception {
com.squareup.okhttp.Call call = createValidateBeforeCall(workspace, body, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Create View (asynchronously)
* Create a view
* @param workspace name of the workspace (required)
* @param body JSON object (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(String workspace, CreateViewRequest 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(workspace, body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for delete
* @param workspace name of the workspace (required)
* @param view name of the view (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 workspace, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/ws/{workspace}/views/{view}"
.replaceAll("\\{" + "workspace" + "\\}", apiClient.escapeString(workspace.toString()))
.replaceAll("\\{" + "view" + "\\}", apiClient.escapeString(view.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 workspace, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'workspace' is set
if (workspace == null) {
throw new Exception("Missing the required parameter 'workspace' when calling delete(Async)");
}
// verify the required parameter 'view' is set
if (view == null) {
throw new Exception("Missing the required parameter 'view' when calling delete(Async)");
}
com.squareup.okhttp.Call call = deleteCall(workspace, view, progressListener, progressRequestListener);
return call;
}
/**
* Delete View
* Delete a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @return DeleteViewResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public DeleteViewResponse delete(String workspace, String view) throws Exception {
ApiResponse resp = deleteWithHttpInfo(workspace, view);
return resp.getData();
}
/**
* Delete View
* Delete a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @return ApiResponse<DeleteViewResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse deleteWithHttpInfo(String workspace, String view) throws Exception {
com.squareup.okhttp.Call call = deleteValidateBeforeCall(workspace, view, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Delete View (asynchronously)
* Delete a view
* @param workspace name of the workspace (required)
* @param view name of the view (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 workspace, String view, 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(workspace, view, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for get
* @param workspace name of the workspace (required)
* @param view name of the view (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 workspace, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/ws/{workspace}/views/{view}"
.replaceAll("\\{" + "workspace" + "\\}", apiClient.escapeString(workspace.toString()))
.replaceAll("\\{" + "view" + "\\}", apiClient.escapeString(view.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 workspace, String view, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'workspace' is set
if (workspace == null) {
throw new Exception("Missing the required parameter 'workspace' when calling get(Async)");
}
// verify the required parameter 'view' is set
if (view == null) {
throw new Exception("Missing the required parameter 'view' when calling get(Async)");
}
com.squareup.okhttp.Call call = getCall(workspace, view, progressListener, progressRequestListener);
return call;
}
/**
* Retrieve View
* Get details about a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @return GetViewResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public GetViewResponse get(String workspace, String view) throws Exception {
ApiResponse resp = getWithHttpInfo(workspace, view);
return resp.getData();
}
/**
* Retrieve View
* Get details about a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @return ApiResponse<GetViewResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getWithHttpInfo(String workspace, String view) throws Exception {
com.squareup.okhttp.Call call = getValidateBeforeCall(workspace, view, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Retrieve View (asynchronously)
* Get details about a view
* @param workspace name of the workspace (required)
* @param view name of the view (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 workspace, String view, 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(workspace, view, 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/views";
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 Views
* Retrieve all views in an organization
* @return ListViewsResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ListViewsResponse list() throws Exception {
ApiResponse resp = listWithHttpInfo();
return resp.getData();
}
/**
* List Views
* Retrieve all views in an organization
* @return ApiResponse<ListViewsResponse>
* @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 Views (asynchronously)
* Retrieve all views 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;
}
/**
* Build call for update
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @param body JSON object (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 updateCall(String workspace, String view, UpdateViewRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = body;
// create path and map variables
String localVarPath = "/v1/orgs/self/ws/{workspace}/views/{view}"
.replaceAll("\\{" + "workspace" + "\\}", apiClient.escapeString(workspace.toString()))
.replaceAll("\\{" + "view" + "\\}", apiClient.escapeString(view.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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call updateValidateBeforeCall(String workspace, String view, UpdateViewRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'workspace' is set
if (workspace == null) {
throw new Exception("Missing the required parameter 'workspace' when calling update(Async)");
}
// verify the required parameter 'view' is set
if (view == null) {
throw new Exception("Missing the required parameter 'view' when calling update(Async)");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new Exception("Missing the required parameter 'body' when calling update(Async)");
}
com.squareup.okhttp.Call call = updateCall(workspace, view, body, progressListener, progressRequestListener);
return call;
}
/**
* Update View
* Update a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @param body JSON object (required)
* @return UpdateViewResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public UpdateViewResponse update(String workspace, String view, UpdateViewRequest body) throws Exception {
ApiResponse resp = updateWithHttpInfo(workspace, view, body);
return resp.getData();
}
/**
* Update View
* Update a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @param body JSON object (required)
* @return ApiResponse<UpdateViewResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse updateWithHttpInfo(String workspace, String view, UpdateViewRequest body) throws Exception {
com.squareup.okhttp.Call call = updateValidateBeforeCall(workspace, view, body, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Update View (asynchronously)
* Update a view
* @param workspace name of the workspace (required)
* @param view name of the view (required)
* @param body JSON object (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 updateAsync(String workspace, String view, UpdateViewRequest 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 = updateValidateBeforeCall(workspace, view, body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for workspace
* @param workspace name of the workspace (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 workspaceCall(String workspace, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v1/orgs/self/ws/{workspace}/views"
.replaceAll("\\{" + "workspace" + "\\}", apiClient.escapeString(workspace.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 workspaceValidateBeforeCall(String workspace, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws Exception {
// verify the required parameter 'workspace' is set
if (workspace == null) {
throw new Exception("Missing the required parameter 'workspace' when calling workspace(Async)");
}
com.squareup.okhttp.Call call = workspaceCall(workspace, progressListener, progressRequestListener);
return call;
}
/**
* List Views in Workspace
* Retrieve all views in a workspace.
* @param workspace name of the workspace (required)
* @return ListViewsResponse
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ListViewsResponse workspace(String workspace) throws Exception {
ApiResponse resp = workspaceWithHttpInfo(workspace);
return resp.getData();
}
/**
* List Views in Workspace
* Retrieve all views in a workspace.
* @param workspace name of the workspace (required)
* @return ApiResponse<ListViewsResponse>
* @throws Exception If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse workspaceWithHttpInfo(String workspace) throws Exception {
com.squareup.okhttp.Call call = workspaceValidateBeforeCall(workspace, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* List Views in Workspace (asynchronously)
* Retrieve all views in a workspace.
* @param workspace name of the workspace (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 workspaceAsync(String workspace, 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 = workspaceValidateBeforeCall(workspace, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}