diff --git a/.fern/metadata.json b/.fern/metadata.json
index 08dbb3c..25e2eb3 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": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc",
+ "originGitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
- "requestedVersion": "3.0.0-alpha.16",
+ "requestedVersion": "3.0.0-alpha.17",
"ciProvider": "github"
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 24ad33d..bf778e0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,7 +46,7 @@ java {
group = 'com.cloudpdf'
-version = '3.0.0-alpha.16'
+version = '3.0.0-alpha.17'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -73,7 +73,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.cloudpdf'
artifactId = 'sdk'
- version = '3.0.0-alpha.16'
+ version = '3.0.0-alpha.17'
from components.java
pom {
name = 'CloudPDF'
diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json
index 1c1092b..34b02b2 100644
--- a/cloudpdf-generation.json
+++ b/cloudpdf-generation.json
@@ -1,12 +1,12 @@
{
"language": "java",
- "canonicalVersion": "3.0.0-next.16",
- "sdkVersion": "3.0.0-alpha.16",
+ "canonicalVersion": "3.0.0-next.17",
+ "sdkVersion": "3.0.0-alpha.17",
"source": {
"repository": "embedpdf/embed-pdf-viewer",
"openapi": "cloudpdf/contract/openapi.json",
- "openapiSha256": "06543c26918bd79d426bf242c5a3091cdb7d298d3ac3296addabee2be80edb15",
- "gitCommit": "7ded7de29f4cc0dc9da18042fca6afd5c9557bfc",
+ "openapiSha256": "8fa53cef2776eb0de9ec50c263aa547b309a04d1a2ecb6ee54b6338d6698dc00",
+ "gitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977",
"gitCommitIsDirty": false
},
"fern": {
diff --git a/reference.md b/reference.md
index 3f68c26..e080525 100644
--- a/reference.md
+++ b/reference.md
@@ -229,6 +229,90 @@ client.doc().download(
+
+
+
+
+client.doc.downloadLink(docId, layerName, request) -> DocDownloadLink200Response
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with `layer_name`, a `download: { docVersion, mode: "incremental" }` claim and a short `exp`, passed as `link` on the versioned download URL.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.doc().downloadLink(
+ "docId",
+ "layerName",
+ DocDownloadLinkRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**docId:** `String`
+
+
+
+
+
+-
+
+**layerName:** `String`
+
+
+
+
+
+-
+
+**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.
+
+
+
+
+
+-
+
+**expiresIn:** `Optional`
+
+
+
+
+
+
+
@@ -464,7 +548,7 @@ client.doc().text(
-
-Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. Mounted only when the deployment can sign (HS256 mode).
+Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until `password` is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; `error.details` carries `fields` (what the link asks), `missing`, `invalid`, `purpose` and `privacyUrl`. A link that asks before the first change issues the session at once with `visitor.identityRequest`, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
@@ -509,6 +593,30 @@ client.shares().exchange(
**password:** `Optional`
+
+
+
+
+-
+
+**visitorHandle:** `Optional`
+
+
+
+
+
+-
+
+**restart:** `Optional`
+
+
+
+
+
+-
+
+**visitorIdentity:** `Optional`
+
@@ -578,6 +686,14 @@ client.shares().list(
**docId:** `Optional`
+
+
+
+
+-
+
+**archived:** `Optional`
+
@@ -655,6 +771,14 @@ client.shares().create(
-
+**layerMode:** `Optional`
+
+
+
+
+
+-
+
**layerName:** `Optional`
@@ -663,6 +787,30 @@ client.shares().create(
-
+**keepVisitorLayers:** `Optional`
+
+
+
+
+
+-
+
+**visitorIdleSeconds:** `Optional`
+
+
+
+
+
+-
+
+**visitorIdentity:** `Optional`
+
+
+
+
+
+-
+
**scope:** `List`
@@ -865,6 +1013,46 @@ client.shares().update(
-
+**layerMode:** `Optional`
+
+
+
+
+
+-
+
+**layerName:** `Optional`
+
+
+
+
+
+-
+
+**keepVisitorLayers:** `Optional`
+
+
+
+
+
+-
+
+**visitorIdleSeconds:** `Optional`
+
+
+
+
+
+-
+
+**visitorIdentity:** `Optional`
+
+
+
+
+
+-
+
**scope:** `Optional
>`
@@ -913,6 +1101,74 @@ client.shares().update(
+
+
+
+
+client.shares.archive(tenantId, shareId) -> SharesArchive200Response
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (`disabled`) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.shares().archive(
+ "tenantId",
+ "shareId",
+ ArchiveSharesRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tenantId:** `String`
+
+
+
+
+
+-
+
+**shareId:** `String`
+
+
+
+
+
+
+
@@ -5598,3 +5854,307 @@ client.doc().metadata().custom().get(
+## Documents Layers
+client.documents.layers.list(tenantId, id) -> DocumentsLayersList200Response
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.documents().layers().list(
+ "tenantId",
+ "id",
+ ListLayersRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tenantId:** `String`
+
+
+
+
+
+-
+
+**id:** `String`
+
+
+
+
+
+-
+
+**limit:** `Optional`
+
+
+
+
+
+-
+
+**cursor:** `Optional`
+
+
+
+
+
+-
+
+**shareId:** `Optional`
+
+
+
+
+
+
+
+
+
+
+
+client.documents.layers.delete(tenantId, id, layerName)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.documents().layers().delete(
+ "tenantId",
+ "id",
+ "layerName",
+ DeleteLayersRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tenantId:** `String`
+
+
+
+
+
+-
+
+**id:** `String`
+
+
+
+
+
+-
+
+**layerName:** `String`
+
+
+
+
+
+
+
+
+
+
+
+## Shares Visitors
+client.shares.visitors.list(tenantId, shareId) -> SharesVisitorsList200Response
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+An archived link's visitors are listed too.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.shares().visitors().list(
+ "tenantId",
+ "shareId",
+ ListVisitorsRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tenantId:** `String`
+
+
+
+
+
+-
+
+**shareId:** `String`
+
+
+
+
+
+-
+
+**limit:** `Optional`
+
+
+
+
+
+-
+
+**cursor:** `Optional`
+
+
+
+
+
+
+
+
+
+
+
+client.shares.visitors.delete(tenantId, shareId, visitorId)
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Their handle brings them back as a new visitor, who is asked again. Deleting a visitor already deleted changes nothing.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```java
+client.shares().visitors().delete(
+ "tenantId",
+ "shareId",
+ "visitorId",
+ DeleteVisitorsRequest
+ .builder()
+ .build()
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**tenantId:** `String`
+
+
+
+
+
+-
+
+**shareId:** `String`
+
+
+
+
+
+-
+
+**visitorId:** `String`
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/api/core/ClientOptions.java b/src/main/java/api/core/ClientOptions.java
index 31e9533..e9cee88 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.16");
+ put("X-Fern-SDK-Version", "3.0.0-alpha.17");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/api/errors/NotImplementedError.java b/src/main/java/api/errors/NotImplementedError.java
new file mode 100644
index 0000000..483ab72
--- /dev/null
+++ b/src/main/java/api/errors/NotImplementedError.java
@@ -0,0 +1,33 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.errors;
+
+import com.cloudpdf.api.core.CloudPDFApiException;
+import com.cloudpdf.api.types.EngineErrorPayload;
+import okhttp3.Response;
+
+public final class NotImplementedError extends CloudPDFApiException {
+ /**
+ * The body of the response that triggered the exception.
+ */
+ private final EngineErrorPayload body;
+
+ public NotImplementedError(EngineErrorPayload body) {
+ super("NotImplementedError", 501, body);
+ this.body = body;
+ }
+
+ public NotImplementedError(EngineErrorPayload body, Response rawResponse) {
+ super("NotImplementedError", 501, body, rawResponse);
+ this.body = body;
+ }
+
+ /**
+ * @return the body
+ */
+ @java.lang.Override
+ public EngineErrorPayload body() {
+ return this.body;
+ }
+}
diff --git a/src/main/java/api/resources/doc/AsyncDocClient.java b/src/main/java/api/resources/doc/AsyncDocClient.java
index 8a3f8a6..887a5f0 100644
--- a/src/main/java/api/resources/doc/AsyncDocClient.java
+++ b/src/main/java/api/resources/doc/AsyncDocClient.java
@@ -14,6 +14,7 @@
import com.cloudpdf.api.resources.doc.pages.AsyncPagesClient;
import com.cloudpdf.api.resources.doc.redactions.AsyncRedactionsClient;
import com.cloudpdf.api.resources.doc.requests.DocChangesRequest;
+import com.cloudpdf.api.resources.doc.requests.DocDownloadLinkRequest;
import com.cloudpdf.api.resources.doc.requests.DownloadDocRequest;
import com.cloudpdf.api.resources.doc.requests.HeadDocRequest;
import com.cloudpdf.api.resources.doc.requests.ManifestDocRequest;
@@ -22,6 +23,7 @@
import com.cloudpdf.api.resources.doc.signatures.AsyncSignaturesClient;
import com.cloudpdf.api.resources.doc.versions.AsyncVersionsClient;
import com.cloudpdf.api.types.DocChanges200Response;
+import com.cloudpdf.api.types.DocDownloadLink200Response;
import com.cloudpdf.api.types.DocHead200Response;
import com.cloudpdf.api.types.DocManifest200Response;
import com.cloudpdf.api.types.DocText200Response;
@@ -124,6 +126,39 @@ public CompletableFuture download(
.thenApply(response -> response.body());
}
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture downloadLink(String docId, String layerName) {
+ return this.rawClient.downloadLink(docId, layerName).thenApply(response -> response.body());
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture downloadLink(
+ String docId, String layerName, RequestOptions requestOptions) {
+ return this.rawClient.downloadLink(docId, layerName, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request) {
+ return this.rawClient.downloadLink(docId, layerName, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request, RequestOptions requestOptions) {
+ return this.rawClient
+ .downloadLink(docId, layerName, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
public CompletableFuture manifest(String docId, String layerName) {
return this.rawClient.manifest(docId, layerName).thenApply(response -> response.body());
}
diff --git a/src/main/java/api/resources/doc/AsyncRawDocClient.java b/src/main/java/api/resources/doc/AsyncRawDocClient.java
index 35ff242..198c098 100644
--- a/src/main/java/api/resources/doc/AsyncRawDocClient.java
+++ b/src/main/java/api/resources/doc/AsyncRawDocClient.java
@@ -16,16 +16,20 @@
import com.cloudpdf.api.errors.ConflictError;
import com.cloudpdf.api.errors.ContentTooLargeError;
import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.errors.NotImplementedError;
import com.cloudpdf.api.resources.doc.requests.DocChangesRequest;
+import com.cloudpdf.api.resources.doc.requests.DocDownloadLinkRequest;
import com.cloudpdf.api.resources.doc.requests.DownloadDocRequest;
import com.cloudpdf.api.resources.doc.requests.HeadDocRequest;
import com.cloudpdf.api.resources.doc.requests.ManifestDocRequest;
import com.cloudpdf.api.resources.doc.requests.RenderDocRequest;
import com.cloudpdf.api.resources.doc.requests.TextDocRequest;
import com.cloudpdf.api.types.DocChanges200Response;
+import com.cloudpdf.api.types.DocDownloadLink200Response;
import com.cloudpdf.api.types.DocHead200Response;
import com.cloudpdf.api.types.DocManifest200Response;
import com.cloudpdf.api.types.DocText200Response;
+import com.cloudpdf.api.types.EngineErrorPayload;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.io.InputStream;
@@ -344,6 +348,128 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
return future;
}
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture> downloadLink(
+ String docId, String layerName) {
+ return downloadLink(docId, layerName, DocDownloadLinkRequest.builder().build());
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture> downloadLink(
+ String docId, String layerName, RequestOptions requestOptions) {
+ return downloadLink(docId, layerName, DocDownloadLinkRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture> downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request) {
+ return downloadLink(docId, layerName, request, null);
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CompletableFuture> downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("download-link");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), 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, DocDownloadLink200Response.class),
+ response));
+ return;
+ }
+ try {
+ switch (response.code()) {
+ case 404:
+ future.completeExceptionally(new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
+ return;
+ case 501:
+ future.completeExceptionally(new NotImplementedError(
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBodyString, EngineErrorPayload.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> manifest(
String docId, String layerName) {
return manifest(docId, layerName, ManifestDocRequest.builder().build());
diff --git a/src/main/java/api/resources/doc/DocClient.java b/src/main/java/api/resources/doc/DocClient.java
index b0b9a2f..6c79d35 100644
--- a/src/main/java/api/resources/doc/DocClient.java
+++ b/src/main/java/api/resources/doc/DocClient.java
@@ -14,6 +14,7 @@
import com.cloudpdf.api.resources.doc.pages.PagesClient;
import com.cloudpdf.api.resources.doc.redactions.RedactionsClient;
import com.cloudpdf.api.resources.doc.requests.DocChangesRequest;
+import com.cloudpdf.api.resources.doc.requests.DocDownloadLinkRequest;
import com.cloudpdf.api.resources.doc.requests.DownloadDocRequest;
import com.cloudpdf.api.resources.doc.requests.HeadDocRequest;
import com.cloudpdf.api.resources.doc.requests.ManifestDocRequest;
@@ -22,6 +23,7 @@
import com.cloudpdf.api.resources.doc.signatures.SignaturesClient;
import com.cloudpdf.api.resources.doc.versions.VersionsClient;
import com.cloudpdf.api.types.DocChanges200Response;
+import com.cloudpdf.api.types.DocDownloadLink200Response;
import com.cloudpdf.api.types.DocHead200Response;
import com.cloudpdf.api.types.DocManifest200Response;
import com.cloudpdf.api.types.DocText200Response;
@@ -122,6 +124,37 @@ public InputStream download(
.body();
}
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public DocDownloadLink200Response downloadLink(String docId, String layerName) {
+ return this.rawClient.downloadLink(docId, layerName).body();
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public DocDownloadLink200Response downloadLink(String docId, String layerName, RequestOptions requestOptions) {
+ return this.rawClient.downloadLink(docId, layerName, requestOptions).body();
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public DocDownloadLink200Response downloadLink(String docId, String layerName, DocDownloadLinkRequest request) {
+ return this.rawClient.downloadLink(docId, layerName, request).body();
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public DocDownloadLink200Response downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request, RequestOptions requestOptions) {
+ return this.rawClient
+ .downloadLink(docId, layerName, request, requestOptions)
+ .body();
+ }
+
public DocManifest200Response manifest(String docId, String layerName) {
return this.rawClient.manifest(docId, layerName).body();
}
diff --git a/src/main/java/api/resources/doc/RawDocClient.java b/src/main/java/api/resources/doc/RawDocClient.java
index 3ef810e..dee36f6 100644
--- a/src/main/java/api/resources/doc/RawDocClient.java
+++ b/src/main/java/api/resources/doc/RawDocClient.java
@@ -16,16 +16,20 @@
import com.cloudpdf.api.errors.ConflictError;
import com.cloudpdf.api.errors.ContentTooLargeError;
import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.errors.NotImplementedError;
import com.cloudpdf.api.resources.doc.requests.DocChangesRequest;
+import com.cloudpdf.api.resources.doc.requests.DocDownloadLinkRequest;
import com.cloudpdf.api.resources.doc.requests.DownloadDocRequest;
import com.cloudpdf.api.resources.doc.requests.HeadDocRequest;
import com.cloudpdf.api.resources.doc.requests.ManifestDocRequest;
import com.cloudpdf.api.resources.doc.requests.RenderDocRequest;
import com.cloudpdf.api.resources.doc.requests.TextDocRequest;
import com.cloudpdf.api.types.DocChanges200Response;
+import com.cloudpdf.api.types.DocDownloadLink200Response;
import com.cloudpdf.api.types.DocHead200Response;
import com.cloudpdf.api.types.DocManifest200Response;
import com.cloudpdf.api.types.DocText200Response;
+import com.cloudpdf.api.types.EngineErrorPayload;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.io.InputStream;
@@ -283,6 +287,108 @@ public CloudPDFClientHttpResponse download(
}
}
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CloudPDFClientHttpResponse downloadLink(String docId, String layerName) {
+ return downloadLink(docId, layerName, DocDownloadLinkRequest.builder().build());
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CloudPDFClientHttpResponse downloadLink(
+ String docId, String layerName, RequestOptions requestOptions) {
+ return downloadLink(docId, layerName, DocDownloadLinkRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CloudPDFClientHttpResponse downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request) {
+ return downloadLink(docId, layerName, request, null);
+ }
+
+ /**
+ * The link opens the layer as it is when created: once the layer changes, it answers 404, so create it right before handing it over. It downloads that one file and nothing else, and a password-protected document is checked when the link is created. Deployments that verify tokens with their own keys (JWKS) mint links on their backend: a doc token with layer_name, a download: { docVersion, mode: "incremental" } claim and a short exp, passed as link on the versioned download URL.
+ */
+ public CloudPDFClientHttpResponse downloadLink(
+ String docId, String layerName, DocDownloadLinkRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/docs")
+ .addPathSegment(docId)
+ .addPathSegments("layers")
+ .addPathSegment(layerName)
+ .addPathSegments("download-link");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ RequestBody body;
+ try {
+ body = RequestBody.create(
+ ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), 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, DocDownloadLink200Response.class),
+ response);
+ }
+ try {
+ switch (response.code()) {
+ case 404:
+ throw new NotFoundError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ case 501:
+ throw new NotImplementedError(
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EngineErrorPayload.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 manifest(String docId, String layerName) {
return manifest(docId, layerName, ManifestDocRequest.builder().build());
}
diff --git a/src/main/java/api/resources/doc/requests/DocDownloadLinkRequest.java b/src/main/java/api/resources/doc/requests/DocDownloadLinkRequest.java
new file mode 100644
index 0000000..e37df52
--- /dev/null
+++ b/src/main/java/api/resources/doc/requests/DocDownloadLinkRequest.java
@@ -0,0 +1,134 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.doc.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.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
+import com.fasterxml.jackson.annotation.Nulls;
+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 = DocDownloadLinkRequest.Builder.class)
+public final class DocDownloadLinkRequest {
+ private final Optional documentPassword;
+
+ private final Optional expiresIn;
+
+ private final Map additionalProperties;
+
+ private DocDownloadLinkRequest(
+ Optional documentPassword, Optional expiresIn, Map additionalProperties) {
+ this.documentPassword = documentPassword;
+ this.expiresIn = expiresIn;
+ 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("expiresIn")
+ public Optional getExpiresIn() {
+ return expiresIn;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof DocDownloadLinkRequest && equalTo((DocDownloadLinkRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(DocDownloadLinkRequest other) {
+ return documentPassword.equals(other.documentPassword) && expiresIn.equals(other.expiresIn);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.documentPassword, this.expiresIn);
+ }
+
+ @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();
+
+ private Optional expiresIn = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(DocDownloadLinkRequest other) {
+ documentPassword(other.getDocumentPassword());
+ expiresIn(other.getExpiresIn());
+ 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;
+ }
+
+ @JsonSetter(value = "expiresIn", nulls = Nulls.SKIP)
+ public Builder expiresIn(Optional expiresIn) {
+ this.expiresIn = expiresIn;
+ return this;
+ }
+
+ public Builder expiresIn(Integer expiresIn) {
+ this.expiresIn = Optional.ofNullable(expiresIn);
+ return this;
+ }
+
+ public DocDownloadLinkRequest build() {
+ return new DocDownloadLinkRequest(documentPassword, expiresIn, 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/documents/AsyncDocumentsClient.java b/src/main/java/api/resources/documents/AsyncDocumentsClient.java
index c51e0ae..0f4ed2f 100644
--- a/src/main/java/api/resources/documents/AsyncDocumentsClient.java
+++ b/src/main/java/api/resources/documents/AsyncDocumentsClient.java
@@ -5,6 +5,8 @@
import com.cloudpdf.api.core.ClientOptions;
import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.documents.layers.AsyncLayersClient;
import com.cloudpdf.api.resources.documents.requests.DeleteDocumentsRequest;
import com.cloudpdf.api.resources.documents.requests.DocumentsCommitRequest;
import com.cloudpdf.api.resources.documents.requests.DocumentsImportFromRequest;
@@ -23,6 +25,7 @@
import java.io.File;
import java.io.InputStream;
import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
import okhttp3.MediaType;
public class AsyncDocumentsClient {
@@ -30,9 +33,12 @@ public class AsyncDocumentsClient {
private final AsyncRawDocumentsClient rawClient;
+ protected final Supplier layersClient;
+
public AsyncDocumentsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawDocumentsClient(clientOptions);
+ this.layersClient = Suppliers.memoize(() -> new AsyncLayersClient(clientOptions));
}
/**
@@ -210,4 +216,8 @@ public CompletableFuture init(
String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
return this.rawClient.init(tenantId, request, requestOptions).thenApply(response -> response.body());
}
+
+ public AsyncLayersClient layers() {
+ return this.layersClient.get();
+ }
}
diff --git a/src/main/java/api/resources/documents/DocumentsClient.java b/src/main/java/api/resources/documents/DocumentsClient.java
index 834e08e..1ba8a01 100644
--- a/src/main/java/api/resources/documents/DocumentsClient.java
+++ b/src/main/java/api/resources/documents/DocumentsClient.java
@@ -5,6 +5,8 @@
import com.cloudpdf.api.core.ClientOptions;
import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.documents.layers.LayersClient;
import com.cloudpdf.api.resources.documents.requests.DeleteDocumentsRequest;
import com.cloudpdf.api.resources.documents.requests.DocumentsCommitRequest;
import com.cloudpdf.api.resources.documents.requests.DocumentsImportFromRequest;
@@ -22,6 +24,7 @@
import com.cloudpdf.api.types.DocumentsUploadProxy200Response;
import java.io.File;
import java.io.InputStream;
+import java.util.function.Supplier;
import okhttp3.MediaType;
public class DocumentsClient {
@@ -29,9 +32,12 @@ public class DocumentsClient {
private final RawDocumentsClient rawClient;
+ protected final Supplier layersClient;
+
public DocumentsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawDocumentsClient(clientOptions);
+ this.layersClient = Suppliers.memoize(() -> new LayersClient(clientOptions));
}
/**
@@ -204,4 +210,8 @@ public DocumentsInit200Response init(String tenantId, DocumentsInitRequest reque
public DocumentsInit200Response init(String tenantId, DocumentsInitRequest request, RequestOptions requestOptions) {
return this.rawClient.init(tenantId, request, requestOptions).body();
}
+
+ public LayersClient layers() {
+ return this.layersClient.get();
+ }
}
diff --git a/src/main/java/api/resources/documents/layers/AsyncLayersClient.java b/src/main/java/api/resources/documents/layers/AsyncLayersClient.java
new file mode 100644
index 0000000..44878e1
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/AsyncLayersClient.java
@@ -0,0 +1,67 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.resources.documents.layers.requests.DeleteLayersRequest;
+import com.cloudpdf.api.resources.documents.layers.requests.ListLayersRequest;
+import com.cloudpdf.api.types.DocumentsLayersList200Response;
+import java.util.concurrent.CompletableFuture;
+
+public class AsyncLayersClient {
+ protected final ClientOptions clientOptions;
+
+ private final AsyncRawLayersClient rawClient;
+
+ public AsyncLayersClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new AsyncRawLayersClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public AsyncRawLayersClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public CompletableFuture list(String tenantId, String id) {
+ return this.rawClient.list(tenantId, id).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(
+ String tenantId, String id, RequestOptions requestOptions) {
+ return this.rawClient.list(tenantId, id, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(
+ String tenantId, String id, ListLayersRequest request) {
+ return this.rawClient.list(tenantId, id, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture list(
+ String tenantId, String id, ListLayersRequest request, RequestOptions requestOptions) {
+ return this.rawClient.list(tenantId, id, request, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture delete(String tenantId, String id, String layerName) {
+ return this.rawClient.delete(tenantId, id, layerName).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture delete(String tenantId, String id, String layerName, RequestOptions requestOptions) {
+ return this.rawClient.delete(tenantId, id, layerName, requestOptions).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture delete(String tenantId, String id, String layerName, DeleteLayersRequest request) {
+ return this.rawClient.delete(tenantId, id, layerName, request).thenApply(response -> response.body());
+ }
+
+ public CompletableFuture delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request, RequestOptions requestOptions) {
+ return this.rawClient
+ .delete(tenantId, id, layerName, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+}
diff --git a/src/main/java/api/resources/documents/layers/AsyncRawLayersClient.java b/src/main/java/api/resources/documents/layers/AsyncRawLayersClient.java
new file mode 100644
index 0000000..bdd97fb
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/AsyncRawLayersClient.java
@@ -0,0 +1,254 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers;
+
+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.QueryStringMapper;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.ConflictError;
+import com.cloudpdf.api.errors.ForbiddenError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.documents.layers.requests.DeleteLayersRequest;
+import com.cloudpdf.api.resources.documents.layers.requests.ListLayersRequest;
+import com.cloudpdf.api.types.DocumentsLayersList200Response;
+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.Response;
+import okhttp3.ResponseBody;
+import org.jetbrains.annotations.NotNull;
+
+public class AsyncRawLayersClient {
+ protected final ClientOptions clientOptions;
+
+ public AsyncRawLayersClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public CompletableFuture> list(
+ String tenantId, String id) {
+ return list(tenantId, id, ListLayersRequest.builder().build());
+ }
+
+ public CompletableFuture> list(
+ String tenantId, String id, RequestOptions requestOptions) {
+ return list(tenantId, id, ListLayersRequest.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> list(
+ String tenantId, String id, ListLayersRequest request) {
+ return list(tenantId, id, request, null);
+ }
+
+ public CompletableFuture> list(
+ String tenantId, String id, ListLayersRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("documents")
+ .addPathSegment(id)
+ .addPathSegments("layers");
+ if (request.getLimit().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "limit", request.getLimit().get(), false);
+ }
+ if (request.getCursor().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "cursor", request.getCursor().get(), false);
+ }
+ if (request.getShareId().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "shareId", request.getShareId().get(), false);
+ }
+ 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");
+ 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, DocumentsLayersList200Response.class),
+ response));
+ return;
+ }
+ try {
+ 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;
+ 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> delete(String tenantId, String id, String layerName) {
+ return delete(tenantId, id, layerName, DeleteLayersRequest.builder().build());
+ }
+
+ public CompletableFuture> delete(
+ String tenantId, String id, String layerName, RequestOptions requestOptions) {
+ return delete(tenantId, id, layerName, DeleteLayersRequest.builder().build(), requestOptions);
+ }
+
+ public CompletableFuture> delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request) {
+ return delete(tenantId, id, layerName, request, null);
+ }
+
+ public CompletableFuture> delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("documents")
+ .addPathSegment(id)
+ .addPathSegments("layers")
+ .addPathSegment(layerName);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ 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<>(null, 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;
+ case 409:
+ future.completeExceptionally(new ConflictError(
+ 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/documents/layers/LayersClient.java b/src/main/java/api/resources/documents/layers/LayersClient.java
new file mode 100644
index 0000000..a73f087
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/LayersClient.java
@@ -0,0 +1,62 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers;
+
+import com.cloudpdf.api.core.ClientOptions;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.resources.documents.layers.requests.DeleteLayersRequest;
+import com.cloudpdf.api.resources.documents.layers.requests.ListLayersRequest;
+import com.cloudpdf.api.types.DocumentsLayersList200Response;
+
+public class LayersClient {
+ protected final ClientOptions clientOptions;
+
+ private final RawLayersClient rawClient;
+
+ public LayersClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ this.rawClient = new RawLayersClient(clientOptions);
+ }
+
+ /**
+ * Get responses with HTTP metadata like headers
+ */
+ public RawLayersClient withRawResponse() {
+ return this.rawClient;
+ }
+
+ public DocumentsLayersList200Response list(String tenantId, String id) {
+ return this.rawClient.list(tenantId, id).body();
+ }
+
+ public DocumentsLayersList200Response list(String tenantId, String id, RequestOptions requestOptions) {
+ return this.rawClient.list(tenantId, id, requestOptions).body();
+ }
+
+ public DocumentsLayersList200Response list(String tenantId, String id, ListLayersRequest request) {
+ return this.rawClient.list(tenantId, id, request).body();
+ }
+
+ public DocumentsLayersList200Response list(
+ String tenantId, String id, ListLayersRequest request, RequestOptions requestOptions) {
+ return this.rawClient.list(tenantId, id, request, requestOptions).body();
+ }
+
+ public void delete(String tenantId, String id, String layerName) {
+ this.rawClient.delete(tenantId, id, layerName).body();
+ }
+
+ public void delete(String tenantId, String id, String layerName, RequestOptions requestOptions) {
+ this.rawClient.delete(tenantId, id, layerName, requestOptions).body();
+ }
+
+ public void delete(String tenantId, String id, String layerName, DeleteLayersRequest request) {
+ this.rawClient.delete(tenantId, id, layerName, request).body();
+ }
+
+ public void delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request, RequestOptions requestOptions) {
+ this.rawClient.delete(tenantId, id, layerName, request, requestOptions).body();
+ }
+}
diff --git a/src/main/java/api/resources/documents/layers/RawLayersClient.java b/src/main/java/api/resources/documents/layers/RawLayersClient.java
new file mode 100644
index 0000000..b75e7bf
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/RawLayersClient.java
@@ -0,0 +1,207 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers;
+
+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.QueryStringMapper;
+import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.RetryInterceptor;
+import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.ConflictError;
+import com.cloudpdf.api.errors.ForbiddenError;
+import com.cloudpdf.api.errors.NotFoundError;
+import com.cloudpdf.api.resources.documents.layers.requests.DeleteLayersRequest;
+import com.cloudpdf.api.resources.documents.layers.requests.ListLayersRequest;
+import com.cloudpdf.api.types.DocumentsLayersList200Response;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.io.IOException;
+import okhttp3.Headers;
+import okhttp3.HttpUrl;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+
+public class RawLayersClient {
+ protected final ClientOptions clientOptions;
+
+ public RawLayersClient(ClientOptions clientOptions) {
+ this.clientOptions = clientOptions;
+ }
+
+ public CloudPDFClientHttpResponse list(String tenantId, String id) {
+ return list(tenantId, id, ListLayersRequest.builder().build());
+ }
+
+ public CloudPDFClientHttpResponse list(
+ String tenantId, String id, RequestOptions requestOptions) {
+ return list(tenantId, id, ListLayersRequest.builder().build(), requestOptions);
+ }
+
+ public CloudPDFClientHttpResponse list(
+ String tenantId, String id, ListLayersRequest request) {
+ return list(tenantId, id, request, null);
+ }
+
+ public CloudPDFClientHttpResponse list(
+ String tenantId, String id, ListLayersRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("documents")
+ .addPathSegment(id)
+ .addPathSegments("layers");
+ if (request.getLimit().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "limit", request.getLimit().get(), false);
+ }
+ if (request.getCursor().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "cursor", request.getCursor().get(), false);
+ }
+ if (request.getShareId().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "shareId", request.getShareId().get(), false);
+ }
+ 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");
+ 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, DocumentsLayersList200Response.class),
+ response);
+ }
+ try {
+ 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);
+ 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 delete(String tenantId, String id, String layerName) {
+ return delete(tenantId, id, layerName, DeleteLayersRequest.builder().build());
+ }
+
+ public CloudPDFClientHttpResponse delete(
+ String tenantId, String id, String layerName, RequestOptions requestOptions) {
+ return delete(tenantId, id, layerName, DeleteLayersRequest.builder().build(), requestOptions);
+ }
+
+ public CloudPDFClientHttpResponse delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request) {
+ return delete(tenantId, id, layerName, request, null);
+ }
+
+ public CloudPDFClientHttpResponse delete(
+ String tenantId, String id, String layerName, DeleteLayersRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("documents")
+ .addPathSegment(id)
+ .addPathSegments("layers")
+ .addPathSegment(layerName);
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("DELETE", null)
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ 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<>(null, 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);
+ case 409:
+ throw new ConflictError(
+ 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/documents/layers/requests/DeleteLayersRequest.java b/src/main/java/api/resources/documents/layers/requests/DeleteLayersRequest.java
new file mode 100644
index 0000000..0bdab88
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/requests/DeleteLayersRequest.java
@@ -0,0 +1,69 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+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;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = DeleteLayersRequest.Builder.class)
+public final class DeleteLayersRequest {
+ private final Map additionalProperties;
+
+ private DeleteLayersRequest(Map additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof DeleteLayersRequest;
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @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 {
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(DeleteLayersRequest other) {
+ return this;
+ }
+
+ public DeleteLayersRequest build() {
+ return new DeleteLayersRequest(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/documents/layers/requests/ListLayersRequest.java b/src/main/java/api/resources/documents/layers/requests/ListLayersRequest.java
new file mode 100644
index 0000000..d9f2808
--- /dev/null
+++ b/src/main/java/api/resources/documents/layers/requests/ListLayersRequest.java
@@ -0,0 +1,153 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.documents.layers.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+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.annotation.Nulls;
+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 = ListLayersRequest.Builder.class)
+public final class ListLayersRequest {
+ private final Optional limit;
+
+ private final Optional cursor;
+
+ private final Optional shareId;
+
+ private final Map additionalProperties;
+
+ private ListLayersRequest(
+ Optional limit,
+ Optional cursor,
+ Optional shareId,
+ Map additionalProperties) {
+ this.limit = limit;
+ this.cursor = cursor;
+ this.shareId = shareId;
+ this.additionalProperties = additionalProperties;
+ }
+
+ @JsonProperty("limit")
+ public Optional getLimit() {
+ return limit;
+ }
+
+ @JsonProperty("cursor")
+ public Optional getCursor() {
+ return cursor;
+ }
+
+ @JsonProperty("shareId")
+ public Optional getShareId() {
+ return shareId;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ListLayersRequest && equalTo((ListLayersRequest) other);
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ private boolean equalTo(ListLayersRequest other) {
+ return limit.equals(other.limit) && cursor.equals(other.cursor) && shareId.equals(other.shareId);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ return Objects.hash(this.limit, this.cursor, this.shareId);
+ }
+
+ @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 limit = Optional.empty();
+
+ private Optional cursor = Optional.empty();
+
+ private Optional shareId = Optional.empty();
+
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ListLayersRequest other) {
+ limit(other.getLimit());
+ cursor(other.getCursor());
+ shareId(other.getShareId());
+ return this;
+ }
+
+ @JsonSetter(value = "limit", nulls = Nulls.SKIP)
+ public Builder limit(Optional limit) {
+ this.limit = limit;
+ return this;
+ }
+
+ public Builder limit(Integer limit) {
+ this.limit = Optional.ofNullable(limit);
+ return this;
+ }
+
+ @JsonSetter(value = "cursor", nulls = Nulls.SKIP)
+ public Builder cursor(Optional cursor) {
+ this.cursor = cursor;
+ return this;
+ }
+
+ public Builder cursor(String cursor) {
+ this.cursor = Optional.ofNullable(cursor);
+ return this;
+ }
+
+ @JsonSetter(value = "shareId", nulls = Nulls.SKIP)
+ public Builder shareId(Optional shareId) {
+ this.shareId = shareId;
+ return this;
+ }
+
+ public Builder shareId(String shareId) {
+ this.shareId = Optional.ofNullable(shareId);
+ return this;
+ }
+
+ public ListLayersRequest build() {
+ return new ListLayersRequest(limit, cursor, shareId, 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/shares/AsyncRawSharesClient.java b/src/main/java/api/resources/shares/AsyncRawSharesClient.java
index 904b21e..9fe7a2c 100644
--- a/src/main/java/api/resources/shares/AsyncRawSharesClient.java
+++ b/src/main/java/api/resources/shares/AsyncRawSharesClient.java
@@ -13,10 +13,12 @@
import com.cloudpdf.api.core.RequestOptions;
import com.cloudpdf.api.core.RetryInterceptor;
import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.ConflictError;
import com.cloudpdf.api.errors.ForbiddenError;
import com.cloudpdf.api.errors.GoneError;
import com.cloudpdf.api.errors.NotFoundError;
import com.cloudpdf.api.errors.UnprocessableEntityError;
+import com.cloudpdf.api.resources.shares.requests.ArchiveSharesRequest;
import com.cloudpdf.api.resources.shares.requests.DeleteSharesRequest;
import com.cloudpdf.api.resources.shares.requests.GetSharesRequest;
import com.cloudpdf.api.resources.shares.requests.ListSharesRequest;
@@ -24,6 +26,7 @@
import com.cloudpdf.api.resources.shares.requests.SharesExchangeRequest;
import com.cloudpdf.api.resources.shares.requests.SharesUpdateRequest;
import com.cloudpdf.api.types.AdminErrorPayload;
+import com.cloudpdf.api.types.SharesArchive200Response;
import com.cloudpdf.api.types.SharesCreate200Response;
import com.cloudpdf.api.types.SharesExchange200Response;
import com.cloudpdf.api.types.SharesGet200Response;
@@ -51,7 +54,7 @@ public AsyncRawSharesClient(ClientOptions clientOptions) {
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CompletableFuture> exchange(
SharesExchangeRequest request) {
@@ -59,7 +62,7 @@ public CompletableFuture>
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CompletableFuture> exchange(
SharesExchangeRequest request, RequestOptions requestOptions) {
@@ -197,6 +200,10 @@ public CompletableFuture> list
QueryStringMapper.addQueryParameter(
httpUrl, "docId", request.getDocId().get(), false);
}
+ if (request.getArchived().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "archived", request.getArchived().get(), false);
+ }
if (requestOptions != null) {
requestOptions.getQueryParameters().forEach((_key, _value) -> {
httpUrl.addQueryParameter(_key, _value);
@@ -509,10 +516,17 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
- if (response.code() == 404) {
- future.completeExceptionally(new NotFoundError(
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response));
- return;
+ switch (response.code()) {
+ 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),
+ response));
+ return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
@@ -616,6 +630,112 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
+ case 409:
+ future.completeExceptionally(new ConflictError(
+ 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;
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture> archive(
+ String tenantId, String shareId) {
+ return archive(tenantId, shareId, ArchiveSharesRequest.builder().build());
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture> archive(
+ String tenantId, String shareId, RequestOptions requestOptions) {
+ return archive(tenantId, shareId, ArchiveSharesRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture> archive(
+ String tenantId, String shareId, ArchiveSharesRequest request) {
+ return archive(tenantId, shareId, request, null);
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture> archive(
+ String tenantId, String shareId, ArchiveSharesRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("shares")
+ .addPathSegment(shareId)
+ .addPathSegments("archive");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ 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, SharesArchive200Response.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
diff --git a/src/main/java/api/resources/shares/AsyncSharesClient.java b/src/main/java/api/resources/shares/AsyncSharesClient.java
index e0fcadf..4d0421b 100644
--- a/src/main/java/api/resources/shares/AsyncSharesClient.java
+++ b/src/main/java/api/resources/shares/AsyncSharesClient.java
@@ -5,27 +5,35 @@
import com.cloudpdf.api.core.ClientOptions;
import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.shares.requests.ArchiveSharesRequest;
import com.cloudpdf.api.resources.shares.requests.DeleteSharesRequest;
import com.cloudpdf.api.resources.shares.requests.GetSharesRequest;
import com.cloudpdf.api.resources.shares.requests.ListSharesRequest;
import com.cloudpdf.api.resources.shares.requests.SharesCreateRequest;
import com.cloudpdf.api.resources.shares.requests.SharesExchangeRequest;
import com.cloudpdf.api.resources.shares.requests.SharesUpdateRequest;
+import com.cloudpdf.api.resources.shares.visitors.AsyncVisitorsClient;
+import com.cloudpdf.api.types.SharesArchive200Response;
import com.cloudpdf.api.types.SharesCreate200Response;
import com.cloudpdf.api.types.SharesExchange200Response;
import com.cloudpdf.api.types.SharesGet200Response;
import com.cloudpdf.api.types.SharesList200Response;
import com.cloudpdf.api.types.SharesUpdate200Response;
import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
public class AsyncSharesClient {
protected final ClientOptions clientOptions;
private final AsyncRawSharesClient rawClient;
+ protected final Supplier visitorsClient;
+
public AsyncSharesClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawSharesClient(clientOptions);
+ this.visitorsClient = Suppliers.memoize(() -> new AsyncVisitorsClient(clientOptions));
}
/**
@@ -36,14 +44,14 @@ public AsyncRawSharesClient withRawResponse() {
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CompletableFuture exchange(SharesExchangeRequest request) {
return this.rawClient.exchange(request).thenApply(response -> response.body());
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CompletableFuture exchange(
SharesExchangeRequest request, RequestOptions requestOptions) {
@@ -134,4 +142,41 @@ public CompletableFuture update(
String tenantId, String shareId, SharesUpdateRequest request, RequestOptions requestOptions) {
return this.rawClient.update(tenantId, shareId, request, requestOptions).thenApply(response -> response.body());
}
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture archive(String tenantId, String shareId) {
+ return this.rawClient.archive(tenantId, shareId).thenApply(response -> response.body());
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture archive(
+ String tenantId, String shareId, RequestOptions requestOptions) {
+ return this.rawClient.archive(tenantId, shareId, requestOptions).thenApply(response -> response.body());
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture archive(
+ String tenantId, String shareId, ArchiveSharesRequest request) {
+ return this.rawClient.archive(tenantId, shareId, request).thenApply(response -> response.body());
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CompletableFuture archive(
+ String tenantId, String shareId, ArchiveSharesRequest request, RequestOptions requestOptions) {
+ return this.rawClient
+ .archive(tenantId, shareId, request, requestOptions)
+ .thenApply(response -> response.body());
+ }
+
+ public AsyncVisitorsClient visitors() {
+ return this.visitorsClient.get();
+ }
}
diff --git a/src/main/java/api/resources/shares/RawSharesClient.java b/src/main/java/api/resources/shares/RawSharesClient.java
index db9923a..7520cb9 100644
--- a/src/main/java/api/resources/shares/RawSharesClient.java
+++ b/src/main/java/api/resources/shares/RawSharesClient.java
@@ -13,10 +13,12 @@
import com.cloudpdf.api.core.RequestOptions;
import com.cloudpdf.api.core.RetryInterceptor;
import com.cloudpdf.api.errors.BadRequestError;
+import com.cloudpdf.api.errors.ConflictError;
import com.cloudpdf.api.errors.ForbiddenError;
import com.cloudpdf.api.errors.GoneError;
import com.cloudpdf.api.errors.NotFoundError;
import com.cloudpdf.api.errors.UnprocessableEntityError;
+import com.cloudpdf.api.resources.shares.requests.ArchiveSharesRequest;
import com.cloudpdf.api.resources.shares.requests.DeleteSharesRequest;
import com.cloudpdf.api.resources.shares.requests.GetSharesRequest;
import com.cloudpdf.api.resources.shares.requests.ListSharesRequest;
@@ -24,6 +26,7 @@
import com.cloudpdf.api.resources.shares.requests.SharesExchangeRequest;
import com.cloudpdf.api.resources.shares.requests.SharesUpdateRequest;
import com.cloudpdf.api.types.AdminErrorPayload;
+import com.cloudpdf.api.types.SharesArchive200Response;
import com.cloudpdf.api.types.SharesCreate200Response;
import com.cloudpdf.api.types.SharesExchange200Response;
import com.cloudpdf.api.types.SharesGet200Response;
@@ -47,14 +50,14 @@ public RawSharesClient(ClientOptions clientOptions) {
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CloudPDFClientHttpResponse exchange(SharesExchangeRequest request) {
return exchange(request, null);
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public CloudPDFClientHttpResponse exchange(
SharesExchangeRequest request, RequestOptions requestOptions) {
@@ -165,6 +168,10 @@ public CloudPDFClientHttpResponse list(
QueryStringMapper.addQueryParameter(
httpUrl, "docId", request.getDocId().get(), false);
}
+ if (request.getArchived().isPresent()) {
+ QueryStringMapper.addQueryParameter(
+ httpUrl, "archived", request.getArchived().get(), false);
+ }
if (requestOptions != null) {
requestOptions.getQueryParameters().forEach((_key, _value) -> {
httpUrl.addQueryParameter(_key, _value);
@@ -418,9 +425,13 @@ public CloudPDFClientHttpResponse delete(
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
- if (response.code() == 404) {
- throw new NotFoundError(
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
+ switch (response.code()) {
+ 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);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
@@ -505,6 +516,94 @@ public CloudPDFClientHttpResponse update(
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);
+ }
+ } 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);
+ }
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CloudPDFClientHttpResponse archive(String tenantId, String shareId) {
+ return archive(tenantId, shareId, ArchiveSharesRequest.builder().build());
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CloudPDFClientHttpResponse archive(
+ String tenantId, String shareId, RequestOptions requestOptions) {
+ return archive(tenantId, shareId, ArchiveSharesRequest.builder().build(), requestOptions);
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CloudPDFClientHttpResponse archive(
+ String tenantId, String shareId, ArchiveSharesRequest request) {
+ return archive(tenantId, shareId, request, null);
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public CloudPDFClientHttpResponse archive(
+ String tenantId, String shareId, ArchiveSharesRequest request, RequestOptions requestOptions) {
+ HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
+ .newBuilder()
+ .addPathSegments("v1/tenants")
+ .addPathSegment(tenantId)
+ .addPathSegments("shares")
+ .addPathSegment(shareId)
+ .addPathSegments("archive");
+ if (requestOptions != null) {
+ requestOptions.getQueryParameters().forEach((_key, _value) -> {
+ httpUrl.addQueryParameter(_key, _value);
+ });
+ }
+ Request.Builder _requestBuilder = new Request.Builder()
+ .url(httpUrl.build())
+ .method("POST", RequestBody.create("", null))
+ .headers(Headers.of(clientOptions.headers(requestOptions)))
+ .addHeader("Accept", "application/json");
+ 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, SharesArchive200Response.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
diff --git a/src/main/java/api/resources/shares/SharesClient.java b/src/main/java/api/resources/shares/SharesClient.java
index 8774320..82a0c24 100644
--- a/src/main/java/api/resources/shares/SharesClient.java
+++ b/src/main/java/api/resources/shares/SharesClient.java
@@ -5,26 +5,34 @@
import com.cloudpdf.api.core.ClientOptions;
import com.cloudpdf.api.core.RequestOptions;
+import com.cloudpdf.api.core.Suppliers;
+import com.cloudpdf.api.resources.shares.requests.ArchiveSharesRequest;
import com.cloudpdf.api.resources.shares.requests.DeleteSharesRequest;
import com.cloudpdf.api.resources.shares.requests.GetSharesRequest;
import com.cloudpdf.api.resources.shares.requests.ListSharesRequest;
import com.cloudpdf.api.resources.shares.requests.SharesCreateRequest;
import com.cloudpdf.api.resources.shares.requests.SharesExchangeRequest;
import com.cloudpdf.api.resources.shares.requests.SharesUpdateRequest;
+import com.cloudpdf.api.resources.shares.visitors.VisitorsClient;
+import com.cloudpdf.api.types.SharesArchive200Response;
import com.cloudpdf.api.types.SharesCreate200Response;
import com.cloudpdf.api.types.SharesExchange200Response;
import com.cloudpdf.api.types.SharesGet200Response;
import com.cloudpdf.api.types.SharesList200Response;
import com.cloudpdf.api.types.SharesUpdate200Response;
+import java.util.function.Supplier;
public class SharesClient {
protected final ClientOptions clientOptions;
private final RawSharesClient rawClient;
+ protected final Supplier visitorsClient;
+
public SharesClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawSharesClient(clientOptions);
+ this.visitorsClient = Suppliers.memoize(() -> new VisitorsClient(clientOptions));
}
/**
@@ -35,14 +43,14 @@ public RawSharesClient withRawResponse() {
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public SharesExchange200Response exchange(SharesExchangeRequest request) {
return this.rawClient.exchange(request).body();
}
/**
- * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. Mounted only when the deployment can sign (HS256 mode).
+ * Unauthenticated, but requires a browser Origin header, checked against the grant allowlist. Unknown, revoked, and disabled tokens are indistinguishable (404). Passphrase-protected grants return 422 SharePasswordRequired until password is supplied. A link that asks its visitors who they are on open returns 422 VisitorIdentityRequired until the required answers are given; error.details carries fields (what the link asks), missing, invalid, purpose and privacyUrl. A link that asks before the first change issues the session at once with visitor.identityRequest, and writes answer 403 VisitorIdentityRequired with the same details until the visitor exchanges again with their answers. Answers that can not be taken answer 422 on any link. Mounted only when the deployment can sign (HS256 mode).
*/
public SharesExchange200Response exchange(SharesExchangeRequest request, RequestOptions requestOptions) {
return this.rawClient.exchange(request, requestOptions).body();
@@ -127,4 +135,39 @@ public SharesUpdate200Response update(
String tenantId, String shareId, SharesUpdateRequest request, RequestOptions requestOptions) {
return this.rawClient.update(tenantId, shareId, request, requestOptions).body();
}
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public SharesArchive200Response archive(String tenantId, String shareId) {
+ return this.rawClient.archive(tenantId, shareId).body();
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public SharesArchive200Response archive(String tenantId, String shareId, RequestOptions requestOptions) {
+ return this.rawClient.archive(tenantId, shareId, requestOptions).body();
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public SharesArchive200Response archive(String tenantId, String shareId, ArchiveSharesRequest request) {
+ return this.rawClient.archive(tenantId, shareId, request).body();
+ }
+
+ /**
+ * Archiving is final: an archived link never exchanges again, and to share again you create a new link. Pausing (disabled) is the reversible stop. An archived link no longer counts as using its shared layer, so that layer can be deleted.
+ */
+ public SharesArchive200Response archive(
+ String tenantId, String shareId, ArchiveSharesRequest request, RequestOptions requestOptions) {
+ return this.rawClient
+ .archive(tenantId, shareId, request, requestOptions)
+ .body();
+ }
+
+ public VisitorsClient visitors() {
+ return this.visitorsClient.get();
+ }
}
diff --git a/src/main/java/api/resources/shares/requests/ArchiveSharesRequest.java b/src/main/java/api/resources/shares/requests/ArchiveSharesRequest.java
new file mode 100644
index 0000000..57b1352
--- /dev/null
+++ b/src/main/java/api/resources/shares/requests/ArchiveSharesRequest.java
@@ -0,0 +1,69 @@
+/**
+ * This file was auto-generated by Fern from our API Definition.
+ */
+package com.cloudpdf.api.resources.shares.requests;
+
+import com.cloudpdf.api.core.ObjectMappers;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+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;
+
+@JsonInclude(JsonInclude.Include.NON_ABSENT)
+@JsonDeserialize(builder = ArchiveSharesRequest.Builder.class)
+public final class ArchiveSharesRequest {
+ private final Map additionalProperties;
+
+ private ArchiveSharesRequest(Map additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ @java.lang.Override
+ public boolean equals(Object other) {
+ if (this == other) return true;
+ return other instanceof ArchiveSharesRequest;
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @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 {
+ @JsonAnySetter
+ private Map additionalProperties = new HashMap<>();
+
+ private Builder() {}
+
+ public Builder from(ArchiveSharesRequest other) {
+ return this;
+ }
+
+ public ArchiveSharesRequest build() {
+ return new ArchiveSharesRequest(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/shares/requests/ListSharesRequest.java b/src/main/java/api/resources/shares/requests/ListSharesRequest.java
index 4a828a5..d9c602f 100644
--- a/src/main/java/api/resources/shares/requests/ListSharesRequest.java
+++ b/src/main/java/api/resources/shares/requests/ListSharesRequest.java
@@ -26,16 +26,20 @@ public final class ListSharesRequest {
private final Optional docId;
+ private final Optional archived;
+
private final Map additionalProperties;
private ListSharesRequest(
Optional limit,
Optional cursor,
Optional docId,
+ Optional archived,
Map additionalProperties) {
this.limit = limit;
this.cursor = cursor;
this.docId = docId;
+ this.archived = archived;
this.additionalProperties = additionalProperties;
}
@@ -54,6 +58,11 @@ public Optional getDocId() {
return docId;
}
+ @JsonProperty("archived")
+ public Optional getArchived() {
+ return archived;
+ }
+
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -66,12 +75,15 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(ListSharesRequest other) {
- return limit.equals(other.limit) && cursor.equals(other.cursor) && docId.equals(other.docId);
+ return limit.equals(other.limit)
+ && cursor.equals(other.cursor)
+ && docId.equals(other.docId)
+ && archived.equals(other.archived);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.limit, this.cursor, this.docId);
+ return Objects.hash(this.limit, this.cursor, this.docId, this.archived);
}
@java.lang.Override
@@ -91,6 +103,8 @@ public static final class Builder {
private Optional docId = Optional.empty();
+ private Optional archived = Optional.empty();
+
@JsonAnySetter
private Map additionalProperties = new HashMap<>();
@@ -100,6 +114,7 @@ public Builder from(ListSharesRequest other) {
limit(other.getLimit());
cursor(other.getCursor());
docId(other.getDocId());
+ archived(other.getArchived());
return this;
}
@@ -136,8 +151,19 @@ public Builder docId(String docId) {
return this;
}
+ @JsonSetter(value = "archived", nulls = Nulls.SKIP)
+ public Builder archived(Optional archived) {
+ this.archived = archived;
+ return this;
+ }
+
+ public Builder archived(Boolean archived) {
+ this.archived = Optional.ofNullable(archived);
+ return this;
+ }
+
public ListSharesRequest build() {
- return new ListSharesRequest(limit, cursor, docId, additionalProperties);
+ return new ListSharesRequest(limit, cursor, docId, archived, additionalProperties);
}
public Builder additionalProperty(String key, Object value) {
diff --git a/src/main/java/api/resources/shares/requests/SharesCreateRequest.java b/src/main/java/api/resources/shares/requests/SharesCreateRequest.java
index 80a5541..6beb901 100644
--- a/src/main/java/api/resources/shares/requests/SharesCreateRequest.java
+++ b/src/main/java/api/resources/shares/requests/SharesCreateRequest.java
@@ -3,9 +3,14 @@
*/
package com.cloudpdf.api.resources.shares.requests;
+import com.cloudpdf.api.core.Nullable;
+import com.cloudpdf.api.core.NullableNonemptyFilter;
import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.resources.shares.types.SharesCreateRequestLayerMode;
+import com.cloudpdf.api.resources.shares.types.SharesCreateRequestVisitorIdentity;
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;
@@ -25,8 +30,16 @@
public final class SharesCreateRequest {
private final String docId;
+ private final Optional layerMode;
+
private final Optional layerName;
+ private final Optional keepVisitorLayers;
+
+ private final Optional visitorIdleSeconds;
+
+ private final Optional visitorIdentity;
+
private final List scope;
private final Optional> origins;
@@ -41,7 +54,11 @@ public final class SharesCreateRequest {
private SharesCreateRequest(
String docId,
+ Optional layerMode,
Optional layerName,
+ Optional keepVisitorLayers,
+ Optional visitorIdleSeconds,
+ Optional visitorIdentity,
List scope,
Optional> origins,
Optional password,
@@ -49,7 +66,11 @@ private SharesCreateRequest(
Optional expiresAt,
Map additionalProperties) {
this.docId = docId;
+ this.layerMode = layerMode;
this.layerName = layerName;
+ this.keepVisitorLayers = keepVisitorLayers;
+ this.visitorIdleSeconds = visitorIdleSeconds;
+ this.visitorIdentity = visitorIdentity;
this.scope = scope;
this.origins = origins;
this.password = password;
@@ -63,11 +84,37 @@ public String getDocId() {
return docId;
}
+ @JsonProperty("layerMode")
+ public Optional getLayerMode() {
+ return layerMode;
+ }
+
@JsonProperty("layerName")
public Optional getLayerName() {
return layerName;
}
+ @JsonProperty("keepVisitorLayers")
+ public Optional getKeepVisitorLayers() {
+ return keepVisitorLayers;
+ }
+
+ @JsonIgnore
+ public Optional getVisitorIdleSeconds() {
+ if (visitorIdleSeconds == null) {
+ return Optional.empty();
+ }
+ return visitorIdleSeconds;
+ }
+
+ @JsonIgnore
+ public Optional getVisitorIdentity() {
+ if (visitorIdentity == null) {
+ return Optional.empty();
+ }
+ return visitorIdentity;
+ }
+
@JsonProperty("scope")
public List getScope() {
return scope;
@@ -93,6 +140,18 @@ public Optional getExpiresAt() {
return expiresAt;
}
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("visitorIdleSeconds")
+ private Optional _getVisitorIdleSeconds() {
+ return visitorIdleSeconds;
+ }
+
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("visitorIdentity")
+ private Optional _getVisitorIdentity() {
+ return visitorIdentity;
+ }
+
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -106,7 +165,11 @@ public Map getAdditionalProperties() {
private boolean equalTo(SharesCreateRequest other) {
return docId.equals(other.docId)
+ && layerMode.equals(other.layerMode)
&& layerName.equals(other.layerName)
+ && keepVisitorLayers.equals(other.keepVisitorLayers)
+ && visitorIdleSeconds.equals(other.visitorIdleSeconds)
+ && visitorIdentity.equals(other.visitorIdentity)
&& scope.equals(other.scope)
&& origins.equals(other.origins)
&& password.equals(other.password)
@@ -118,7 +181,11 @@ private boolean equalTo(SharesCreateRequest other) {
public int hashCode() {
return Objects.hash(
this.docId,
+ this.layerMode,
this.layerName,
+ this.keepVisitorLayers,
+ this.visitorIdleSeconds,
+ this.visitorIdentity,
this.scope,
this.origins,
this.password,
@@ -148,10 +215,30 @@ public interface _FinalStage {
_FinalStage additionalProperties(Map additionalProperties);
+ _FinalStage layerMode(Optional layerMode);
+
+ _FinalStage layerMode(SharesCreateRequestLayerMode layerMode);
+
_FinalStage layerName(Optional layerName);
_FinalStage layerName(String layerName);
+ _FinalStage keepVisitorLayers(Optional keepVisitorLayers);
+
+ _FinalStage keepVisitorLayers(Boolean keepVisitorLayers);
+
+ _FinalStage visitorIdleSeconds(Optional visitorIdleSeconds);
+
+ _FinalStage visitorIdleSeconds(Integer visitorIdleSeconds);
+
+ _FinalStage visitorIdleSeconds(Nullable visitorIdleSeconds);
+
+ _FinalStage visitorIdentity(Optional visitorIdentity);
+
+ _FinalStage visitorIdentity(SharesCreateRequestVisitorIdentity visitorIdentity);
+
+ _FinalStage visitorIdentity(Nullable visitorIdentity);
+
_FinalStage scope(List scope);
_FinalStage addScope(String scope);
@@ -189,8 +276,16 @@ public static final class Builder implements DocIdStage, _FinalStage {
private List scope = new ArrayList<>();
+ private Optional visitorIdentity = Optional.empty();
+
+ private Optional visitorIdleSeconds = Optional.empty();
+
+ private Optional keepVisitorLayers = Optional.empty();
+
private Optional layerName = Optional.empty();
+ private Optional layerMode = Optional.empty();
+
@JsonAnySetter
private Map additionalProperties = new HashMap<>();
@@ -199,7 +294,11 @@ private Builder() {}
@java.lang.Override
public Builder from(SharesCreateRequest other) {
docId(other.getDocId());
+ layerMode(other.getLayerMode());
layerName(other.getLayerName());
+ keepVisitorLayers(other.getKeepVisitorLayers());
+ visitorIdleSeconds(other.getVisitorIdleSeconds());
+ visitorIdentity(other.getVisitorIdentity());
scope(other.getScope());
origins(other.getOrigins());
password(other.getPassword());
@@ -291,6 +390,69 @@ public _FinalStage scope(List scope) {
return this;
}
+ @java.lang.Override
+ public _FinalStage visitorIdentity(Nullable visitorIdentity) {
+ if (visitorIdentity.isNull()) {
+ this.visitorIdentity = null;
+ } else if (visitorIdentity.isEmpty()) {
+ this.visitorIdentity = Optional.empty();
+ } else {
+ this.visitorIdentity = Optional.of(visitorIdentity.get());
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage visitorIdentity(SharesCreateRequestVisitorIdentity visitorIdentity) {
+ this.visitorIdentity = Optional.ofNullable(visitorIdentity);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "visitorIdentity", nulls = Nulls.SKIP)
+ public _FinalStage visitorIdentity(Optional visitorIdentity) {
+ this.visitorIdentity = visitorIdentity;
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage visitorIdleSeconds(Nullable visitorIdleSeconds) {
+ if (visitorIdleSeconds.isNull()) {
+ this.visitorIdleSeconds = null;
+ } else if (visitorIdleSeconds.isEmpty()) {
+ this.visitorIdleSeconds = Optional.empty();
+ } else {
+ this.visitorIdleSeconds = Optional.of(visitorIdleSeconds.get());
+ }
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage visitorIdleSeconds(Integer visitorIdleSeconds) {
+ this.visitorIdleSeconds = Optional.ofNullable(visitorIdleSeconds);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "visitorIdleSeconds", nulls = Nulls.SKIP)
+ public _FinalStage visitorIdleSeconds(Optional visitorIdleSeconds) {
+ this.visitorIdleSeconds = visitorIdleSeconds;
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage keepVisitorLayers(Boolean keepVisitorLayers) {
+ this.keepVisitorLayers = Optional.ofNullable(keepVisitorLayers);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "keepVisitorLayers", nulls = Nulls.SKIP)
+ public _FinalStage keepVisitorLayers(Optional keepVisitorLayers) {
+ this.keepVisitorLayers = keepVisitorLayers;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage layerName(String layerName) {
this.layerName = Optional.ofNullable(layerName);
@@ -304,10 +466,34 @@ public _FinalStage layerName(Optional layerName) {
return this;
}
+ @java.lang.Override
+ public _FinalStage layerMode(SharesCreateRequestLayerMode layerMode) {
+ this.layerMode = Optional.ofNullable(layerMode);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "layerMode", nulls = Nulls.SKIP)
+ public _FinalStage layerMode(Optional layerMode) {
+ this.layerMode = layerMode;
+ return this;
+ }
+
@java.lang.Override
public SharesCreateRequest build() {
return new SharesCreateRequest(
- docId, layerName, scope, origins, password, sessionTtlSeconds, expiresAt, additionalProperties);
+ docId,
+ layerMode,
+ layerName,
+ keepVisitorLayers,
+ visitorIdleSeconds,
+ visitorIdentity,
+ scope,
+ origins,
+ password,
+ sessionTtlSeconds,
+ expiresAt,
+ additionalProperties);
}
@java.lang.Override
diff --git a/src/main/java/api/resources/shares/requests/SharesExchangeRequest.java b/src/main/java/api/resources/shares/requests/SharesExchangeRequest.java
index 6598034..08a53f3 100644
--- a/src/main/java/api/resources/shares/requests/SharesExchangeRequest.java
+++ b/src/main/java/api/resources/shares/requests/SharesExchangeRequest.java
@@ -4,6 +4,7 @@
package com.cloudpdf.api.resources.shares.requests;
import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.resources.shares.types.SharesExchangeRequestVisitorIdentity;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -25,12 +26,26 @@ public final class SharesExchangeRequest {
private final Optional password;
+ private final Optional visitorHandle;
+
+ private final Optional restart;
+
+ private final Optional visitorIdentity;
+
private final Map additionalProperties;
private SharesExchangeRequest(
- String shareToken, Optional password, Map additionalProperties) {
+ String shareToken,
+ Optional password,
+ Optional visitorHandle,
+ Optional restart,
+ Optional visitorIdentity,
+ Map additionalProperties) {
this.shareToken = shareToken;
this.password = password;
+ this.visitorHandle = visitorHandle;
+ this.restart = restart;
+ this.visitorIdentity = visitorIdentity;
this.additionalProperties = additionalProperties;
}
@@ -44,6 +59,21 @@ public Optional getPassword() {
return password;
}
+ @JsonProperty("visitorHandle")
+ public Optional getVisitorHandle() {
+ return visitorHandle;
+ }
+
+ @JsonProperty("restart")
+ public Optional getRestart() {
+ return restart;
+ }
+
+ @JsonProperty("visitorIdentity")
+ public Optional getVisitorIdentity() {
+ return visitorIdentity;
+ }
+
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
@@ -56,12 +86,16 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(SharesExchangeRequest other) {
- return shareToken.equals(other.shareToken) && password.equals(other.password);
+ return shareToken.equals(other.shareToken)
+ && password.equals(other.password)
+ && visitorHandle.equals(other.visitorHandle)
+ && restart.equals(other.restart)
+ && visitorIdentity.equals(other.visitorIdentity);
}
@java.lang.Override
public int hashCode() {
- return Objects.hash(this.shareToken, this.password);
+ return Objects.hash(this.shareToken, this.password, this.visitorHandle, this.restart, this.visitorIdentity);
}
@java.lang.Override
@@ -89,12 +123,30 @@ public interface _FinalStage {
_FinalStage password(Optional password);
_FinalStage password(String password);
+
+ _FinalStage visitorHandle(Optional visitorHandle);
+
+ _FinalStage visitorHandle(String visitorHandle);
+
+ _FinalStage restart(Optional restart);
+
+ _FinalStage restart(Boolean restart);
+
+ _FinalStage visitorIdentity(Optional visitorIdentity);
+
+ _FinalStage visitorIdentity(SharesExchangeRequestVisitorIdentity visitorIdentity);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ShareTokenStage, _FinalStage {
private String shareToken;
+ private Optional visitorIdentity = Optional.empty();
+
+ private Optional restart = Optional.empty();
+
+ private Optional visitorHandle = Optional.empty();
+
private Optional password = Optional.empty();
@JsonAnySetter
@@ -106,6 +158,9 @@ private Builder() {}
public Builder from(SharesExchangeRequest other) {
shareToken(other.getShareToken());
password(other.getPassword());
+ visitorHandle(other.getVisitorHandle());
+ restart(other.getRestart());
+ visitorIdentity(other.getVisitorIdentity());
return this;
}
@@ -116,6 +171,45 @@ public _FinalStage shareToken(@NotNull String shareToken) {
return this;
}
+ @java.lang.Override
+ public _FinalStage visitorIdentity(SharesExchangeRequestVisitorIdentity visitorIdentity) {
+ this.visitorIdentity = Optional.ofNullable(visitorIdentity);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "visitorIdentity", nulls = Nulls.SKIP)
+ public _FinalStage visitorIdentity(Optional visitorIdentity) {
+ this.visitorIdentity = visitorIdentity;
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage restart(Boolean restart) {
+ this.restart = Optional.ofNullable(restart);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "restart", nulls = Nulls.SKIP)
+ public _FinalStage restart(Optional restart) {
+ this.restart = restart;
+ return this;
+ }
+
+ @java.lang.Override
+ public _FinalStage visitorHandle(String visitorHandle) {
+ this.visitorHandle = Optional.ofNullable(visitorHandle);
+ return this;
+ }
+
+ @java.lang.Override
+ @JsonSetter(value = "visitorHandle", nulls = Nulls.SKIP)
+ public _FinalStage visitorHandle(Optional visitorHandle) {
+ this.visitorHandle = visitorHandle;
+ return this;
+ }
+
@java.lang.Override
public _FinalStage password(String password) {
this.password = Optional.ofNullable(password);
@@ -131,7 +225,8 @@ public _FinalStage password(Optional password) {
@java.lang.Override
public SharesExchangeRequest build() {
- return new SharesExchangeRequest(shareToken, password, additionalProperties);
+ return new SharesExchangeRequest(
+ shareToken, password, visitorHandle, restart, visitorIdentity, additionalProperties);
}
@java.lang.Override
diff --git a/src/main/java/api/resources/shares/requests/SharesUpdateRequest.java b/src/main/java/api/resources/shares/requests/SharesUpdateRequest.java
index 8890209..0954c52 100644
--- a/src/main/java/api/resources/shares/requests/SharesUpdateRequest.java
+++ b/src/main/java/api/resources/shares/requests/SharesUpdateRequest.java
@@ -6,6 +6,8 @@
import com.cloudpdf.api.core.Nullable;
import com.cloudpdf.api.core.NullableNonemptyFilter;
import com.cloudpdf.api.core.ObjectMappers;
+import com.cloudpdf.api.resources.shares.types.SharesUpdateRequestLayerMode;
+import com.cloudpdf.api.resources.shares.types.SharesUpdateRequestVisitorIdentity;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -24,6 +26,16 @@
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = SharesUpdateRequest.Builder.class)
public final class SharesUpdateRequest {
+ private final Optional layerMode;
+
+ private final Optional layerName;
+
+ private final Optional keepVisitorLayers;
+
+ private final Optional visitorIdleSeconds;
+
+ private final Optional visitorIdentity;
+
private final Optional> scope;
private final Optional> origins;
@@ -39,6 +51,11 @@ public final class SharesUpdateRequest {
private final Map additionalProperties;
private SharesUpdateRequest(
+ Optional layerMode,
+ Optional layerName,
+ Optional keepVisitorLayers,
+ Optional visitorIdleSeconds,
+ Optional visitorIdentity,
Optional> scope,
Optional> origins,
Optional password,
@@ -46,6 +63,11 @@ private SharesUpdateRequest(
Optional disabled,
Optional expiresAt,
Map additionalProperties) {
+ this.layerMode = layerMode;
+ this.layerName = layerName;
+ this.keepVisitorLayers = keepVisitorLayers;
+ this.visitorIdleSeconds = visitorIdleSeconds;
+ this.visitorIdentity = visitorIdentity;
this.scope = scope;
this.origins = origins;
this.password = password;
@@ -55,6 +77,37 @@ private SharesUpdateRequest(
this.additionalProperties = additionalProperties;
}
+ @JsonProperty("layerMode")
+ public Optional getLayerMode() {
+ return layerMode;
+ }
+
+ @JsonProperty("layerName")
+ public Optional getLayerName() {
+ return layerName;
+ }
+
+ @JsonProperty("keepVisitorLayers")
+ public Optional getKeepVisitorLayers() {
+ return keepVisitorLayers;
+ }
+
+ @JsonIgnore
+ public Optional getVisitorIdleSeconds() {
+ if (visitorIdleSeconds == null) {
+ return Optional.empty();
+ }
+ return visitorIdleSeconds;
+ }
+
+ @JsonIgnore
+ public Optional getVisitorIdentity() {
+ if (visitorIdentity == null) {
+ return Optional.empty();
+ }
+ return visitorIdentity;
+ }
+
@JsonProperty("scope")
public Optional> getScope() {
return scope;
@@ -94,6 +147,18 @@ public Optional getExpiresAt() {
return expiresAt;
}
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("visitorIdleSeconds")
+ private Optional _getVisitorIdleSeconds() {
+ return visitorIdleSeconds;
+ }
+
+ @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
+ @JsonProperty("visitorIdentity")
+ private Optional _getVisitorIdentity() {
+ return visitorIdentity;
+ }
+
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class)
@JsonProperty("origins")
private Optional> _getOrigins() {
@@ -124,7 +189,12 @@ public Map getAdditionalProperties() {
}
private boolean equalTo(SharesUpdateRequest other) {
- return scope.equals(other.scope)
+ return layerMode.equals(other.layerMode)
+ && layerName.equals(other.layerName)
+ && keepVisitorLayers.equals(other.keepVisitorLayers)
+ && visitorIdleSeconds.equals(other.visitorIdleSeconds)
+ && visitorIdentity.equals(other.visitorIdentity)
+ && scope.equals(other.scope)
&& origins.equals(other.origins)
&& password.equals(other.password)
&& sessionTtlSeconds.equals(other.sessionTtlSeconds)
@@ -135,7 +205,17 @@ private boolean equalTo(SharesUpdateRequest other) {
@java.lang.Override
public int hashCode() {
return Objects.hash(
- this.scope, this.origins, this.password, this.sessionTtlSeconds, this.disabled, this.expiresAt);
+ this.layerMode,
+ this.layerName,
+ this.keepVisitorLayers,
+ this.visitorIdleSeconds,
+ this.visitorIdentity,
+ this.scope,
+ this.origins,
+ this.password,
+ this.sessionTtlSeconds,
+ this.disabled,
+ this.expiresAt);
}
@java.lang.Override
@@ -149,6 +229,16 @@ public static Builder builder() {
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
+ private Optional layerMode = Optional.empty();
+
+ private Optional layerName = Optional.empty();
+
+ private Optional keepVisitorLayers = Optional.empty();
+
+ private Optional visitorIdleSeconds = Optional.empty();
+
+ private Optional visitorIdentity = Optional.empty();
+
private Optional> scope = Optional.empty();
private Optional> origins = Optional.empty();
@@ -167,6 +257,11 @@ public static final class Builder {
private Builder() {}
public Builder from(SharesUpdateRequest other) {
+ layerMode(other.getLayerMode());
+ layerName(other.getLayerName());
+ keepVisitorLayers(other.getKeepVisitorLayers());
+ visitorIdleSeconds(other.getVisitorIdleSeconds());
+ visitorIdentity(other.getVisitorIdentity());
scope(other.getScope());
origins(other.getOrigins());
password(other.getPassword());
@@ -176,6 +271,83 @@ public Builder from(SharesUpdateRequest other) {
return this;
}
+ @JsonSetter(value = "layerMode", nulls = Nulls.SKIP)
+ public Builder layerMode(Optional