Skip to content

Commit

Permalink
new client with async fixes (#59)
Browse files Browse the repository at this point in the history
The upgrade for okhttp3 didn't handle client creation for async calls well. It was trying to change immutable objects. The swagger-codegen is buggy, so I had to fix it in our fork
  • Loading branch information
kwadhwa18 authored Sep 20, 2023
1 parent e48924b commit 99d62be
Show file tree
Hide file tree
Showing 216 changed files with 1,565 additions and 518 deletions.
9 changes: 6 additions & 3 deletions src/main/java/com/rockset/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package com.rockset.client;

import com.rockset.client.auth.ApiKeyAuth;
import com.rockset.client.model.ErrorModel;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -87,13 +88,13 @@ public ApiClient() {
.readTimeout(140, TimeUnit.SECONDS)
.build();


verifyingSsl = true;

json = new JSON();

// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("ApiKeyAuth", new ApiKeyAuth("header", "Authorization"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
Expand Down Expand Up @@ -360,9 +361,11 @@ public ApiClient setDebugging(boolean debugging) {
if (debugging) {
loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(Level.BODY);
httpClient.interceptors().add(loggingInterceptor);
setHttpClient(getHttpClient().newBuilder().addInterceptor(loggingInterceptor).build());
} else {
httpClient.interceptors().remove(loggingInterceptor);
OkHttpClient.Builder client = getHttpClient().newBuilder();
client.interceptors().remove(loggingInterceptor);
setHttpClient(client.build());
loggingInterceptor = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rockset/client/ApiException.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.Map;
import java.util.List;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-07T20:46:16.821-07:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-19T15:55:29.974-07:00")
public class ApiException extends Exception {
private int code = 0;
private Map<String, List<String>> responseHeaders = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rockset/client/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package com.rockset.client;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-07T20:46:16.821-07:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-19T15:55:29.974-07:00")
public class Configuration {
private static ApiClient defaultApiClient = new ApiClient();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rockset/client/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package com.rockset.client;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-07T20:46:16.821-07:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-19T15:55:29.974-07:00")
public class Pair {
private String name = "";
private String value = "";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rockset/client/StringUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package com.rockset.client;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-07T20:46:16.821-07:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2023-09-19T15:55:29.974-07:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/rockset/client/api/AliasesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ public okhttp3.Call createCall(String workspace, CreateAliasRequest body, final
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -228,18 +228,18 @@ public okhttp3.Call deleteCall(String workspace, String alias, final ProgressRes
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -361,18 +361,18 @@ public okhttp3.Call getCall(String workspace, String alias, final ProgressRespon
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -490,18 +490,18 @@ public okhttp3.Call listCall(final ProgressResponseBody.ProgressListener progres
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -608,18 +608,18 @@ public okhttp3.Call updateCall(String workspace, String alias, UpdateAliasReques
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -747,18 +747,18 @@ public okhttp3.Call workspaceCall(String workspace, final ProgressResponseBody.P
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down
30 changes: 15 additions & 15 deletions src/main/java/com/rockset/client/api/ApiKeysApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,18 @@ public okhttp3.Call createCall(CreateApiKeyRequest body, final ProgressResponseB
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -219,18 +219,18 @@ public okhttp3.Call deleteCall(String name, String user, final ProgressResponseB
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -355,18 +355,18 @@ public okhttp3.Call getCall(String user, String name, Boolean reveal, final Prog
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -489,18 +489,18 @@ public okhttp3.Call listCall(String user, final ProgressResponseBody.ProgressLis
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down Expand Up @@ -615,18 +615,18 @@ public okhttp3.Call updateCall(String name, String user, UpdateApiKeyRequest bod
localVarHeaderParams.put("Content-Type", localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
apiClient.setHttpClient(apiClient.getHttpClient().newBuilder().addInterceptor(new okhttp3.Interceptor() {
@Override
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
okhttp3.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}).build());
}

String[] localVarAuthNames = new String[] { };
String[] localVarAuthNames = new String[] { "ApiKeyAuth" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

Expand Down
Loading

0 comments on commit 99d62be

Please sign in to comment.