diff --git a/.fern/metadata.json b/.fern/metadata.json
index 2288265..507474f 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -10,9 +10,9 @@
"base-exception-class-name": "CloudPDFException",
"base-api-exception-class-name": "CloudPDFApiException"
},
- "originGitCommit": "0606e988ebff3773183ef02e0a820c36b3a25f8d",
+ "originGitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
- "requestedVersion": "3.0.0-alpha.19",
+ "requestedVersion": "3.0.0-alpha.20",
"ciProvider": "github"
}
\ No newline at end of file
diff --git a/README.md b/README.md
index a0e05ec..c706556 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ The official Java SDK for the CloudPDF API.
- [Reference](#reference)
- [Usage](#usage)
+- [Environments](#environments)
- [Base Url](#base-url)
- [Exception Handling](#exception-handling)
- [Advanced](#advanced)
@@ -60,6 +61,20 @@ public class Example {
}
```
+## Environments
+
+This SDK allows you to configure different environments for API requests.
+
+```java
+import com.cloudpdf.CloudPDFClient;
+import com.cloudpdf.core.Environment;
+
+CloudPDFClient client = CloudPDFClient
+ .builder()
+ .environment(Environment.Saas)
+ .build();
+```
+
## Base Url
You can set a custom base URL when constructing the client.
diff --git a/build.gradle b/build.gradle
index 6666975..8598321 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,7 +46,7 @@ java {
group = 'com.cloudpdf'
-version = '3.0.0-alpha.19'
+version = '3.0.0-alpha.20'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -73,7 +73,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cloudpdf'
artifactId = 'sdk'
- version = '3.0.0-alpha.19'
+ version = '3.0.0-alpha.20'
from components.java
pom {
name = 'CloudPDF'
diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json
index 6159811..7f489b4 100644
--- a/cloudpdf-generation.json
+++ b/cloudpdf-generation.json
@@ -1,12 +1,12 @@
{
"language": "java",
- "canonicalVersion": "3.0.0-next.19",
- "sdkVersion": "3.0.0-alpha.19",
+ "canonicalVersion": "3.0.0-next.20",
+ "sdkVersion": "3.0.0-alpha.20",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
- "openapiSha256": "e88e02ed71f422ad08b2393abeda474e8dcf6707b6e753af74ba2f40da8e7d6b",
- "gitCommit": "0606e988ebff3773183ef02e0a820c36b3a25f8d",
+ "openapiSha256": "47d739acb956ce8ba0c3990117e505be2e9406038d9e0cd1729608921a40b2d9",
+ "gitCommit": "622018abaf6e4578d1f4d8377982c48b92c9ced3",
"gitCommitIsDirty": false
},
"fern": {
diff --git a/reference.md b/reference.md
index bd72c09..6c110d1 100644
--- a/reference.md
+++ b/reference.md
@@ -716,7 +716,7 @@ client.grants().list(
-The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
@@ -1885,6 +1885,20 @@ client.documents().update(
+#### 📝 Description
+
+
+
+
+
+
+
+An upload token commits only the documents it started; any other document answers 404.
+
-This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
+
+With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+
+
+
+
+
#### 🔌 Usage
@@ -2837,7 +2865,7 @@ client.folders().moveInto(
-kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+
+**documentPassword:** `Optional` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+
+
+
+**documentPassword:** `Optional` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+
+
+
+A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (`canDownload: false`) is not found.
+
+
+**documentPassword:** `Optional` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+
+
+
+**documentPassword:** `Optional` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+
+
+
+
+
+
+
diff --git a/src/main/java/api/AsyncCloudPDFClientBuilder.java b/src/main/java/api/AsyncCloudPDFClientBuilder.java
index b6a32ad..31cdd61 100644
--- a/src/main/java/api/AsyncCloudPDFClientBuilder.java
+++ b/src/main/java/api/AsyncCloudPDFClientBuilder.java
@@ -26,7 +26,7 @@ public class AsyncCloudPDFClientBuilder {
private String token = null;
- private Environment environment;
+ private Environment environment = Environment.SAAS;
private OkHttpClient httpClient;
@@ -40,6 +40,11 @@ public AsyncCloudPDFClientBuilder token(String token) {
return this;
}
+ public AsyncCloudPDFClientBuilder environment(Environment environment) {
+ this.environment = environment;
+ return this;
+ }
+
public AsyncCloudPDFClientBuilder url(String url) {
this.environment = Environment.custom(url);
return this;
diff --git a/src/main/java/api/CloudPDFClientBuilder.java b/src/main/java/api/CloudPDFClientBuilder.java
index 809399a..5379e90 100644
--- a/src/main/java/api/CloudPDFClientBuilder.java
+++ b/src/main/java/api/CloudPDFClientBuilder.java
@@ -26,7 +26,7 @@ public class CloudPDFClientBuilder {
private String token = null;
- private Environment environment;
+ private Environment environment = Environment.SAAS;
private OkHttpClient httpClient;
@@ -40,6 +40,11 @@ public CloudPDFClientBuilder token(String token) {
return this;
}
+ public CloudPDFClientBuilder environment(Environment environment) {
+ this.environment = environment;
+ return this;
+ }
+
public CloudPDFClientBuilder url(String url) {
this.environment = Environment.custom(url);
return this;
diff --git a/src/main/java/api/core/ClientOptions.java b/src/main/java/api/core/ClientOptions.java
index 2aad2f3..e68a8f8 100644
--- a/src/main/java/api/core/ClientOptions.java
+++ b/src/main/java/api/core/ClientOptions.java
@@ -49,7 +49,7 @@ private ClientOptions(
{
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.cloudpdf:sdk");
- put("X-Fern-SDK-Version", "3.0.0-alpha.19");
+ put("X-Fern-SDK-Version", "3.0.0-alpha.20");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/api/core/Environment.java b/src/main/java/api/core/Environment.java
index e276bae..d4cba6a 100644
--- a/src/main/java/api/core/Environment.java
+++ b/src/main/java/api/core/Environment.java
@@ -4,6 +4,8 @@
package com.cloudpdf.api.core;
public final class Environment {
+ public static final Environment SAAS = new Environment("https://engine.cloudpdf.com");
+
private final String url;
private Environment(String url) {
diff --git a/src/main/java/api/resources/doc/AsyncDocClient.java b/src/main/java/api/resources/doc/AsyncDocClient.java
index 887a5f0..f3095af 100644
--- a/src/main/java/api/resources/doc/AsyncDocClient.java
+++ b/src/main/java/api/resources/doc/AsyncDocClient.java
@@ -8,6 +8,7 @@
import com.cloudpdf.api.core.Suppliers;
import com.cloudpdf.api.resources.doc.annotations.AsyncAnnotationsClient;
import com.cloudpdf.api.resources.doc.attachments.AsyncAttachmentsClient;
+import com.cloudpdf.api.resources.doc.fonts.AsyncFontsClient;
import com.cloudpdf.api.resources.doc.forms.AsyncFormsClient;
import com.cloudpdf.api.resources.doc.metadata.AsyncMetadataClient;
import com.cloudpdf.api.resources.doc.outline.AsyncOutlineClient;
@@ -40,6 +41,8 @@ public class AsyncDocClient {
protected final Supplier attachmentsClient;
+ protected final Supplier fontsClient;
+
protected final Supplier formsClient;
protected final Supplier metadataClient;
@@ -59,6 +62,7 @@ public AsyncDocClient(ClientOptions clientOptions) {
this.rawClient = new AsyncRawDocClient(clientOptions);
this.annotationsClient = Suppliers.memoize(() -> new AsyncAnnotationsClient(clientOptions));
this.attachmentsClient = Suppliers.memoize(() -> new AsyncAttachmentsClient(clientOptions));
+ this.fontsClient = Suppliers.memoize(() -> new AsyncFontsClient(clientOptions));
this.formsClient = Suppliers.memoize(() -> new AsyncFormsClient(clientOptions));
this.metadataClient = Suppliers.memoize(() -> new AsyncMetadataClient(clientOptions));
this.outlineClient = Suppliers.memoize(() -> new AsyncOutlineClient(clientOptions));
@@ -242,6 +246,10 @@ public AsyncAttachmentsClient attachments() {
return this.attachmentsClient.get();
}
+ public AsyncFontsClient fonts() {
+ return this.fontsClient.get();
+ }
+
public AsyncFormsClient forms() {
return this.formsClient.get();
}
diff --git a/src/main/java/api/resources/doc/DocClient.java b/src/main/java/api/resources/doc/DocClient.java
index 6c79d35..943a0d7 100644
--- a/src/main/java/api/resources/doc/DocClient.java
+++ b/src/main/java/api/resources/doc/DocClient.java
@@ -8,6 +8,7 @@
import com.cloudpdf.api.core.Suppliers;
import com.cloudpdf.api.resources.doc.annotations.AnnotationsClient;
import com.cloudpdf.api.resources.doc.attachments.AttachmentsClient;
+import com.cloudpdf.api.resources.doc.fonts.FontsClient;
import com.cloudpdf.api.resources.doc.forms.FormsClient;
import com.cloudpdf.api.resources.doc.metadata.MetadataClient;
import com.cloudpdf.api.resources.doc.outline.OutlineClient;
@@ -39,6 +40,8 @@ public class DocClient {
protected final Supplier attachmentsClient;
+ protected final Supplier fontsClient;
+
protected final Supplier formsClient;
protected final Supplier metadataClient;
@@ -58,6 +61,7 @@ public DocClient(ClientOptions clientOptions) {
this.rawClient = new RawDocClient(clientOptions);
this.annotationsClient = Suppliers.memoize(() -> new AnnotationsClient(clientOptions));
this.attachmentsClient = Suppliers.memoize(() -> new AttachmentsClient(clientOptions));
+ this.fontsClient = Suppliers.memoize(() -> new FontsClient(clientOptions));
this.formsClient = Suppliers.memoize(() -> new FormsClient(clientOptions));
this.metadataClient = Suppliers.memoize(() -> new MetadataClient(clientOptions));
this.outlineClient = Suppliers.memoize(() -> new OutlineClient(clientOptions));
@@ -232,6 +236,10 @@ public AttachmentsClient attachments() {
return this.attachmentsClient.get();
}
+ public FontsClient fonts() {
+ return this.fontsClient.get();
+ }
+
public FormsClient forms() {
return this.formsClient.get();
}
diff --git a/src/main/java/api/resources/doc/fonts/AsyncFontsClient.java b/src/main/java/api/resources/doc/fonts/AsyncFontsClient.java
new file mode 100644
index 0000000..55105e7
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/AsyncFontsClient.java
@@ -0,0 +1,76 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.doc.fonts.programs.AsyncProgramsClient;
+import com.cloudpdf.api.resources.doc.fonts.requests.ListFontsRequest;
+import com.cloudpdf.api.resources.doc.fonts.requests.ResolveFontsRequest;
+import com.cloudpdf.api.types.FontList;
+import com.cloudpdf.api.types.FontResolution;
+import com.cloudpdf.api.types.FontResolveRequest;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
+
+public class AsyncFontsClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawFontsClient rawClient;
+
+ protected final Supplier programsClient;
+
+ public AsyncFontsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawFontsClient(clientOptions);
+ this.programsClient = Suppliers.memoize(() -> new AsyncProgramsClient(clientOptions));
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawFontsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public CompletableFuture list(String docId, String layerName) {
+ return this.rawClient.list(docId, layerName).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(String docId, String layerName, RequestOptions requestOptions) {
+ return this.rawClient.list(docId, layerName, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(String docId, String layerName, ListFontsRequest request) {
+ return this.rawClient.list(docId, layerName, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(
+ String docId, String layerName, ListFontsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.list(docId, layerName, request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture resolve(String docId, String layerName, FontResolveRequest body) {
+ return this.rawClient.resolve(docId, layerName, body).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture resolve(
+ String docId, String layerName, FontResolveRequest body, RequestOptions requestOptions) {
+ return this.rawClient.resolve(docId, layerName, body, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture resolve(String docId, String layerName, ResolveFontsRequest request) {
+ return this.rawClient.resolve(docId, layerName, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture resolve(
+ String docId, String layerName, ResolveFontsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.resolve(docId, layerName, request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public AsyncProgramsClient programs() {
+ return this.programsClient.get();
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/AsyncRawFontsClient.java b/src/main/java/api/resources/doc/fonts/AsyncRawFontsClient.java
new file mode 100644
index 0000000..bf8ce60
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/AsyncRawFontsClient.java
@@ -0,0 +1,243 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.CloudPDFApiException;
+import com.cloudpdf.api.core.CloudPDFClientHttpResponse;
+import com.cloudpdf.api.core.CloudPDFException;
+import com.cloudpdf.api.core.MediaTypes;
+import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.doc.fonts.requests.ListFontsRequest;
+import com.cloudpdf.api.resources.doc.fonts.requests.ResolveFontsRequest;
+import com.cloudpdf.api.types.FontList;
+import com.cloudpdf.api.types.FontResolution;
+import com.cloudpdf.api.types.FontResolveRequest;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import org.jetbrains.annotations.NotNull;
+
+public class AsyncRawFontsClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawFontsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public CompletableFuture> list(String docId, String layerName) {
+ return list(docId, layerName, ListFontsRequest.builder().build());
+ }
+
+ public CompletableFuture> list(
+ String docId, String layerName, RequestOptions requestOptions) {
+ return list(docId, layerName, ListFontsRequest.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> list(
+ String docId, String layerName, ListFontsRequest request) {
+ return list(docId, layerName, request, null);
+ }
+
+ public CompletableFuture> list(
+ String docId, String layerName, ListFontsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("fonts");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontList.class), response));
+ return;
+ }
+ try {
+ if (response.code() == 404) {
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> resolve(
+ String docId, String layerName, FontResolveRequest body) {
+ return resolve(
+ docId, layerName, ResolveFontsRequest.builder().body(body).build());
+ }
+
+ public CompletableFuture> resolve(
+ String docId, String layerName, FontResolveRequest body, RequestOptions requestOptions) {
+ return resolve(
+ docId, layerName, ResolveFontsRequest.builder().body(body).build(), requestOptions);
+ }
+
+ public CompletableFuture> resolve(
+ String docId, String layerName, ResolveFontsRequest request) {
+ return resolve(docId, layerName, request, null);
+ }
+
+ public CompletableFuture> resolve(
+ String docId, String layerName, ResolveFontsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("fonts")
+ .addPathSegments("resolve");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontResolution.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/FontsClient.java b/src/main/java/api/resources/doc/fonts/FontsClient.java
new file mode 100644
index 0000000..7529b09
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/FontsClient.java
@@ -0,0 +1,74 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.doc.fonts.programs.ProgramsClient;
+import com.cloudpdf.api.resources.doc.fonts.requests.ListFontsRequest;
+import com.cloudpdf.api.resources.doc.fonts.requests.ResolveFontsRequest;
+import com.cloudpdf.api.types.FontList;
+import com.cloudpdf.api.types.FontResolution;
+import com.cloudpdf.api.types.FontResolveRequest;
+import java.util.function.Supplier;
+
+public class FontsClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawFontsClient rawClient;
+
+ protected final Supplier programsClient;
+
+ public FontsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawFontsClient(clientOptions);
+ this.programsClient = Suppliers.memoize(() -> new ProgramsClient(clientOptions));
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawFontsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public FontList list(String docId, String layerName) {
+ return this.rawClient.list(docId, layerName).body();
+ }
+
+ public FontList list(String docId, String layerName, RequestOptions requestOptions) {
+ return this.rawClient.list(docId, layerName, requestOptions).body();
+ }
+
+ public FontList list(String docId, String layerName, ListFontsRequest request) {
+ return this.rawClient.list(docId, layerName, request).body();
+ }
+
+ public FontList list(String docId, String layerName, ListFontsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.list(docId, layerName, request, requestOptions).body();
+ }
+
+ public FontResolution resolve(String docId, String layerName, FontResolveRequest body) {
+ return this.rawClient.resolve(docId, layerName, body).body();
+ }
+
+ public FontResolution resolve(
+ String docId, String layerName, FontResolveRequest body, RequestOptions requestOptions) {
+ return this.rawClient.resolve(docId, layerName, body, requestOptions).body();
+ }
+
+ public FontResolution resolve(String docId, String layerName, ResolveFontsRequest request) {
+ return this.rawClient.resolve(docId, layerName, request).body();
+ }
+
+ public FontResolution resolve(
+ String docId, String layerName, ResolveFontsRequest request, RequestOptions requestOptions) {
+ return this.rawClient.resolve(docId, layerName, request, requestOptions).body();
+ }
+
+ public ProgramsClient programs() {
+ return this.programsClient.get();
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/RawFontsClient.java b/src/main/java/api/resources/doc/fonts/RawFontsClient.java
new file mode 100644
index 0000000..8bbb04e
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/RawFontsClient.java
@@ -0,0 +1,202 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.CloudPDFApiException;
+import com.cloudpdf.api.core.CloudPDFClientHttpResponse;
+import com.cloudpdf.api.core.CloudPDFException;
+import com.cloudpdf.api.core.MediaTypes;
+import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.doc.fonts.requests.ListFontsRequest;
+import com.cloudpdf.api.resources.doc.fonts.requests.ResolveFontsRequest;
+import com.cloudpdf.api.types.FontList;
+import com.cloudpdf.api.types.FontResolution;
+import com.cloudpdf.api.types.FontResolveRequest;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+
+public class RawFontsClient {
+ protected final ClientOptions clientOptions;
+
+ public RawFontsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public CloudPDFClientHttpResponse list(String docId, String layerName) {
+ return list(docId, layerName, ListFontsRequest.builder().build());
+ }
+
+ public CloudPDFClientHttpResponse list(String docId, String layerName, RequestOptions requestOptions) {
+ return list(docId, layerName, ListFontsRequest.builder().build(), requestOptions);
+ }
+
+ public CloudPDFClientHttpResponse list(String docId, String layerName, ListFontsRequest request) {
+ return list(docId, layerName, request, null);
+ }
+
+ public CloudPDFClientHttpResponse list(
+ String docId, String layerName, ListFontsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("fonts");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontList.class), response);
+ }
+ try {
+ if (response.code() == 404) {
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CloudPDFException("Network error executing HTTP request", e);
+ }
+ }
+
+ public CloudPDFClientHttpResponse resolve(String docId, String layerName, FontResolveRequest body) {
+ return resolve(
+ docId, layerName, ResolveFontsRequest.builder().body(body).build());
+ }
+
+ public CloudPDFClientHttpResponse resolve(
+ String docId, String layerName, FontResolveRequest body, RequestOptions requestOptions) {
+ return resolve(
+ docId, layerName, ResolveFontsRequest.builder().body(body).build(), requestOptions);
+ }
+
+ public CloudPDFClientHttpResponse resolve(
+ String docId, String layerName, ResolveFontsRequest request) {
+ return resolve(docId, layerName, request, null);
+ }
+
+ public CloudPDFClientHttpResponse resolve(
+ String docId, String layerName, ResolveFontsRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("fonts")
+ .addPathSegments("resolve");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", body)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Content-Type", "application/json")
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontResolution.class), response);
+ }
+ try {
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CloudPDFException("Network error executing HTTP request", e);
+ }
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/AsyncProgramsClient.java b/src/main/java/api/resources/doc/fonts/programs/AsyncProgramsClient.java
new file mode 100644
index 0000000..2c372ec
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/AsyncProgramsClient.java
@@ -0,0 +1,94 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.DownloadProgramsRequest;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.GetProgramsRequest;
+import com.cloudpdf.api.types.FontProgramInfo;
+import java.io.InputStream;
+import java.util.concurrent.CompletableFuture;
+
+public class AsyncProgramsClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawProgramsClient rawClient;
+
+ public AsyncProgramsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawProgramsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawProgramsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture download(String docId, String layerName, String displayHash) {
+ return this.rawClient.download(docId, layerName, displayHash).thenApply(response -> response.body());
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture download(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return this.rawClient
+ .download(docId, layerName, displayHash, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture download(
+ String docId, String layerName, String displayHash, DownloadProgramsRequest request) {
+ return this.rawClient.download(docId, layerName, displayHash, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture download(
+ String docId,
+ String layerName,
+ String displayHash,
+ DownloadProgramsRequest request,
+ RequestOptions requestOptions) {
+ return this.rawClient
+ .download(docId, layerName, displayHash, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public CompletableFuture get(String docId, String layerName, String displayHash) {
+ return this.rawClient.get(docId, layerName, displayHash).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture get(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return this.rawClient.get(docId, layerName, displayHash, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture get(
+ String docId, String layerName, String displayHash, GetProgramsRequest request) {
+ return this.rawClient.get(docId, layerName, displayHash, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture get(
+ String docId,
+ String layerName,
+ String displayHash,
+ GetProgramsRequest request,
+ RequestOptions requestOptions) {
+ return this.rawClient
+ .get(docId, layerName, displayHash, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/AsyncRawProgramsClient.java b/src/main/java/api/resources/doc/fonts/programs/AsyncRawProgramsClient.java
new file mode 100644
index 0000000..f15521a
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/AsyncRawProgramsClient.java
@@ -0,0 +1,256 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.CloudPDFApiException;
+import com.cloudpdf.api.core.CloudPDFClientHttpResponse;
+import com.cloudpdf.api.core.CloudPDFException;
+import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.ResponseBodyInputStream;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.ForbiddenError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.DownloadProgramsRequest;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.GetProgramsRequest;
+import com.cloudpdf.api.types.FontProgramInfo;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.concurrent.CompletableFuture;
+import okhttp3.Call;
+import okhttp3.Callback;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import org.jetbrains.annotations.NotNull;
+
+public class AsyncRawProgramsClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawProgramsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture> download(
+ String docId, String layerName, String displayHash) {
+ return download(
+ docId, layerName, displayHash, DownloadProgramsRequest.builder().build());
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture> download(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return download(
+ docId, layerName, displayHash, DownloadProgramsRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture> download(
+ String docId, String layerName, String displayHash, DownloadProgramsRequest request) {
+ return download(docId, layerName, displayHash, request, null);
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CompletableFuture> download(
+ String docId,
+ String layerName,
+ String displayHash,
+ DownloadProgramsRequest request,
+ RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("font-program-files")
+ .addPathSegment(displayHash);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try {
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ future.complete(
+ new CloudPDFClientHttpResponse<>(new ResponseBodyInputStream(response), response));
+ return;
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+
+ public CompletableFuture> get(
+ String docId, String layerName, String displayHash) {
+ return get(docId, layerName, displayHash, GetProgramsRequest.builder().build());
+ }
+
+ public CompletableFuture> get(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return get(docId, layerName, displayHash, GetProgramsRequest.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> get(
+ String docId, String layerName, String displayHash, GetProgramsRequest request) {
+ return get(docId, layerName, displayHash, request, null);
+ }
+
+ public CompletableFuture> get(
+ String docId,
+ String layerName,
+ String displayHash,
+ GetProgramsRequest request,
+ RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("font-programs")
+ .addPathSegment(displayHash);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ CompletableFuture> future = new CompletableFuture<>();
+ client.newCall(okhttpRequest).enqueue(new Callback() {
+ @Override
+ public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
+ try (ResponseBody responseBody = response.body()) {
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ future.complete(new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontProgramInfo.class),
+ response));
+ return;
+ }
+ try {
+ if (response.code() == 404) {
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
+ return;
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ future.completeExceptionally(new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response));
+ return;
+ } catch (JsonProcessingException e) {
+ future.completeExceptionally(
+ new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e));
+ } catch (IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ }
+
+ @Override
+ public void onFailure(@NotNull Call call, @NotNull IOException e) {
+ future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e));
+ }
+ });
+ return future;
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/ProgramsClient.java b/src/main/java/api/resources/doc/fonts/programs/ProgramsClient.java
new file mode 100644
index 0000000..40ad6ea
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/ProgramsClient.java
@@ -0,0 +1,89 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.DownloadProgramsRequest;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.GetProgramsRequest;
+import com.cloudpdf.api.types.FontProgramInfo;
+import java.io.InputStream;
+
+public class ProgramsClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawProgramsClient rawClient;
+
+ public ProgramsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawProgramsClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawProgramsClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public InputStream download(String docId, String layerName, String displayHash) {
+ return this.rawClient.download(docId, layerName, displayHash).body();
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public InputStream download(String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return this.rawClient
+ .download(docId, layerName, displayHash, requestOptions)
+ .body();
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public InputStream download(String docId, String layerName, String displayHash, DownloadProgramsRequest request) {
+ return this.rawClient.download(docId, layerName, displayHash, request).body();
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public InputStream download(
+ String docId,
+ String layerName,
+ String displayHash,
+ DownloadProgramsRequest request,
+ RequestOptions requestOptions) {
+ return this.rawClient
+ .download(docId, layerName, displayHash, request, requestOptions)
+ .body();
+ }
+
+ public FontProgramInfo get(String docId, String layerName, String displayHash) {
+ return this.rawClient.get(docId, layerName, displayHash).body();
+ }
+
+ public FontProgramInfo get(String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return this.rawClient.get(docId, layerName, displayHash, requestOptions).body();
+ }
+
+ public FontProgramInfo get(String docId, String layerName, String displayHash, GetProgramsRequest request) {
+ return this.rawClient.get(docId, layerName, displayHash, request).body();
+ }
+
+ public FontProgramInfo get(
+ String docId,
+ String layerName,
+ String displayHash,
+ GetProgramsRequest request,
+ RequestOptions requestOptions) {
+ return this.rawClient
+ .get(docId, layerName, displayHash, request, requestOptions)
+ .body();
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/RawProgramsClient.java b/src/main/java/api/resources/doc/fonts/programs/RawProgramsClient.java
new file mode 100644
index 0000000..ade942d
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/RawProgramsClient.java
@@ -0,0 +1,215 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.CloudPDFApiException;
+import com.cloudpdf.api.core.CloudPDFClientHttpResponse;
+import com.cloudpdf.api.core.CloudPDFException;
+import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.ResponseBodyInputStream;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.ForbiddenError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.DownloadProgramsRequest;
+import com.cloudpdf.api.resources.doc.fonts.programs.requests.GetProgramsRequest;
+import com.cloudpdf.api.types.FontProgramInfo;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import java.io.InputStream;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+
+public class RawProgramsClient {
+ protected final ClientOptions clientOptions;
+
+ public RawProgramsClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CloudPDFClientHttpResponse download(String docId, String layerName, String displayHash) {
+ return download(
+ docId, layerName, displayHash, DownloadProgramsRequest.builder().build());
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CloudPDFClientHttpResponse download(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return download(
+ docId, layerName, displayHash, DownloadProgramsRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CloudPDFClientHttpResponse download(
+ String docId, String layerName, String displayHash, DownloadProgramsRequest request) {
+ return download(docId, layerName, displayHash, request, null);
+ }
+
+ /**
+ * A document token needs any one of the listed capabilities: one that may write text in the document. A file the list says can't be downloaded (canDownload: false) is not found.
+ */
+ public CloudPDFClientHttpResponse download(
+ String docId,
+ String layerName,
+ String displayHash,
+ DownloadProgramsRequest request,
+ RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("font-program-files")
+ .addPathSegment(displayHash);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try {
+ Response response = client.newCall(okhttpRequest).execute();
+ ResponseBody responseBody = response.body();
+ if (response.isSuccessful()) {
+ return new CloudPDFClientHttpResponse<>(new ResponseBodyInputStream(response), response);
+ }
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ try {
+ switch (response.code()) {
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CloudPDFException("Network error executing HTTP request", e);
+ }
+ }
+
+ public CloudPDFClientHttpResponse get(String docId, String layerName, String displayHash) {
+ return get(docId, layerName, displayHash, GetProgramsRequest.builder().build());
+ }
+
+ public CloudPDFClientHttpResponse get(
+ String docId, String layerName, String displayHash, RequestOptions requestOptions) {
+ return get(docId, layerName, displayHash, GetProgramsRequest.builder().build(), requestOptions);
+ }
+
+ public CloudPDFClientHttpResponse get(
+ String docId, String layerName, String displayHash, GetProgramsRequest request) {
+ return get(docId, layerName, displayHash, request, null);
+ }
+
+ public CloudPDFClientHttpResponse get(
+ String docId,
+ String layerName,
+ String displayHash,
+ GetProgramsRequest request,
+ RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("font-programs")
+ .addPathSegment(displayHash);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("GET", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ if (request.getDocumentPassword().isPresent()) {
+ _requestBuilder.addHeader(
+ "X-Document-Password", request.getDocumentPassword().get());
+ }
+ Request okhttpRequest = _requestBuilder.build();
+ OkHttpClient client = clientOptions.httpClient();
+ if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
+ client = clientOptions.httpClientWithTimeout(requestOptions);
+ }
+ if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) {
+ okhttpRequest = okhttpRequest
+ .newBuilder()
+ .tag(
+ RetryInterceptor.MaxRetriesOverride.class,
+ new RetryInterceptor.MaxRetriesOverride(
+ requestOptions.getMaxRetries().get()))
+ .build();
+ }
+ try (Response response = client.newCall(okhttpRequest).execute()) {
+ ResponseBody responseBody = response.body();
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
+ if (response.isSuccessful()) {
+ return new CloudPDFClientHttpResponse<>(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FontProgramInfo.class), response);
+ }
+ try {
+ if (response.code() == 404) {
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ }
+ } catch (JsonProcessingException ignored) {
+ // unable to map error response, throwing generic error
+ }
+ Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ throw new CloudPDFApiException(
+ "Error with status code " + response.code(), response.code(), errorBody, response);
+ } catch (JsonProcessingException e) {
+ throw new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e);
+ } catch (IOException e) {
+ throw new CloudPDFException("Network error executing HTTP request", e);
+ }
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/requests/DownloadProgramsRequest.java b/src/main/java/api/resources/doc/fonts/programs/requests/DownloadProgramsRequest.java
new file mode 100644
index 0000000..f74aa11
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/requests/DownloadProgramsRequest.java
@@ -0,0 +1,108 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = DownloadProgramsRequest.Builder.class)
+public final class DownloadProgramsRequest {
+ private final Optional documentPassword;
+
+ private final Map additionalProperties;
+
+ private DownloadProgramsRequest(Optional documentPassword, Map additionalProperties) {
+ this.documentPassword = documentPassword;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ @JsonIgnore
+ public Optional getDocumentPassword() {
+ return documentPassword;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof DownloadProgramsRequest && equalTo((DownloadProgramsRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(DownloadProgramsRequest other) {
+ return documentPassword.equals(other.documentPassword);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.documentPassword);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional documentPassword = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(DownloadProgramsRequest other) {
+ documentPassword(other.getDocumentPassword());
+ return this;
+ }
+
+ /**
+ *
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ public Builder documentPassword(Optional documentPassword) {
+ this.documentPassword = documentPassword;
+ return this;
+ }
+
+ public Builder documentPassword(String documentPassword) {
+ this.documentPassword = Optional.ofNullable(documentPassword);
+ return this;
+ }
+
+ public DownloadProgramsRequest build() {
+ return new DownloadProgramsRequest(documentPassword, additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/programs/requests/GetProgramsRequest.java b/src/main/java/api/resources/doc/fonts/programs/requests/GetProgramsRequest.java
new file mode 100644
index 0000000..fbf8971
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/programs/requests/GetProgramsRequest.java
@@ -0,0 +1,108 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.programs.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = GetProgramsRequest.Builder.class)
+public final class GetProgramsRequest {
+ private final Optional documentPassword;
+
+ private final Map additionalProperties;
+
+ private GetProgramsRequest(Optional documentPassword, Map additionalProperties) {
+ this.documentPassword = documentPassword;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ @JsonIgnore
+ public Optional getDocumentPassword() {
+ return documentPassword;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof GetProgramsRequest && equalTo((GetProgramsRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(GetProgramsRequest other) {
+ return documentPassword.equals(other.documentPassword);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.documentPassword);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional documentPassword = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(GetProgramsRequest other) {
+ documentPassword(other.getDocumentPassword());
+ return this;
+ }
+
+ /**
+ *
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ public Builder documentPassword(Optional documentPassword) {
+ this.documentPassword = documentPassword;
+ return this;
+ }
+
+ public Builder documentPassword(String documentPassword) {
+ this.documentPassword = Optional.ofNullable(documentPassword);
+ return this;
+ }
+
+ public GetProgramsRequest build() {
+ return new GetProgramsRequest(documentPassword, additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/requests/ListFontsRequest.java b/src/main/java/api/resources/doc/fonts/requests/ListFontsRequest.java
new file mode 100644
index 0000000..7342bca
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/requests/ListFontsRequest.java
@@ -0,0 +1,108 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ListFontsRequest.Builder.class)
+public final class ListFontsRequest {
+ private final Optional documentPassword;
+
+ private final Map additionalProperties;
+
+ private ListFontsRequest(Optional documentPassword, Map additionalProperties) {
+ this.documentPassword = documentPassword;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ @JsonIgnore
+ public Optional getDocumentPassword() {
+ return documentPassword;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListFontsRequest && equalTo((ListFontsRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListFontsRequest other) {
+ return documentPassword.equals(other.documentPassword);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.documentPassword);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Builder {
+ private Optional documentPassword = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ListFontsRequest other) {
+ documentPassword(other.getDocumentPassword());
+ return this;
+ }
+
+ /**
+ *
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ public Builder documentPassword(Optional documentPassword) {
+ this.documentPassword = documentPassword;
+ return this;
+ }
+
+ public Builder documentPassword(String documentPassword) {
+ this.documentPassword = Optional.ofNullable(documentPassword);
+ return this;
+ }
+
+ public ListFontsRequest build() {
+ return new ListFontsRequest(documentPassword, additionalProperties);
+ }
+
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/api/resources/doc/fonts/requests/ResolveFontsRequest.java b/src/main/java/api/resources/doc/fonts/requests/ResolveFontsRequest.java
new file mode 100644
index 0000000..6984414
--- /dev/null
+++ b/src/main/java/api/resources/doc/fonts/requests/ResolveFontsRequest.java
@@ -0,0 +1,162 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.fonts.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.types.FontResolveRequest;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.jetbrains.annotations.NotNull;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ResolveFontsRequest.Builder.class)
+public final class ResolveFontsRequest {
+ private final Optional documentPassword;
+
+ private final FontResolveRequest body;
+
+ private final Map additionalProperties;
+
+ private ResolveFontsRequest(
+ Optional documentPassword, FontResolveRequest body, Map additionalProperties) {
+ this.documentPassword = documentPassword;
+ this.body = body;
+ this.additionalProperties = additionalProperties;
+ }
+
+ /**
+ * @return Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ @JsonIgnore
+ public Optional getDocumentPassword() {
+ return documentPassword;
+ }
+
+ @JsonProperty("body")
+ public FontResolveRequest getBody() {
+ return body;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ResolveFontsRequest && equalTo((ResolveFontsRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ResolveFontsRequest other) {
+ return documentPassword.equals(other.documentPassword) && body.equals(other.body);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.documentPassword, this.body);
+ }
+
+ @java.lang.Override
+ public String toString() {
+ return ObjectMappers.stringify(this);
+ }
+
+ public static BodyStage builder() {
+ return new Builder();
+ }
+
+ public interface BodyStage {
+ _FinalStage body(@NotNull FontResolveRequest body);
+
+ Builder from(ResolveFontsRequest other);
+ }
+
+ public interface _FinalStage {
+ ResolveFontsRequest build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
+ /**
+ *
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ * @return Reference to {@code this} so that method calls can be chained together.
+ */
+ @java.lang.Override
+ public _FinalStage documentPassword(String documentPassword) {
+ this.documentPassword = Optional.ofNullable(documentPassword);
+ return this;
+ }
+
+ /**
+ *
Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
+ */
+ @java.lang.Override
+ public _FinalStage documentPassword(Optional documentPassword) {
+ this.documentPassword = documentPassword;
+ return this;
+ }
+
+ @java.lang.Override
+ public ResolveFontsRequest build() {
+ return new ResolveFontsRequest(documentPassword, body, additionalProperties);
+ }
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/api/resources/documents/AsyncDocumentsClient.java b/src/main/java/api/resources/documents/AsyncDocumentsClient.java
index 94fb1c7..f64624f 100644
--- a/src/main/java/api/resources/documents/AsyncDocumentsClient.java
+++ b/src/main/java/api/resources/documents/AsyncDocumentsClient.java
@@ -117,11 +117,17 @@ public CompletableFuture update(
return this.rawClient.update(tenantId, id, request, requestOptions).thenApply(response -> response.body());
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CompletableFuture commit(
String tenantId, String id, DocumentsCommitRequest request) {
return this.rawClient.commit(tenantId, id, request).thenApply(response -> response.body());
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CompletableFuture commit(
String tenantId, String id, DocumentsCommitRequest request, RequestOptions requestOptions) {
return this.rawClient.commit(tenantId, id, request, requestOptions).thenApply(response -> response.body());
@@ -162,7 +168,7 @@ public CompletableFuture thumbnail(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public CompletableFuture uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request) {
@@ -170,7 +176,7 @@ public CompletableFuture uploadProxy(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public CompletableFuture uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request, RequestOptions requestOptions) {
@@ -226,10 +232,16 @@ public CompletableFuture importFrom(
return this.rawClient.importFrom(tenantId, request, requestOptions).thenApply(response -> response.body());
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CompletableFuture init(String tenantId, DocumentsInitRequest request) {
return this.rawClient.init(tenantId, request).thenApply(response -> response.body());
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CompletableFuture init(
String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
return this.rawClient.init(tenantId, request, requestOptions).thenApply(response -> response.body());
diff --git a/src/main/java/api/resources/documents/AsyncRawDocumentsClient.java b/src/main/java/api/resources/documents/AsyncRawDocumentsClient.java
index 6e2db7c..3cf0efa 100644
--- a/src/main/java/api/resources/documents/AsyncRawDocumentsClient.java
+++ b/src/main/java/api/resources/documents/AsyncRawDocumentsClient.java
@@ -467,11 +467,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
return future;
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CompletableFuture> commit(
String tenantId, String id, DocumentsCommitRequest request) {
return commit(tenantId, id, request, null);
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CompletableFuture> commit(
String tenantId, String id, DocumentsCommitRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -746,7 +752,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public CompletableFuture> uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request) {
@@ -754,7 +760,7 @@ public CompletableFuture> uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request, RequestOptions requestOptions) {
@@ -819,6 +825,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
@@ -888,6 +899,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
@@ -957,6 +973,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
@@ -1043,6 +1064,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
@@ -1134,6 +1160,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 409:
future.completeExceptionally(new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
@@ -1270,11 +1301,17 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
return future;
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CompletableFuture> init(
String tenantId, DocumentsInitRequest request) {
return init(tenantId, request, null);
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CompletableFuture> init(
String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -1328,10 +1365,17 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
return;
}
try {
- if (response.code() == 400) {
- future.completeExceptionally(new BadRequestError(
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
- return;
+ switch (response.code()) {
+ case 400:
+ future.completeExceptionally(new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
diff --git a/src/main/java/api/resources/documents/DocumentsClient.java b/src/main/java/api/resources/documents/DocumentsClient.java
index 5f0761b..a3ca061 100644
--- a/src/main/java/api/resources/documents/DocumentsClient.java
+++ b/src/main/java/api/resources/documents/DocumentsClient.java
@@ -113,10 +113,16 @@ public DocumentsUpdate200Response update(
return this.rawClient.update(tenantId, id, request, requestOptions).body();
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public DocumentsCommit200Response commit(String tenantId, String id, DocumentsCommitRequest request) {
return this.rawClient.commit(tenantId, id, request).body();
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public DocumentsCommit200Response commit(
String tenantId, String id, DocumentsCommitRequest request, RequestOptions requestOptions) {
return this.rawClient.commit(tenantId, id, request, requestOptions).body();
@@ -157,7 +163,7 @@ public InputStream thumbnail(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public DocumentsUploadProxy200Response uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request) {
@@ -165,7 +171,7 @@ public DocumentsUploadProxy200Response uploadProxy(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public DocumentsUploadProxy200Response uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request, RequestOptions requestOptions) {
@@ -220,10 +226,16 @@ public DocumentsImportFrom200Response importFrom(
return this.rawClient.importFrom(tenantId, request, requestOptions).body();
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public DocumentsInit200Response init(String tenantId, DocumentsInitRequest request) {
return this.rawClient.init(tenantId, request).body();
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public DocumentsInit200Response init(String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
return this.rawClient.init(tenantId, request, requestOptions).body();
}
diff --git a/src/main/java/api/resources/documents/RawDocumentsClient.java b/src/main/java/api/resources/documents/RawDocumentsClient.java
index 1643daa..3d140ba 100644
--- a/src/main/java/api/resources/documents/RawDocumentsClient.java
+++ b/src/main/java/api/resources/documents/RawDocumentsClient.java
@@ -387,11 +387,17 @@ public CloudPDFClientHttpResponse update(
}
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CloudPDFClientHttpResponse commit(
String tenantId, String id, DocumentsCommitRequest request) {
return commit(tenantId, id, request, null);
}
+ /**
+ * An upload token commits only the documents it started; any other document answers 404.
+ */
public CloudPDFClientHttpResponse commit(
String tenantId, String id, DocumentsCommitRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -611,7 +617,7 @@ public CloudPDFClientHttpResponse thumbnail(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public CloudPDFClientHttpResponse uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request) {
@@ -619,7 +625,7 @@ public CloudPDFClientHttpResponse uploadProxy(
}
/**
- * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available.
+ * This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. An upload token sends files only to the documents it started.
*/
public CloudPDFClientHttpResponse uploadProxy(
String tenantId, String id, File file, UploadProxyDocumentsRequest request, RequestOptions requestOptions) {
@@ -676,6 +682,9 @@ public CloudPDFClientHttpResponse uploadProxy(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 409:
throw new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
@@ -725,6 +734,9 @@ public CloudPDFClientHttpResponse uploadProxy(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 409:
throw new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
@@ -774,6 +786,9 @@ public CloudPDFClientHttpResponse uploadProxy(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 409:
throw new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
@@ -840,6 +855,9 @@ public CloudPDFClientHttpResponse uploadProxy(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 409:
throw new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
@@ -911,6 +929,9 @@ public CloudPDFClientHttpResponse uploadProxy(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 409:
throw new ConflictError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
@@ -1013,10 +1034,16 @@ public CloudPDFClientHttpResponse importFrom(
}
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CloudPDFClientHttpResponse init(String tenantId, DocumentsInitRequest request) {
return init(tenantId, request, null);
}
+ /**
+ * With an upload token, the document goes into the token's folder with the token's metadata, whatever the request says; contentLength must be within the token's maxBytes, and the token makes at most maxFiles documents (403 after). docId, idempotencyKey and dedupMode reuse-existing are refused (400): each could reach a document the token didn't make.
+ */
public CloudPDFClientHttpResponse init(
String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
@@ -1066,9 +1093,13 @@ public CloudPDFClientHttpResponse init(
response);
}
try {
- if (response.code() == 400) {
- throw new BadRequestError(
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ switch (response.code()) {
+ case 400:
+ throw new BadRequestError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
diff --git a/src/main/java/api/resources/grants/AsyncGrantsClient.java b/src/main/java/api/resources/grants/AsyncGrantsClient.java
index 740b60a..b882030 100644
--- a/src/main/java/api/resources/grants/AsyncGrantsClient.java
+++ b/src/main/java/api/resources/grants/AsyncGrantsClient.java
@@ -76,14 +76,14 @@ public CompletableFuture list(
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CompletableFuture create(String tenantId, GrantsCreateRequest request) {
return this.rawClient.create(tenantId, request).thenApply(response -> response.body());
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CompletableFuture create(
String tenantId, GrantsCreateRequest request, RequestOptions requestOptions) {
diff --git a/src/main/java/api/resources/grants/AsyncRawGrantsClient.java b/src/main/java/api/resources/grants/AsyncRawGrantsClient.java
index c1ee753..fc2d2ab 100644
--- a/src/main/java/api/resources/grants/AsyncRawGrantsClient.java
+++ b/src/main/java/api/resources/grants/AsyncRawGrantsClient.java
@@ -270,7 +270,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CompletableFuture> create(
String tenantId, GrantsCreateRequest request) {
@@ -278,7 +278,7 @@ public CompletableFuture> cr
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CompletableFuture> create(
String tenantId, GrantsCreateRequest request, RequestOptions requestOptions) {
@@ -625,6 +625,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 403:
+ future.completeExceptionally(new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
diff --git a/src/main/java/api/resources/grants/GrantsClient.java b/src/main/java/api/resources/grants/GrantsClient.java
index d3788fc..0d752aa 100644
--- a/src/main/java/api/resources/grants/GrantsClient.java
+++ b/src/main/java/api/resources/grants/GrantsClient.java
@@ -73,14 +73,14 @@ public GrantsList200Response list(String tenantId, ListGrantsRequest request, Re
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public GrantsCreate200Response create(String tenantId, GrantsCreateRequest request) {
return this.rawClient.create(tenantId, request).body();
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public GrantsCreate200Response create(String tenantId, GrantsCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(tenantId, request, requestOptions).body();
diff --git a/src/main/java/api/resources/grants/RawGrantsClient.java b/src/main/java/api/resources/grants/RawGrantsClient.java
index 7012cc2..bd4e0e7 100644
--- a/src/main/java/api/resources/grants/RawGrantsClient.java
+++ b/src/main/java/api/resources/grants/RawGrantsClient.java
@@ -222,14 +222,14 @@ public CloudPDFClientHttpResponse list(
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CloudPDFClientHttpResponse create(String tenantId, GrantsCreateRequest request) {
return create(tenantId, request, null);
}
/**
- * The returned id is what a link page or an embed opens. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
+ * The returned id is what a link page or an embed opens. Its scope gives only document permissions the caller holds itself, as tokens.issue does. Mounted only when the deployment can sign (HS256 mode) — exchange mints session JWTs, so grants exist only where minting does.
*/
public CloudPDFClientHttpResponse create(
String tenantId, GrantsCreateRequest request, RequestOptions requestOptions) {
@@ -513,6 +513,9 @@ public CloudPDFClientHttpResponse update(
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 403:
+ throw new ForbiddenError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
diff --git a/src/main/java/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/api/resources/tokens/AsyncRawTokensClient.java
index 4e51972..e26aa1f 100644
--- a/src/main/java/api/resources/tokens/AsyncRawTokensClient.java
+++ b/src/main/java/api/resources/tokens/AsyncRawTokensClient.java
@@ -39,7 +39,7 @@ public AsyncRawTokensClient(ClientOptions clientOptions) {
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CompletableFuture> issue(
String tenantId, IssueTokensRequest request) {
@@ -47,7 +47,7 @@ public CompletableFuture> iss
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CompletableFuture> issue(
String tenantId, IssueTokensRequest request, RequestOptions requestOptions) {
diff --git a/src/main/java/api/resources/tokens/AsyncTokensClient.java b/src/main/java/api/resources/tokens/AsyncTokensClient.java
index 546d141..0a69379 100644
--- a/src/main/java/api/resources/tokens/AsyncTokensClient.java
+++ b/src/main/java/api/resources/tokens/AsyncTokensClient.java
@@ -28,14 +28,14 @@ public AsyncRawTokensClient withRawResponse() {
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CompletableFuture issue(String tenantId, IssueTokensRequest request) {
return this.rawClient.issue(tenantId, request).thenApply(response -> response.body());
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CompletableFuture issue(
String tenantId, IssueTokensRequest request, RequestOptions requestOptions) {
diff --git a/src/main/java/api/resources/tokens/RawTokensClient.java b/src/main/java/api/resources/tokens/RawTokensClient.java
index 8159c14..af19d7e 100644
--- a/src/main/java/api/resources/tokens/RawTokensClient.java
+++ b/src/main/java/api/resources/tokens/RawTokensClient.java
@@ -35,14 +35,14 @@ public RawTokensClient(ClientOptions clientOptions) {
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CloudPDFClientHttpResponse issue(String tenantId, IssueTokensRequest request) {
return issue(tenantId, request, null);
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public CloudPDFClientHttpResponse issue(
String tenantId, IssueTokensRequest request, RequestOptions requestOptions) {
diff --git a/src/main/java/api/resources/tokens/TokensClient.java b/src/main/java/api/resources/tokens/TokensClient.java
index fd6f2c3..b1bdcd3 100644
--- a/src/main/java/api/resources/tokens/TokensClient.java
+++ b/src/main/java/api/resources/tokens/TokensClient.java
@@ -27,14 +27,14 @@ public RawTokensClient withRawResponse() {
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public TokensIssue200Response issue(String tenantId, IssueTokensRequest request) {
return this.rawClient.issue(tenantId, request).body();
}
/**
- * kind "tenant" requires the API token — authority mints only downward. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
+ * Authority mints only downward: kind "doc" gives only document permissions the caller holds itself, kind "tenant" requires the API token, and kind "upload" requires docs.create instead of tokens.issue-doc, since an upload token can do only what docs.create allows. Mounted only when the deployment can sign (HS256 mode); asymmetric deployments mint with their own private key.
*/
public TokensIssue200Response issue(String tenantId, IssueTokensRequest request, RequestOptions requestOptions) {
return this.rawClient.issue(tenantId, request, requestOptions).body();
diff --git a/src/main/java/api/types/AnnotationCaret.java b/src/main/java/api/types/AnnotationCaret.java
index 0fb078a..8bae4d6 100644
--- a/src/main/java/api/types/AnnotationCaret.java
+++ b/src/main/java/api/types/AnnotationCaret.java
@@ -17,6 +17,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.time.OffsetDateTime;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -33,6 +34,8 @@ public final class AnnotationCaret {
private final Optional appearanceState;
+ private final Optional> structurePosition;
+
private final Optional nm;
private final AnnotationCaretRect rect;
@@ -102,6 +105,7 @@ private AnnotationCaret(
PageRef page,
boolean hasAppearance,
Optional appearanceState,
+ Optional> structurePosition,
Optional nm,
AnnotationCaretRect rect,
Optional contents,
@@ -138,6 +142,7 @@ private AnnotationCaret(
this.page = page;
this.hasAppearance = hasAppearance;
this.appearanceState = appearanceState;
+ this.structurePosition = structurePosition;
this.nm = nm;
this.rect = rect;
this.contents = contents;
@@ -195,6 +200,14 @@ public Optional getAppearanceState() {
return appearanceState;
}
+ @JsonIgnore
+ public Optional> getStructurePosition() {
+ if (structurePosition == null) {
+ return Optional.empty();
+ }
+ return structurePosition;
+ }
+
@JsonIgnore
public Optional getNm() {
if (nm == null) {
@@ -404,6 +417,12 @@ private Optional _getAppearanceState() {
return appearanceState;
}
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("structurePosition")
+ private Optional> _getStructurePosition() {
+ return structurePosition;
+ }
+
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
@JsonProperty("nm")
private Optional _getNm() {
@@ -516,6 +535,7 @@ private boolean equalTo(AnnotationCaret other) {
&& page.equals(other.page)
&& hasAppearance == other.hasAppearance
&& appearanceState.equals(other.appearanceState)
+ && structurePosition.equals(other.structurePosition)
&& nm.equals(other.nm)
&& rect.equals(other.rect)
&& contents.equals(other.contents)
@@ -556,6 +576,7 @@ public int hashCode() {
this.page,
this.hasAppearance,
this.appearanceState,
+ this.structurePosition,
this.nm,
this.rect,
this.contents,
@@ -685,6 +706,12 @@ public interface _FinalStage {
_FinalStage appearanceState(Nullable appearanceState);
+ _FinalStage structurePosition(Optional> structurePosition);
+
+ _FinalStage structurePosition(List structurePosition);
+
+ _FinalStage structurePosition(Nullable> structurePosition);
+
_FinalStage nm(Optional nm);
_FinalStage nm(String nm);
@@ -871,6 +898,8 @@ public static final class Builder
private Optional nm = Optional.empty();
+ private Optional> structurePosition = Optional.empty();
+
private Optional appearanceState = Optional.empty();
@JsonAnySetter
@@ -884,6 +913,7 @@ public Builder from(AnnotationCaret other) {
page(other.getPage());
hasAppearance(other.getHasAppearance());
appearanceState(other.getAppearanceState());
+ structurePosition(other.getStructurePosition());
nm(other.getNm());
rect(other.getRect());
contents(other.getContents());
@@ -1444,6 +1474,31 @@ public _FinalStage nm(Optional nm) {
return this;
}
+ @java.lang.Override
+ public _FinalStage structurePosition(Nullable> structurePosition) {
+ if (structurePosition.isNull()) {
+ this.structurePosition = null;
+ } else if (structurePosition.isEmpty()) {
+ this.structurePosition = Optional.empty();
+ } else {
+ this.structurePosition = Optional.of(structurePosition.get());
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage structurePosition(List structurePosition) {
+ this.structurePosition = Optional.ofNullable(structurePosition);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "structurePosition", nulls = Nulls.SKIP)
+ public _FinalStage structurePosition(Optional> structurePosition) {
+ this.structurePosition = structurePosition;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage appearanceState(Nullable appearanceState) {
if (appearanceState.isNull()) {
@@ -1476,6 +1531,7 @@ public AnnotationCaret build() {
page,
hasAppearance,
appearanceState,
+ structurePosition,
nm,
rect,
contents,
diff --git a/src/main/java/api/types/AnnotationCircle.java b/src/main/java/api/types/AnnotationCircle.java
index 5c049f8..abe1388 100644
--- a/src/main/java/api/types/AnnotationCircle.java
+++ b/src/main/java/api/types/AnnotationCircle.java
@@ -34,6 +34,8 @@ public final class AnnotationCircle {
private final Optional appearanceState;
+ private final Optional> structurePosition;
+
private final Optional nm;
private final AnnotationCircleRect rect;
@@ -111,6 +113,7 @@ private AnnotationCircle(
PageRef page,
boolean hasAppearance,
Optional appearanceState,
+ Optional> structurePosition,
Optional nm,
AnnotationCircleRect rect,
Optional contents,
@@ -151,6 +154,7 @@ private AnnotationCircle(
this.page = page;
this.hasAppearance = hasAppearance;
this.appearanceState = appearanceState;
+ this.structurePosition = structurePosition;
this.nm = nm;
this.rect = rect;
this.contents = contents;
@@ -212,6 +216,14 @@ public Optional getAppearanceState() {
return appearanceState;
}
+ @JsonIgnore
+ public Optional> getStructurePosition() {
+ if (structurePosition == null) {
+ return Optional.empty();
+ }
+ return structurePosition;
+ }
+
@JsonIgnore
public Optional getNm() {
if (nm == null) {
@@ -447,6 +459,12 @@ private Optional _getAppearanceState() {
return appearanceState;
}
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("structurePosition")
+ private Optional> _getStructurePosition() {
+ return structurePosition;
+ }
+
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
@JsonProperty("nm")
private Optional _getNm() {
@@ -571,6 +589,7 @@ private boolean equalTo(AnnotationCircle other) {
&& page.equals(other.page)
&& hasAppearance == other.hasAppearance
&& appearanceState.equals(other.appearanceState)
+ && structurePosition.equals(other.structurePosition)
&& nm.equals(other.nm)
&& rect.equals(other.rect)
&& contents.equals(other.contents)
@@ -615,6 +634,7 @@ public int hashCode() {
this.page,
this.hasAppearance,
this.appearanceState,
+ this.structurePosition,
this.nm,
this.rect,
this.contents,
@@ -756,6 +776,12 @@ public interface _FinalStage {
_FinalStage appearanceState(Nullable appearanceState);
+ _FinalStage structurePosition(Optional> structurePosition);
+
+ _FinalStage structurePosition(List structurePosition);
+
+ _FinalStage structurePosition(Nullable> structurePosition);
+
_FinalStage nm(Optional nm);
_FinalStage nm(String nm);
@@ -964,6 +990,8 @@ public static final class Builder
private Optional nm = Optional.empty();
+ private Optional> structurePosition = Optional.empty();
+
private Optional appearanceState = Optional.empty();
@JsonAnySetter
@@ -977,6 +1005,7 @@ public Builder from(AnnotationCircle other) {
page(other.getPage());
hasAppearance(other.getHasAppearance());
appearanceState(other.getAppearanceState());
+ structurePosition(other.getStructurePosition());
nm(other.getNm());
rect(other.getRect());
contents(other.getContents());
@@ -1605,6 +1634,31 @@ public _FinalStage nm(Optional nm) {
return this;
}
+ @java.lang.Override
+ public _FinalStage structurePosition(Nullable> structurePosition) {
+ if (structurePosition.isNull()) {
+ this.structurePosition = null;
+ } else if (structurePosition.isEmpty()) {
+ this.structurePosition = Optional.empty();
+ } else {
+ this.structurePosition = Optional.of(structurePosition.get());
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage structurePosition(List structurePosition) {
+ this.structurePosition = Optional.ofNullable(structurePosition);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "structurePosition", nulls = Nulls.SKIP)
+ public _FinalStage structurePosition(Optional> structurePosition) {
+ this.structurePosition = structurePosition;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage appearanceState(Nullable appearanceState) {
if (appearanceState.isNull()) {
@@ -1637,6 +1691,7 @@ public AnnotationCircle build() {
page,
hasAppearance,
appearanceState,
+ structurePosition,
nm,
rect,
contents,
diff --git a/src/main/java/api/types/AnnotationDraftCaret.java b/src/main/java/api/types/AnnotationDraftCaret.java
index 95f698a..f509e03 100644
--- a/src/main/java/api/types/AnnotationDraftCaret.java
+++ b/src/main/java/api/types/AnnotationDraftCaret.java
@@ -31,6 +31,8 @@ public final class AnnotationDraftCaret {
private final Optional