Skip to content

Commit a9da2e5

Browse files
Release 1.16.0
1 parent 02464ec commit a9da2e5

10 files changed

Lines changed: 401 additions & 62 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ publishing {
5050
maven(MavenPublication) {
5151
groupId = 'com.polytomic'
5252
artifactId = 'polytomic-java'
53-
version = '1.15.8'
53+
version = '1.16.0'
5454
from components.java
5555
pom {
5656
name = 'polytomic'

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.15.8");
33+
put("X-Fern-SDK-Version", "1.16.0");
3434
}
3535
});
3636
this.headerSuppliers = headerSuppliers;

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.polytomic.api.types.BulkSyncResponseEnvelope;
2828
import com.polytomic.api.types.BulkSyncSourceEnvelope;
2929
import com.polytomic.api.types.BulkSyncStatusEnvelope;
30+
import com.polytomic.api.types.CancelBulkSyncResponseEnvelope;
3031
import java.io.IOException;
3132
import java.util.function.Supplier;
3233
import okhttp3.Headers;
@@ -358,6 +359,42 @@ public ActivateSyncEnvelope activate(String id, ActivateSyncInput request, Reque
358359
}
359360
}
360361

362+
public CancelBulkSyncResponseEnvelope cancel(String id) {
363+
return cancel(id, null);
364+
}
365+
366+
public CancelBulkSyncResponseEnvelope cancel(String id, RequestOptions requestOptions) {
367+
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
368+
.newBuilder()
369+
.addPathSegments("api/bulk/syncs")
370+
.addPathSegment(id)
371+
.addPathSegments("cancel")
372+
.build();
373+
Request okhttpRequest = new Request.Builder()
374+
.url(httpUrl)
375+
.method("POST", RequestBody.create("", null))
376+
.headers(Headers.of(clientOptions.headers(requestOptions)))
377+
.addHeader("Content-Type", "application/json")
378+
.build();
379+
try {
380+
OkHttpClient client = clientOptions.httpClient();
381+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
382+
client = clientOptions.httpClientWithTimeout(requestOptions);
383+
}
384+
Response response = client.newCall(okhttpRequest).execute();
385+
ResponseBody responseBody = response.body();
386+
if (response.isSuccessful()) {
387+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelBulkSyncResponseEnvelope.class);
388+
}
389+
throw new ApiError(
390+
response.code(),
391+
ObjectMappers.JSON_MAPPER.readValue(
392+
responseBody != null ? responseBody.string() : "{}", Object.class));
393+
} catch (IOException e) {
394+
throw new RuntimeException(e);
395+
}
396+
}
397+
361398
public BulkSyncExecutionEnvelope start(String id) {
362399
return start(id, StartBulkSyncRequest.builder().build());
363400
}

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.polytomic.api.resources.bulksync.executions.requests.ExecutionsListRequest;
1212
import com.polytomic.api.resources.bulksync.executions.requests.ExecutionsListStatusRequest;
1313
import com.polytomic.api.types.BulkSyncExecutionEnvelope;
14+
import com.polytomic.api.types.CancelBulkSyncResponseEnvelope;
1415
import com.polytomic.api.types.ListBulkSyncExecutionStatusEnvelope;
1516
import com.polytomic.api.types.ListBulkSyncExecutionsEnvelope;
1617
import com.polytomic.api.types.V4BulkSyncExecutionLogsEnvelope;
@@ -169,6 +170,44 @@ public BulkSyncExecutionEnvelope get(String id, String execId, RequestOptions re
169170
}
170171
}
171172

173+
public CancelBulkSyncResponseEnvelope cancel(String id, String execId) {
174+
return cancel(id, execId, null);
175+
}
176+
177+
public CancelBulkSyncResponseEnvelope cancel(String id, String execId, RequestOptions requestOptions) {
178+
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
179+
.newBuilder()
180+
.addPathSegments("api/bulk/syncs")
181+
.addPathSegment(id)
182+
.addPathSegments("executions")
183+
.addPathSegment(execId)
184+
.addPathSegments("cancel")
185+
.build();
186+
Request okhttpRequest = new Request.Builder()
187+
.url(httpUrl)
188+
.method("POST", RequestBody.create("", null))
189+
.headers(Headers.of(clientOptions.headers(requestOptions)))
190+
.addHeader("Content-Type", "application/json")
191+
.build();
192+
try {
193+
OkHttpClient client = clientOptions.httpClient();
194+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
195+
client = clientOptions.httpClientWithTimeout(requestOptions);
196+
}
197+
Response response = client.newCall(okhttpRequest).execute();
198+
ResponseBody responseBody = response.body();
199+
if (response.isSuccessful()) {
200+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelBulkSyncResponseEnvelope.class);
201+
}
202+
throw new ApiError(
203+
response.code(),
204+
ObjectMappers.JSON_MAPPER.readValue(
205+
responseBody != null ? responseBody.string() : "{}", Object.class));
206+
} catch (IOException e) {
207+
throw new RuntimeException(e);
208+
}
209+
}
210+
172211
public V4BulkSyncExecutionLogsEnvelope getLogs(String syncId, String executionId) {
173212
return getLogs(syncId, executionId, null);
174213
}

src/main/java/com/polytomic/api/resources/bulksync/schemas/SchemasClient.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.polytomic.api.resources.bulksync.schemas.requests.SchemasListRequest;
1313
import com.polytomic.api.resources.bulksync.schemas.requests.UpdateBulkSchema;
1414
import com.polytomic.api.types.BulkSchemaEnvelope;
15+
import com.polytomic.api.types.CancelBulkSyncResponseEnvelope;
1516
import com.polytomic.api.types.ListBulkSchema;
1617
import java.io.IOException;
1718
import okhttp3.Headers;
@@ -203,4 +204,42 @@ public BulkSchemaEnvelope update(
203204
throw new RuntimeException(e);
204205
}
205206
}
207+
208+
public CancelBulkSyncResponseEnvelope cancel(String id, String schemaId) {
209+
return cancel(id, schemaId, null);
210+
}
211+
212+
public CancelBulkSyncResponseEnvelope cancel(String id, String schemaId, RequestOptions requestOptions) {
213+
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
214+
.newBuilder()
215+
.addPathSegments("api/bulk/syncs")
216+
.addPathSegment(id)
217+
.addPathSegments("schemas")
218+
.addPathSegment(schemaId)
219+
.addPathSegments("cancel")
220+
.build();
221+
Request okhttpRequest = new Request.Builder()
222+
.url(httpUrl)
223+
.method("POST", RequestBody.create("", null))
224+
.headers(Headers.of(clientOptions.headers(requestOptions)))
225+
.addHeader("Content-Type", "application/json")
226+
.build();
227+
try {
228+
OkHttpClient client = clientOptions.httpClient();
229+
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
230+
client = clientOptions.httpClientWithTimeout(requestOptions);
231+
}
232+
Response response = client.newCall(okhttpRequest).execute();
233+
ResponseBody responseBody = response.body();
234+
if (response.isSuccessful()) {
235+
return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelBulkSyncResponseEnvelope.class);
236+
}
237+
throw new ApiError(
238+
response.code(),
239+
ObjectMappers.JSON_MAPPER.readValue(
240+
responseBody != null ? responseBody.string() : "{}", Object.class));
241+
} catch (IOException e) {
242+
throw new RuntimeException(e);
243+
}
244+
}
206245
}

src/main/java/com/polytomic/api/resources/users/UsersClient.java

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,10 @@ public UsersClient(ClientOptions clientOptions) {
3030
this.clientOptions = clientOptions;
3131
}
3232

33-
/**
34-
* <blockquote>
35-
* 🚧 Requires partner key
36-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
37-
* </blockquote>
38-
*/
3933
public ListUsersEnvelope list(String orgId) {
4034
return list(orgId, null);
4135
}
4236

43-
/**
44-
* <blockquote>
45-
* 🚧 Requires partner key
46-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
47-
* </blockquote>
48-
*/
4937
public ListUsersEnvelope list(String orgId, RequestOptions requestOptions) {
5038
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
5139
.newBuilder()
@@ -78,22 +66,10 @@ public ListUsersEnvelope list(String orgId, RequestOptions requestOptions) {
7866
}
7967
}
8068

81-
/**
82-
* <blockquote>
83-
* 🚧 Requires partner key
84-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
85-
* </blockquote>
86-
*/
8769
public UserEnvelope create(String orgId, CreateUserRequestSchema request) {
8870
return create(orgId, request, null);
8971
}
9072

91-
/**
92-
* <blockquote>
93-
* 🚧 Requires partner key
94-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
95-
* </blockquote>
96-
*/
9773
public UserEnvelope create(String orgId, CreateUserRequestSchema request, RequestOptions requestOptions) {
9874
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
9975
.newBuilder()
@@ -133,22 +109,10 @@ public UserEnvelope create(String orgId, CreateUserRequestSchema request, Reques
133109
}
134110
}
135111

136-
/**
137-
* <blockquote>
138-
* 🚧 Requires partner key
139-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
140-
* </blockquote>
141-
*/
142112
public UserEnvelope get(String id, String orgId) {
143113
return get(id, orgId, null);
144114
}
145115

146-
/**
147-
* <blockquote>
148-
* 🚧 Requires partner key
149-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
150-
* </blockquote>
151-
*/
152116
public UserEnvelope get(String id, String orgId, RequestOptions requestOptions) {
153117
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
154118
.newBuilder()
@@ -182,22 +146,10 @@ public UserEnvelope get(String id, String orgId, RequestOptions requestOptions)
182146
}
183147
}
184148

185-
/**
186-
* <blockquote>
187-
* 🚧 Requires partner key
188-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
189-
* </blockquote>
190-
*/
191149
public UserEnvelope update(String id, String orgId, UpdateUserRequestSchema request) {
192150
return update(id, orgId, request, null);
193151
}
194152

195-
/**
196-
* <blockquote>
197-
* 🚧 Requires partner key
198-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
199-
* </blockquote>
200-
*/
201153
public UserEnvelope update(
202154
String id, String orgId, UpdateUserRequestSchema request, RequestOptions requestOptions) {
203155
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -239,22 +191,10 @@ public UserEnvelope update(
239191
}
240192
}
241193

242-
/**
243-
* <blockquote>
244-
* 🚧 Requires partner key
245-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
246-
* </blockquote>
247-
*/
248194
public UserEnvelope remove(String id, String orgId) {
249195
return remove(id, orgId, null);
250196
}
251197

252-
/**
253-
* <blockquote>
254-
* 🚧 Requires partner key
255-
* <p>User endpoints are only accessible using <a href="https://apidocs.polytomic.com/guides/obtaining-api-keys#partner-keys">partner keys</a>.</p>
256-
* </blockquote>
257-
*/
258198
public UserEnvelope remove(String id, String orgId, RequestOptions requestOptions) {
259199
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
260200
.newBuilder()

0 commit comments

Comments
 (0)