Skip to content

Commit 7b4f18a

Browse files
committed
Inline query parameter and header processing in impls
1 parent b4f8237 commit 7b4f18a

File tree

137 files changed

+6661
-2847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+6661
-2847
lines changed

databricks-sdk-java/src/main/java/com/databricks/sdk/core/ApiClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private ApiClient(Builder builder) {
151151
bodyLogger = new BodyLogger(mapper, 1024, debugTruncateBytes);
152152
}
153153

154-
private static <I> void setQuery(Request in, I entity) {
154+
public static <I> void setQuery(Request in, I entity) {
155155
if (entity == null) {
156156
return;
157157
}
@@ -239,7 +239,7 @@ private <I> Request prepareRequest(String method, String path, I in, Map<String,
239239
* @param target Expected pojo type
240240
* @return POJO of requested type
241241
*/
242-
private <T> T execute(Request in, Class<T> target) throws IOException {
242+
public <T> T execute(Request in, Class<T> target) throws IOException {
243243
Response out = getResponse(in);
244244
if (target == Void.class) {
245245
return null;
@@ -478,7 +478,7 @@ public <T> void deserialize(Response response, T object) throws IOException {
478478
}
479479
}
480480

481-
private String serialize(Object body) throws JsonProcessingException {
481+
public String serialize(Object body) throws JsonProcessingException {
482482
if (body == null) {
483483
return null;
484484
}

databricks-sdk-java/src/main/java/com/databricks/sdk/core/DatabricksConfig.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,13 @@ private OpenIDConnectEndpoints fetchDefaultOidcEndpoints() throws IOException {
586586
.withHttpClient(getHttpClient())
587587
.withGetHostFunc(v -> getHost())
588588
.build();
589-
return apiClient.execute("GET",
590-
"/oidc/.well-known/oauth-authorization-server",
591-
null,
592-
OpenIDConnectEndpoints.class,
593-
new HashMap<>());
589+
try {
590+
return apiClient.execute(
591+
new Request("GET", "/oidc/.well-known/oauth-authorization-server"),
592+
OpenIDConnectEndpoints.class);
593+
} catch (IOException e) {
594+
throw new DatabricksException("IO error: " + e.getMessage(), e);
595+
}
594596
}
595597

596598
@Override

databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/RefreshableTokenSource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.databricks.sdk.core.DatabricksException;
55
import com.databricks.sdk.core.http.FormRequest;
66
import com.databricks.sdk.core.http.HttpClient;
7+
import com.databricks.sdk.core.http.Request;
78
import java.time.LocalDateTime;
89
import java.time.temporal.ChronoUnit;
910
import java.util.Base64;
@@ -61,12 +62,11 @@ protected static Token retrieveToken(
6162
break;
6263
}
6364
headers.put("Content-Type", "application/x-www-form-urlencoded");
65+
Request req = new Request("POST", tokenUrl, FormRequest.wrapValuesInList(params));
66+
req.withHeaders(headers);
6467
try {
6568
ApiClient apiClient = new ApiClient.Builder().withHttpClient(hc).build();
66-
67-
OAuthResponse resp =
68-
apiClient.execute("POST",
69-
tokenUrl, FormRequest.wrapValuesInList(params), OAuthResponse.class, headers);
69+
OAuthResponse resp = apiClient.execute(req, OAuthResponse.class);
7070
if (resp.getErrorCode() != null) {
7171
throw new IllegalArgumentException(resp.getErrorCode() + ": " + resp.getErrorSummary());
7272
}

databricks-sdk-java/src/main/java/com/databricks/sdk/service/apps/AppsImpl.java

Lines changed: 122 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks-sdk-java/src/main/java/com/databricks/sdk/service/billing/BillableUsageImpl.java

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)