Skip to content

Commit b51e772

Browse files
Release 1.9.1
1 parent ad1a05c commit b51e772

20 files changed

Lines changed: 1096 additions & 45 deletions

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ publishing {
4646
maven(MavenPublication) {
4747
groupId = 'com.polytomic'
4848
artifactId = 'polytomic-java'
49-
version = '1.9.0'
49+
version = '1.9.1'
5050
from components.java
5151
pom {
5252
licenses {

src/main/java/com/polytomic/api/Polytomic.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public class Polytomic {
2929

3030
protected final Supplier<QueryRunnerClient> queryRunnerClient;
3131

32+
protected final Supplier<ModelsClient> modelsClient;
33+
3234
protected final Supplier<ModelSyncClient> modelSyncClient;
3335

3436
protected final Supplier<SchemasClient> schemasClient;
3537

36-
protected final Supplier<ModelsClient> modelsClient;
37-
3838
protected final Supplier<EventsClient> eventsClient;
3939

4040
protected final Supplier<JobsClient> jobsClient;
@@ -54,9 +54,9 @@ public Polytomic(ClientOptions clientOptions) {
5454
this.bulkSyncClient = Suppliers.memoize(() -> new BulkSyncClient(clientOptions));
5555
this.connectionsClient = Suppliers.memoize(() -> new ConnectionsClient(clientOptions));
5656
this.queryRunnerClient = Suppliers.memoize(() -> new QueryRunnerClient(clientOptions));
57+
this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions));
5758
this.modelSyncClient = Suppliers.memoize(() -> new ModelSyncClient(clientOptions));
5859
this.schemasClient = Suppliers.memoize(() -> new SchemasClient(clientOptions));
59-
this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions));
6060
this.eventsClient = Suppliers.memoize(() -> new EventsClient(clientOptions));
6161
this.jobsClient = Suppliers.memoize(() -> new JobsClient(clientOptions));
6262
this.identityClient = Suppliers.memoize(() -> new IdentityClient(clientOptions));
@@ -78,6 +78,10 @@ public QueryRunnerClient queryRunner() {
7878
return this.queryRunnerClient.get();
7979
}
8080

81+
public ModelsClient models() {
82+
return this.modelsClient.get();
83+
}
84+
8185
public ModelSyncClient modelSync() {
8286
return this.modelSyncClient.get();
8387
}
@@ -86,10 +90,6 @@ public SchemasClient schemas() {
8690
return this.schemasClient.get();
8791
}
8892

89-
public ModelsClient models() {
90-
return this.modelsClient.get();
91-
}
92-
9393
public EventsClient events() {
9494
return this.eventsClient.get();
9595
}

src/main/java/com/polytomic/api/core/ClientOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ private ClientOptions(
3030
{
3131
put("X-Fern-Language", "JAVA");
3232
put("X-Fern-SDK-Name", "com.polytomic.fern:api-sdk");
33-
put("X-Fern-SDK-Version", "1.9.0");
33+
put("X-Fern-SDK-Version", "1.9.1");
3434
}
3535
});
3636
this.headerSuppliers = headerSuppliers;

src/main/java/com/polytomic/api/resources/bulksync/BulkSyncClient.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.polytomic.api.resources.bulksync.executions.ExecutionsClient;
1313
import com.polytomic.api.resources.bulksync.requests.BulkSyncGetRequest;
1414
import com.polytomic.api.resources.bulksync.requests.BulkSyncGetSourceRequest;
15+
import com.polytomic.api.resources.bulksync.requests.BulkSyncListRequest;
1516
import com.polytomic.api.resources.bulksync.requests.BulkSyncRemoveRequest;
1617
import com.polytomic.api.resources.bulksync.requests.CreateBulkSyncRequest;
1718
import com.polytomic.api.resources.bulksync.requests.StartBulkSyncRequest;
@@ -49,20 +50,26 @@ public BulkSyncClient(ClientOptions clientOptions) {
4950
}
5051

5152
public BulkSyncListEnvelope list() {
52-
return list(null);
53+
return list(BulkSyncListRequest.builder().build());
5354
}
5455

55-
public BulkSyncListEnvelope list(RequestOptions requestOptions) {
56-
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
56+
public BulkSyncListEnvelope list(BulkSyncListRequest request) {
57+
return list(request, null);
58+
}
59+
60+
public BulkSyncListEnvelope list(BulkSyncListRequest request, RequestOptions requestOptions) {
61+
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
5762
.newBuilder()
58-
.addPathSegments("api/bulk/syncs")
59-
.build();
60-
Request okhttpRequest = new Request.Builder()
61-
.url(httpUrl)
63+
.addPathSegments("api/bulk/syncs");
64+
if (request.getActive().isPresent()) {
65+
httpUrl.addQueryParameter("active", request.getActive().get().toString());
66+
}
67+
Request.Builder _requestBuilder = new Request.Builder()
68+
.url(httpUrl.build())
6269
.method("GET", null)
6370
.headers(Headers.of(clientOptions.headers(requestOptions)))
64-
.addHeader("Content-Type", "application/json")
65-
.build();
71+
.addHeader("Content-Type", "application/json");
72+
Request okhttpRequest = _requestBuilder.build();
6673
try {
6774
OkHttpClient client = clientOptions.httpClient();
6875
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {

src/main/java/com/polytomic/api/resources/bulksync/executions/ExecutionsClient.java

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
import com.polytomic.api.core.ClientOptions;
88
import com.polytomic.api.core.ObjectMappers;
99
import com.polytomic.api.core.RequestOptions;
10+
import com.polytomic.api.resources.bulksync.executions.requests.ExecutionsExportLogsRequest;
1011
import com.polytomic.api.resources.bulksync.executions.requests.ExecutionsListStatusRequest;
1112
import com.polytomic.api.types.BulkSyncExecutionEnvelope;
1213
import com.polytomic.api.types.ListBulkSyncExecutionStatusEnvelope;
1314
import com.polytomic.api.types.ListBulkSyncExecutionsEnvelope;
15+
import com.polytomic.api.types.V4BulkSyncExecutionLogsEnvelope;
16+
import com.polytomic.api.types.V4ExportSyncLogsEnvelope;
1417
import java.io.IOException;
1518
import okhttp3.Headers;
1619
import okhttp3.HttpUrl;
1720
import okhttp3.OkHttpClient;
1821
import okhttp3.Request;
22+
import okhttp3.RequestBody;
1923
import okhttp3.Response;
2024
import okhttp3.ResponseBody;
2125

@@ -146,4 +150,89 @@ public BulkSyncExecutionEnvelope get(String id, String execId, RequestOptions re
146150
throw new RuntimeException(e);
147151
}
148152
}
153+
154+
public V4BulkSyncExecutionLogsEnvelope getLogs(String syncId, String executionId) {
155+
return getLogs(syncId, executionId, null);
156+
}
157+
158+
public V4BulkSyncExecutionLogsEnvelope getLogs(String syncId, String executionId, RequestOptions requestOptions) {
159+
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
160+
.newBuilder()
161+
.addPathSegments("api/bulk/syncs")
162+
.addPathSegment(syncId)
163+
.addPathSegments("executions")
164+
.addPathSegment(executionId)
165+
.addPathSegments("logs")
166+
.build();
167+
Request okhttpRequest = new Request.Builder()
168+
.url(httpUrl)
169+
.method("GET", null)
170+
.headers(Headers.of(clientOptions.headers(requestOptions)))
171+
.addHeader("Content-Type", "application/json")
172+
.build();
173+
try {
174+
OkHttpClient client = clientOptions.httpClient();
175+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
176+
client = clientOptions.httpClientWithTimeout(requestOptions);
177+
}
178+
Response response = client.newCall(okhttpRequest).execute();
179+
ResponseBody responseBody = response.body();
180+
if (response.isSuccessful()) {
181+
return ObjectMappers.JSON_MAPPER.readValue(
182+
responseBody.string(), V4BulkSyncExecutionLogsEnvelope.class);
183+
}
184+
throw new ApiError(
185+
response.code(),
186+
ObjectMappers.JSON_MAPPER.readValue(
187+
responseBody != null ? responseBody.string() : "{}", Object.class));
188+
} catch (IOException e) {
189+
throw new RuntimeException(e);
190+
}
191+
}
192+
193+
public V4ExportSyncLogsEnvelope exportLogs(String syncId, String executionId) {
194+
return exportLogs(
195+
syncId, executionId, ExecutionsExportLogsRequest.builder().build());
196+
}
197+
198+
public V4ExportSyncLogsEnvelope exportLogs(String syncId, String executionId, ExecutionsExportLogsRequest request) {
199+
return exportLogs(syncId, executionId, request, null);
200+
}
201+
202+
public V4ExportSyncLogsEnvelope exportLogs(
203+
String syncId, String executionId, ExecutionsExportLogsRequest request, RequestOptions requestOptions) {
204+
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
205+
.newBuilder()
206+
.addPathSegments("api/bulk/syncs")
207+
.addPathSegment(syncId)
208+
.addPathSegments("executions")
209+
.addPathSegment(executionId)
210+
.addPathSegments("logs/export");
211+
if (request.getNotify().isPresent()) {
212+
httpUrl.addQueryParameter("notify", request.getNotify().get().toString());
213+
}
214+
Request.Builder _requestBuilder = new Request.Builder()
215+
.url(httpUrl.build())
216+
.method("POST", RequestBody.create("", null))
217+
.headers(Headers.of(clientOptions.headers(requestOptions)))
218+
.addHeader("Content-Type", "application/json");
219+
Request okhttpRequest = _requestBuilder.build();
220+
try {
221+
OkHttpClient client = clientOptions.httpClient();
222+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
223+
client = clientOptions.httpClientWithTimeout(requestOptions);
224+
}
225+
Response response = client.newCall(okhttpRequest).execute();
226+
ResponseBody responseBody = response.body();
227+
if (response.isSuccessful()) {
228+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), V4ExportSyncLogsEnvelope.class);
229+
}
230+
throw new ApiError(
231+
response.code(),
232+
ObjectMappers.JSON_MAPPER.readValue(
233+
responseBody != null ? responseBody.string() : "{}", Object.class));
234+
} catch (IOException e) {
235+
throw new RuntimeException(e);
236+
}
237+
}
149238
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.polytomic.api.resources.bulksync.executions.requests;
5+
6+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
7+
import com.fasterxml.jackson.annotation.JsonAnySetter;
8+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
9+
import com.fasterxml.jackson.annotation.JsonInclude;
10+
import com.fasterxml.jackson.annotation.JsonProperty;
11+
import com.fasterxml.jackson.annotation.JsonSetter;
12+
import com.fasterxml.jackson.annotation.Nulls;
13+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
14+
import com.polytomic.api.core.ObjectMappers;
15+
import java.util.HashMap;
16+
import java.util.Map;
17+
import java.util.Objects;
18+
import java.util.Optional;
19+
20+
@JsonInclude(JsonInclude.Include.NON_EMPTY)
21+
@JsonDeserialize(builder = ExecutionsExportLogsRequest.Builder.class)
22+
public final class ExecutionsExportLogsRequest {
23+
private final Optional<Boolean> notify;
24+
25+
private final Map<String, Object> additionalProperties;
26+
27+
private ExecutionsExportLogsRequest(Optional<Boolean> notify, Map<String, Object> additionalProperties) {
28+
this.notify = notify;
29+
this.additionalProperties = additionalProperties;
30+
}
31+
32+
/**
33+
* @return Send a notification to the user when the logs are ready for download.
34+
*/
35+
@JsonProperty("notify")
36+
public Optional<Boolean> getNotify() {
37+
return notify;
38+
}
39+
40+
@java.lang.Override
41+
public boolean equals(Object other) {
42+
if (this == other) return true;
43+
return other instanceof ExecutionsExportLogsRequest && equalTo((ExecutionsExportLogsRequest) other);
44+
}
45+
46+
@JsonAnyGetter
47+
public Map<String, Object> getAdditionalProperties() {
48+
return this.additionalProperties;
49+
}
50+
51+
private boolean equalTo(ExecutionsExportLogsRequest other) {
52+
return notify.equals(other.notify);
53+
}
54+
55+
@java.lang.Override
56+
public int hashCode() {
57+
return Objects.hash(this.notify);
58+
}
59+
60+
@java.lang.Override
61+
public String toString() {
62+
return ObjectMappers.stringify(this);
63+
}
64+
65+
public static Builder builder() {
66+
return new Builder();
67+
}
68+
69+
@JsonIgnoreProperties(ignoreUnknown = true)
70+
public static final class Builder {
71+
private Optional<Boolean> notify = Optional.empty();
72+
73+
@JsonAnySetter
74+
private Map<String, Object> additionalProperties = new HashMap<>();
75+
76+
private Builder() {}
77+
78+
public Builder from(ExecutionsExportLogsRequest other) {
79+
notify(other.getNotify());
80+
return this;
81+
}
82+
83+
@JsonSetter(value = "notify", nulls = Nulls.SKIP)
84+
public Builder notify(Optional<Boolean> notify) {
85+
this.notify = notify;
86+
return this;
87+
}
88+
89+
public Builder notify(Boolean notify) {
90+
this.notify = Optional.of(notify);
91+
return this;
92+
}
93+
94+
public ExecutionsExportLogsRequest build() {
95+
return new ExecutionsExportLogsRequest(notify, additionalProperties);
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)