diff --git a/.fern/metadata.json b/.fern/metadata.json index ec024f1..0d9886f 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": "e074ee8465006a168ff6d8cfa73928df13ae159c", + "originGitCommit": "4b156274cbffac1a19f266d36d27b4ed07bf2b53", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.2.0", + "requestedVersion": "3.3.0", "ciProvider": "github" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index bc888d6..45f6f60 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,7 @@ java { group = 'com.cloudpdf' -version = '3.2.0' +version = '3.3.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -73,7 +73,7 @@ publishing { maven(MavenPublication) { groupId = 'com.cloudpdf' artifactId = 'sdk' - version = '3.2.0' + version = '3.3.0' from components.java pom { name = 'CloudPDF' diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 5e52825..e404c79 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "java", - "canonicalVersion": "3.2.0", - "sdkVersion": "3.2.0", + "canonicalVersion": "3.3.0", + "sdkVersion": "3.3.0", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "92b335b44d0957c70139f64ee3dd92e19d9d3a1452c90077002ed31dbddc3e7d", - "gitCommit": "e074ee8465006a168ff6d8cfa73928df13ae159c", + "openapiSha256": "8d6fda1d157a3f3f82d3a16835381932eaa6efe3054100bb0aa63c0ad5ac6909", + "gitCommit": "4b156274cbffac1a19f266d36d27b4ed07bf2b53", "gitCommitIsDirty": false }, "fern": { diff --git a/reference.md b/reference.md index d71b9fb..4608c17 100644 --- a/reference.md +++ b/reference.md @@ -6082,7 +6082,7 @@ client.doc().signatures().analysis(
-Multipart: a JSON `body` part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as `resources: { appearance: '' }`, and that PDF as the part `resource:`. A certification (`certify.permission`) additionally requires `doc.sign.certify`. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. +Multipart: a JSON `body` part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as `resources: { appearance: '' }`, and that PDF as the part `resource:`. A certification (`certify.permission`) additionally requires `doc.sign.certify`. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (`kind: 'timestamp'`) may leave `field` out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in `field`. That needs `doc.sign` for the document. The signature is made over the layer's own base: the upload, or the version its last signature made.
@@ -6143,6 +6143,190 @@ client.doc().signatures().prepare( + + + + +
client.doc.signatures.validationInfo(docId, layerName) -> DocSignaturesValidationInfoResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.doc().signatures().validationInfo( + "docId", + "layerName", + ValidationInfoSignaturesRequest + .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. + +
+
+
+
+ + +
+
+
+ +
client.doc.signatures.addValidationInfo(docId, layerName, request) -> DocSignaturesAddValidationInfoResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: `added` counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in `certificates[1]`. The server stores what it is given and asks no certificate authority: collect the answers first. It needs `doc.sign` for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.doc().signatures().addValidationInfo( + "docId", + "layerName", + DocSignaturesAddValidationInfoRequest + .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. + +
+
+ +
+
+ +**idempotencyKey:** `Optional` — Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. + +
+
+ +
+
+ +**certificates:** `Optional>` + +
+
+ +
+
+ +**ocspResponses:** `Optional>` + +
+
+ +
+
+ +**crls:** `Optional>` + +
+
+
+
+ +
@@ -6236,7 +6420,7 @@ client.doc().versions().list(
-Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. +Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with `engine`, the `analysis` value of the layer's head, a settled answer is `immutable`. Without it, or with another value, the answer is this server's own, with `no-store` and the current value in `EmbedPDF-Engine`.
@@ -6329,7 +6513,7 @@ client.doc().versions().analysis(
-**policy:** `Optional` +**engine:** `Optional` — The `analysis` engine value from the layer's head (`engine.analysis`): the rules the answer is judged with. With it, a settled answer is cached.
@@ -6504,6 +6688,20 @@ client.doc().versions().revision(
+#### 📝 Description + +
+
+ +
+
+ +A version never changes, but what the server reads from it can: with `engine`, the `signatures` value of the layer's head, the answer is `immutable`. Without it, or with another value, the answer is this server's own, with `no-store` and the current value in `EmbedPDF-Engine`. +
+
+
+
+ #### 🔌 Usage
@@ -6559,6 +6757,14 @@ client.doc().versions().signatures(
+**engine:** `Optional` — The `signatures` engine value from the layer's head (`engine.signatures`): what the answer is computed with besides the file. With it, the answer is cached. + +
+
+ +
+
+ **documentPassword:** `Optional` — Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.
diff --git a/src/main/java/api/AsyncCloudPDFClientBuilder.java b/src/main/java/api/AsyncCloudPDFClientBuilder.java index bf3d15c..5d2a0d9 100644 --- a/src/main/java/api/AsyncCloudPDFClientBuilder.java +++ b/src/main/java/api/AsyncCloudPDFClientBuilder.java @@ -26,7 +26,7 @@ public class AsyncCloudPDFClientBuilder { private String token = null; - private String embedPdfVersion = "3.2"; + private String embedPdfVersion = "3.3"; private Environment environment = Environment.SAAS; diff --git a/src/main/java/api/CloudPDFClientBuilder.java b/src/main/java/api/CloudPDFClientBuilder.java index 01a7ca0..fc2c4a3 100644 --- a/src/main/java/api/CloudPDFClientBuilder.java +++ b/src/main/java/api/CloudPDFClientBuilder.java @@ -26,7 +26,7 @@ public class CloudPDFClientBuilder { private String token = null; - private String embedPdfVersion = "3.2"; + private String embedPdfVersion = "3.3"; private Environment environment = Environment.SAAS; diff --git a/src/main/java/api/core/ClientOptions.java b/src/main/java/api/core/ClientOptions.java index 0d28422..931f3ce 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.2.0"); + put("X-Fern-SDK-Version", "3.3.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/api/resources/doc/signatures/AsyncRawSignaturesClient.java b/src/main/java/api/resources/doc/signatures/AsyncRawSignaturesClient.java index 0a67a64..f3e7f45 100644 --- a/src/main/java/api/resources/doc/signatures/AsyncRawSignaturesClient.java +++ b/src/main/java/api/resources/doc/signatures/AsyncRawSignaturesClient.java @@ -18,14 +18,18 @@ import com.cloudpdf.api.errors.NotFoundError; import com.cloudpdf.api.resources.doc.signatures.requests.AnalysisSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.CancelSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesAddValidationInfoRequest; import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesCompleteRequest; import com.cloudpdf.api.resources.doc.signatures.requests.ListSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.PrepareSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.ValidationInfoSignaturesRequest; +import com.cloudpdf.api.types.DocSignaturesAddValidationInfoResponse; import com.cloudpdf.api.types.DocSignaturesAnalysisResponse; import com.cloudpdf.api.types.DocSignaturesCancelResponse; import com.cloudpdf.api.types.DocSignaturesCompleteResponse; import com.cloudpdf.api.types.DocSignaturesListResponse; import com.cloudpdf.api.types.DocSignaturesPrepareResponse; +import com.cloudpdf.api.types.DocSignaturesValidationInfoResponse; import com.cloudpdf.api.types.ErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; import java.io.File; @@ -505,7 +509,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CompletableFuture> prepare( String docId, String layerName, File file, PrepareSignaturesRequest request) { @@ -513,7 +517,7 @@ public CompletableFuturebody part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CompletableFuture> prepare( String docId, @@ -954,4 +958,257 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture> validationInfo( + String docId, String layerName) { + return validationInfo( + docId, layerName, ValidationInfoSignaturesRequest.builder().build()); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture> validationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return validationInfo( + docId, layerName, ValidationInfoSignaturesRequest.builder().build(), requestOptions); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture> validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request) { + return validationInfo(docId, layerName, request, null); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture> validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/docs") + .addPathSegment(docId) + .addPathSegments("layers") + .addPathSegment(layerName) + .addPathSegments("signatures") + .addPathSegments("validation-info"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + if (request.getDocumentPassword().isPresent()) { + _requestBuilder.addHeader( + "X-Document-Password", request.getDocumentPassword().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new CloudPDFClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DocSignaturesValidationInfoResponse.class), + response)); + return; + } + try { + if (response.code() == 404) { + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.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; + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture> addValidationInfo( + String docId, String layerName) { + return addValidationInfo( + docId, + layerName, + DocSignaturesAddValidationInfoRequest.builder().build()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture> addValidationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return addValidationInfo( + docId, + layerName, + DocSignaturesAddValidationInfoRequest.builder().build(), + requestOptions); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture> addValidationInfo( + String docId, String layerName, DocSignaturesAddValidationInfoRequest request) { + return addValidationInfo(docId, layerName, request, null); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture> addValidationInfo( + String docId, + String layerName, + DocSignaturesAddValidationInfoRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/docs") + .addPathSegment(docId) + .addPathSegments("layers") + .addPathSegment(layerName) + .addPathSegments("signatures") + .addPathSegments("validation-info"); + 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()); + } + if (request.getIdempotencyKey().isPresent()) { + _requestBuilder.addHeader( + "Idempotency-Key", request.getIdempotencyKey().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, DocSignaturesAddValidationInfoResponse.class), + response)); + return; + } + try { + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + case 409: + future.completeExceptionally(new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new CloudPDFApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new CloudPDFException("Network error executing HTTP request", e)); + } + }); + return future; + } } diff --git a/src/main/java/api/resources/doc/signatures/AsyncSignaturesClient.java b/src/main/java/api/resources/doc/signatures/AsyncSignaturesClient.java index f690596..f8adc85 100644 --- a/src/main/java/api/resources/doc/signatures/AsyncSignaturesClient.java +++ b/src/main/java/api/resources/doc/signatures/AsyncSignaturesClient.java @@ -7,14 +7,18 @@ import com.cloudpdf.api.core.RequestOptions; import com.cloudpdf.api.resources.doc.signatures.requests.AnalysisSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.CancelSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesAddValidationInfoRequest; import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesCompleteRequest; import com.cloudpdf.api.resources.doc.signatures.requests.ListSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.PrepareSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.ValidationInfoSignaturesRequest; +import com.cloudpdf.api.types.DocSignaturesAddValidationInfoResponse; import com.cloudpdf.api.types.DocSignaturesAnalysisResponse; import com.cloudpdf.api.types.DocSignaturesCancelResponse; import com.cloudpdf.api.types.DocSignaturesCompleteResponse; import com.cloudpdf.api.types.DocSignaturesListResponse; import com.cloudpdf.api.types.DocSignaturesPrepareResponse; +import com.cloudpdf.api.types.DocSignaturesValidationInfoResponse; import java.io.File; import java.io.InputStream; import java.util.concurrent.CompletableFuture; @@ -151,7 +155,7 @@ public CompletableFuture analysis( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CompletableFuture prepare( String docId, String layerName, File file, PrepareSignaturesRequest request) { @@ -159,7 +163,7 @@ public CompletableFuture prepare( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CompletableFuture prepare( String docId, @@ -202,4 +206,75 @@ public CompletableFuture prepare( .prepare(docId, layerName, stream, filename, mediaType, requestOptions) .thenApply(response -> response.body()); } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture validationInfo(String docId, String layerName) { + return this.rawClient.validationInfo(docId, layerName).thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture validationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return this.rawClient.validationInfo(docId, layerName, requestOptions).thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request) { + return this.rawClient.validationInfo(docId, layerName, request).thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CompletableFuture validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request, RequestOptions requestOptions) { + return this.rawClient + .validationInfo(docId, layerName, request, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture addValidationInfo(String docId, String layerName) { + return this.rawClient.addValidationInfo(docId, layerName).thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture addValidationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return this.rawClient + .addValidationInfo(docId, layerName, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture addValidationInfo( + String docId, String layerName, DocSignaturesAddValidationInfoRequest request) { + return this.rawClient.addValidationInfo(docId, layerName, request).thenApply(response -> response.body()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CompletableFuture addValidationInfo( + String docId, + String layerName, + DocSignaturesAddValidationInfoRequest request, + RequestOptions requestOptions) { + return this.rawClient + .addValidationInfo(docId, layerName, request, requestOptions) + .thenApply(response -> response.body()); + } } diff --git a/src/main/java/api/resources/doc/signatures/RawSignaturesClient.java b/src/main/java/api/resources/doc/signatures/RawSignaturesClient.java index 6f2d93c..30074f7 100644 --- a/src/main/java/api/resources/doc/signatures/RawSignaturesClient.java +++ b/src/main/java/api/resources/doc/signatures/RawSignaturesClient.java @@ -18,14 +18,18 @@ import com.cloudpdf.api.errors.NotFoundError; import com.cloudpdf.api.resources.doc.signatures.requests.AnalysisSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.CancelSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesAddValidationInfoRequest; import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesCompleteRequest; import com.cloudpdf.api.resources.doc.signatures.requests.ListSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.PrepareSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.ValidationInfoSignaturesRequest; +import com.cloudpdf.api.types.DocSignaturesAddValidationInfoResponse; import com.cloudpdf.api.types.DocSignaturesAnalysisResponse; import com.cloudpdf.api.types.DocSignaturesCancelResponse; import com.cloudpdf.api.types.DocSignaturesCompleteResponse; import com.cloudpdf.api.types.DocSignaturesListResponse; import com.cloudpdf.api.types.DocSignaturesPrepareResponse; +import com.cloudpdf.api.types.DocSignaturesValidationInfoResponse; import com.cloudpdf.api.types.ErrorResponse; import com.fasterxml.jackson.core.JsonProcessingException; import java.io.File; @@ -425,7 +429,7 @@ public CloudPDFClientHttpResponse analysis( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CloudPDFClientHttpResponse prepare( String docId, String layerName, File file, PrepareSignaturesRequest request) { @@ -433,7 +437,7 @@ public CloudPDFClientHttpResponse prepare( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public CloudPDFClientHttpResponse prepare( String docId, @@ -769,4 +773,219 @@ public CloudPDFClientHttpResponse prepare( throw new CloudPDFException("Network error executing HTTP request", e); } } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse validationInfo( + String docId, String layerName) { + return validationInfo( + docId, layerName, ValidationInfoSignaturesRequest.builder().build()); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse validationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return validationInfo( + docId, layerName, ValidationInfoSignaturesRequest.builder().build(), requestOptions); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request) { + return validationInfo(docId, layerName, request, null); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/docs") + .addPathSegment(docId) + .addPathSegments("layers") + .addPathSegment(layerName) + .addPathSegments("signatures") + .addPathSegments("validation-info"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + if (request.getDocumentPassword().isPresent()) { + _requestBuilder.addHeader( + "X-Document-Password", request.getDocumentPassword().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new CloudPDFClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DocSignaturesValidationInfoResponse.class), + response); + } + try { + if (response.code() == 404) { + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.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); + } + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse addValidationInfo( + String docId, String layerName) { + return addValidationInfo( + docId, + layerName, + DocSignaturesAddValidationInfoRequest.builder().build()); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse addValidationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return addValidationInfo( + docId, + layerName, + DocSignaturesAddValidationInfoRequest.builder().build(), + requestOptions); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse addValidationInfo( + String docId, String layerName, DocSignaturesAddValidationInfoRequest request) { + return addValidationInfo(docId, layerName, request, null); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public CloudPDFClientHttpResponse addValidationInfo( + String docId, + String layerName, + DocSignaturesAddValidationInfoRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/docs") + .addPathSegment(docId) + .addPathSegments("layers") + .addPathSegment(layerName) + .addPathSegments("signatures") + .addPathSegments("validation-info"); + 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()); + } + if (request.getIdempotencyKey().isPresent()) { + _requestBuilder.addHeader( + "Idempotency-Key", request.getIdempotencyKey().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, DocSignaturesAddValidationInfoResponse.class), + response); + } + try { + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); + case 409: + throw new ConflictError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new CloudPDFApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CloudPDFException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new CloudPDFException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/api/resources/doc/signatures/SignaturesClient.java b/src/main/java/api/resources/doc/signatures/SignaturesClient.java index 4e543da..0cd7527 100644 --- a/src/main/java/api/resources/doc/signatures/SignaturesClient.java +++ b/src/main/java/api/resources/doc/signatures/SignaturesClient.java @@ -7,14 +7,18 @@ import com.cloudpdf.api.core.RequestOptions; import com.cloudpdf.api.resources.doc.signatures.requests.AnalysisSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.CancelSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesAddValidationInfoRequest; import com.cloudpdf.api.resources.doc.signatures.requests.DocSignaturesCompleteRequest; import com.cloudpdf.api.resources.doc.signatures.requests.ListSignaturesRequest; import com.cloudpdf.api.resources.doc.signatures.requests.PrepareSignaturesRequest; +import com.cloudpdf.api.resources.doc.signatures.requests.ValidationInfoSignaturesRequest; +import com.cloudpdf.api.types.DocSignaturesAddValidationInfoResponse; import com.cloudpdf.api.types.DocSignaturesAnalysisResponse; import com.cloudpdf.api.types.DocSignaturesCancelResponse; import com.cloudpdf.api.types.DocSignaturesCompleteResponse; import com.cloudpdf.api.types.DocSignaturesListResponse; import com.cloudpdf.api.types.DocSignaturesPrepareResponse; +import com.cloudpdf.api.types.DocSignaturesValidationInfoResponse; import java.io.File; import java.io.InputStream; import okhttp3.MediaType; @@ -146,7 +150,7 @@ public DocSignaturesAnalysisResponse analysis( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public DocSignaturesPrepareResponse prepare( String docId, String layerName, File file, PrepareSignaturesRequest request) { @@ -154,7 +158,7 @@ public DocSignaturesPrepareResponse prepare( } /** - * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). The signature is made over the layer's own base: the upload, or the version its last signature made. + * Multipart: a JSON body part (field, subFilter, digest, contentsSize, signer, certify, lock), naming the appearance PDF it may carry as resources: { appearance: '<key>' }, and that PDF as the part resource:<key>. A certification (certify.permission) additionally requires doc.sign.certify. The layer is read-only until the signing completes, is cancelled, or expires (15 minutes). A document timestamp (kind: 'timestamp') may leave field out, since 3.3: the engine then makes a field of no size for it, under a name no other field has, and the answer names it in field. That needs doc.sign for the document. The signature is made over the layer's own base: the upload, or the version its last signature made. */ public DocSignaturesPrepareResponse prepare( String docId, @@ -196,4 +200,75 @@ public DocSignaturesPrepareResponse prepare( .prepare(docId, layerName, stream, filename, mediaType, requestOptions) .body(); } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public DocSignaturesValidationInfoResponse validationInfo(String docId, String layerName) { + return this.rawClient.validationInfo(docId, layerName).body(); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public DocSignaturesValidationInfoResponse validationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return this.rawClient.validationInfo(docId, layerName, requestOptions).body(); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public DocSignaturesValidationInfoResponse validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request) { + return this.rawClient.validationInfo(docId, layerName, request).body(); + } + + /** + * Each entry is one DER object, base64. It reads the layer as it is now, so entries stored and not yet sealed by a signature are among them. Arrived in 3.3. + */ + public DocSignaturesValidationInfoResponse validationInfo( + String docId, String layerName, ValidationInfoSignaturesRequest request, RequestOptions requestOptions) { + return this.rawClient + .validationInfo(docId, layerName, request, requestOptions) + .body(); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public DocSignaturesAddValidationInfoResponse addValidationInfo(String docId, String layerName) { + return this.rawClient.addValidationInfo(docId, layerName).body(); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public DocSignaturesAddValidationInfoResponse addValidationInfo( + String docId, String layerName, RequestOptions requestOptions) { + return this.rawClient + .addValidationInfo(docId, layerName, requestOptions) + .body(); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public DocSignaturesAddValidationInfoResponse addValidationInfo( + String docId, String layerName, DocSignaturesAddValidationInfoRequest request) { + return this.rawClient.addValidationInfo(docId, layerName, request).body(); + } + + /** + * Each entry is one DER object of at most 16 MiB, base64. An entry the file already holds, byte for byte, is not stored again: added counts the new ones. An entry that is not one DER object fails the request and nothing is stored; the error names it, as in certificates[1]. The server stores what it is given and asks no certificate authority: collect the answers first. It needs doc.sign for the document, not for a group of fields, and is refused after a certification that allows no changes. It cannot be undone, and it leaves undo for earlier changes as it was. Arrived in 3.3. + */ + public DocSignaturesAddValidationInfoResponse addValidationInfo( + String docId, + String layerName, + DocSignaturesAddValidationInfoRequest request, + RequestOptions requestOptions) { + return this.rawClient + .addValidationInfo(docId, layerName, request, requestOptions) + .body(); + } } diff --git a/src/main/java/api/resources/doc/signatures/requests/DocSignaturesAddValidationInfoRequest.java b/src/main/java/api/resources/doc/signatures/requests/DocSignaturesAddValidationInfoRequest.java new file mode 100644 index 0000000..96efca0 --- /dev/null +++ b/src/main/java/api/resources/doc/signatures/requests/DocSignaturesAddValidationInfoRequest.java @@ -0,0 +1,218 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cloudpdf.api.resources.doc.signatures.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.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DocSignaturesAddValidationInfoRequest.Builder.class) +public final class DocSignaturesAddValidationInfoRequest { + private final Optional documentPassword; + + private final Optional idempotencyKey; + + private final Optional> certificates; + + private final Optional> ocspResponses; + + private final Optional> crls; + + private final Map additionalProperties; + + private DocSignaturesAddValidationInfoRequest( + Optional documentPassword, + Optional idempotencyKey, + Optional> certificates, + Optional> ocspResponses, + Optional> crls, + Map additionalProperties) { + this.documentPassword = documentPassword; + this.idempotencyKey = idempotencyKey; + this.certificates = certificates; + this.ocspResponses = ocspResponses; + this.crls = crls; + 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; + } + + /** + * @return Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing. + */ + @JsonIgnore + public Optional getIdempotencyKey() { + return idempotencyKey; + } + + @JsonProperty("certificates") + public Optional> getCertificates() { + return certificates; + } + + @JsonProperty("ocspResponses") + public Optional> getOcspResponses() { + return ocspResponses; + } + + @JsonProperty("crls") + public Optional> getCrls() { + return crls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DocSignaturesAddValidationInfoRequest + && equalTo((DocSignaturesAddValidationInfoRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DocSignaturesAddValidationInfoRequest other) { + return documentPassword.equals(other.documentPassword) + && idempotencyKey.equals(other.idempotencyKey) + && certificates.equals(other.certificates) + && ocspResponses.equals(other.ocspResponses) + && crls.equals(other.crls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.documentPassword, this.idempotencyKey, this.certificates, this.ocspResponses, this.crls); + } + + @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 idempotencyKey = Optional.empty(); + + private Optional> certificates = Optional.empty(); + + private Optional> ocspResponses = Optional.empty(); + + private Optional> crls = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DocSignaturesAddValidationInfoRequest other) { + documentPassword(other.getDocumentPassword()); + idempotencyKey(other.getIdempotencyKey()); + certificates(other.getCertificates()); + ocspResponses(other.getOcspResponses()); + crls(other.getCrls()); + 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; + } + + /** + *

Names the change: 1 to 255 printable ASCII characters. A retry under the same key on the same layer answers with what the first request committed, and changes nothing.

+ */ + public Builder idempotencyKey(Optional idempotencyKey) { + this.idempotencyKey = idempotencyKey; + return this; + } + + public Builder idempotencyKey(String idempotencyKey) { + this.idempotencyKey = Optional.ofNullable(idempotencyKey); + return this; + } + + @JsonSetter(value = "certificates", nulls = Nulls.SKIP) + public Builder certificates(Optional> certificates) { + this.certificates = certificates; + return this; + } + + public Builder certificates(List certificates) { + this.certificates = Optional.ofNullable(certificates); + return this; + } + + @JsonSetter(value = "ocspResponses", nulls = Nulls.SKIP) + public Builder ocspResponses(Optional> ocspResponses) { + this.ocspResponses = ocspResponses; + return this; + } + + public Builder ocspResponses(List ocspResponses) { + this.ocspResponses = Optional.ofNullable(ocspResponses); + return this; + } + + @JsonSetter(value = "crls", nulls = Nulls.SKIP) + public Builder crls(Optional> crls) { + this.crls = crls; + return this; + } + + public Builder crls(List crls) { + this.crls = Optional.ofNullable(crls); + return this; + } + + public DocSignaturesAddValidationInfoRequest build() { + return new DocSignaturesAddValidationInfoRequest( + documentPassword, idempotencyKey, certificates, ocspResponses, crls, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/api/resources/doc/signatures/requests/ValidationInfoSignaturesRequest.java b/src/main/java/api/resources/doc/signatures/requests/ValidationInfoSignaturesRequest.java new file mode 100644 index 0000000..0df83ff --- /dev/null +++ b/src/main/java/api/resources/doc/signatures/requests/ValidationInfoSignaturesRequest.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cloudpdf.api.resources.doc.signatures.requests; + +import com.cloudpdf.api.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidationInfoSignaturesRequest.Builder.class) +public final class ValidationInfoSignaturesRequest { + private final Optional documentPassword; + + private final Map additionalProperties; + + private ValidationInfoSignaturesRequest( + Optional documentPassword, Map additionalProperties) { + this.documentPassword = documentPassword; + this.additionalProperties = additionalProperties; + } + + /** + * @return Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead. + */ + @JsonIgnore + public Optional getDocumentPassword() { + return documentPassword; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidationInfoSignaturesRequest && equalTo((ValidationInfoSignaturesRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidationInfoSignaturesRequest other) { + return documentPassword.equals(other.documentPassword); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.documentPassword); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional documentPassword = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ValidationInfoSignaturesRequest other) { + documentPassword(other.getDocumentPassword()); + return this; + } + + /** + *

Base64-encoded password for an encrypted document. Valid only with the API token (403 anywhere else). An encrypted document answers 422 DocPasswordRequired when the header is absent. Viewer doc JWTs use the SDK password-session flow instead.

+ */ + public Builder documentPassword(Optional documentPassword) { + this.documentPassword = documentPassword; + return this; + } + + public Builder documentPassword(String documentPassword) { + this.documentPassword = Optional.ofNullable(documentPassword); + return this; + } + + public ValidationInfoSignaturesRequest build() { + return new ValidationInfoSignaturesRequest(documentPassword, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/api/resources/doc/versions/AsyncRawVersionsClient.java b/src/main/java/api/resources/doc/versions/AsyncRawVersionsClient.java index 8942c4c..f42e66d 100644 --- a/src/main/java/api/resources/doc/versions/AsyncRawVersionsClient.java +++ b/src/main/java/api/resources/doc/versions/AsyncRawVersionsClient.java @@ -153,7 +153,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture> analysis( String docId, String layerName, String sha256) { @@ -162,7 +162,7 @@ public CompletableFuture } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture> analysis( String docId, String layerName, String sha256, RequestOptions requestOptions) { @@ -171,7 +171,7 @@ public CompletableFuture } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture> analysis( String docId, String layerName, String sha256, AnalysisVersionsRequest request) { @@ -179,7 +179,7 @@ public CompletableFuture } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture> analysis( String docId, @@ -211,9 +211,9 @@ public CompletableFuture QueryStringMapper.addQueryParameter( httpUrl, "until", request.getUntil().get(), false); } - if (request.getPolicy().isPresent()) { + if (request.getEngine().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "policy", request.getPolicy().get(), false); + httpUrl, "engine", request.getEngine().get(), false); } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -505,23 +505,35 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture> signatures( String docId, String layerName, String sha256) { return signatures( docId, layerName, sha256, SignaturesVersionsRequest.builder().build()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture> signatures( String docId, String layerName, String sha256, RequestOptions requestOptions) { return signatures( docId, layerName, sha256, SignaturesVersionsRequest.builder().build(), requestOptions); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture> signatures( String docId, String layerName, String sha256, SignaturesVersionsRequest request) { return signatures(docId, layerName, sha256, request, null); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture> signatures( String docId, String layerName, @@ -536,6 +548,10 @@ public CompletableFuture { httpUrl.addQueryParameter(_key, _value); @@ -578,11 +594,17 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO return; } try { - if (response.code() == 404) { - future.completeExceptionally(new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), - response)); - return; + switch (response.code()) { + case 400: + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), + response)); + return; } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error diff --git a/src/main/java/api/resources/doc/versions/AsyncVersionsClient.java b/src/main/java/api/resources/doc/versions/AsyncVersionsClient.java index 31aecdc..2a06f3a 100644 --- a/src/main/java/api/resources/doc/versions/AsyncVersionsClient.java +++ b/src/main/java/api/resources/doc/versions/AsyncVersionsClient.java @@ -68,14 +68,14 @@ public CompletableFuture list( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture analysis(String docId, String layerName, String sha256) { return this.rawClient.analysis(docId, layerName, sha256).thenApply(response -> response.body()); } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture analysis( String docId, String layerName, String sha256, RequestOptions requestOptions) { @@ -83,7 +83,7 @@ public CompletableFuture analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture analysis( String docId, String layerName, String sha256, AnalysisVersionsRequest request) { @@ -91,7 +91,7 @@ public CompletableFuture analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CompletableFuture analysis( String docId, @@ -157,10 +157,16 @@ public CompletableFuture revision( .thenApply(response -> response.body()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture signatures(String docId, String layerName, String sha256) { return this.rawClient.signatures(docId, layerName, sha256).thenApply(response -> response.body()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture signatures( String docId, String layerName, String sha256, RequestOptions requestOptions) { return this.rawClient @@ -168,11 +174,17 @@ public CompletableFuture signatures( .thenApply(response -> response.body()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture signatures( String docId, String layerName, String sha256, SignaturesVersionsRequest request) { return this.rawClient.signatures(docId, layerName, sha256, request).thenApply(response -> response.body()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CompletableFuture signatures( String docId, String layerName, diff --git a/src/main/java/api/resources/doc/versions/RawVersionsClient.java b/src/main/java/api/resources/doc/versions/RawVersionsClient.java index 0ea2c0f..483b995 100644 --- a/src/main/java/api/resources/doc/versions/RawVersionsClient.java +++ b/src/main/java/api/resources/doc/versions/RawVersionsClient.java @@ -133,7 +133,7 @@ public CloudPDFClientHttpResponse list( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CloudPDFClientHttpResponse analysis( String docId, String layerName, String sha256) { @@ -142,7 +142,7 @@ public CloudPDFClientHttpResponse analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CloudPDFClientHttpResponse analysis( String docId, String layerName, String sha256, RequestOptions requestOptions) { @@ -151,7 +151,7 @@ public CloudPDFClientHttpResponse analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CloudPDFClientHttpResponse analysis( String docId, String layerName, String sha256, AnalysisVersionsRequest request) { @@ -159,7 +159,7 @@ public CloudPDFClientHttpResponse analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public CloudPDFClientHttpResponse analysis( String docId, @@ -191,9 +191,9 @@ public CloudPDFClientHttpResponse analysis( QueryStringMapper.addQueryParameter( httpUrl, "until", request.getUntil().get(), false); } - if (request.getPolicy().isPresent()) { + if (request.getEngine().isPresent()) { QueryStringMapper.addQueryParameter( - httpUrl, "policy", request.getPolicy().get(), false); + httpUrl, "engine", request.getEngine().get(), false); } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { @@ -430,23 +430,35 @@ public CloudPDFClientHttpResponse revision( } } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CloudPDFClientHttpResponse signatures( String docId, String layerName, String sha256) { return signatures( docId, layerName, sha256, SignaturesVersionsRequest.builder().build()); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CloudPDFClientHttpResponse signatures( String docId, String layerName, String sha256, RequestOptions requestOptions) { return signatures( docId, layerName, sha256, SignaturesVersionsRequest.builder().build(), requestOptions); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CloudPDFClientHttpResponse signatures( String docId, String layerName, String sha256, SignaturesVersionsRequest request) { return signatures(docId, layerName, sha256, request, null); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public CloudPDFClientHttpResponse signatures( String docId, String layerName, @@ -461,6 +473,10 @@ public CloudPDFClientHttpResponse signatures( .addPathSegment(layerName) .addPathSegments("versions/signatures") .addPathSegment(sha256); + if (request.getEngine().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "engine", request.getEngine().get(), false); + } if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); @@ -498,9 +514,13 @@ public CloudPDFClientHttpResponse signatures( response); } try { - if (response.code() == 404) { - throw new NotFoundError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); + switch (response.code()) { + case 400: + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ErrorResponse.class), response); } } catch (JsonProcessingException ignored) { // unable to map error response, throwing generic error diff --git a/src/main/java/api/resources/doc/versions/VersionsClient.java b/src/main/java/api/resources/doc/versions/VersionsClient.java index cb40456..a213407 100644 --- a/src/main/java/api/resources/doc/versions/VersionsClient.java +++ b/src/main/java/api/resources/doc/versions/VersionsClient.java @@ -65,14 +65,14 @@ public DocVersionsListResponse list( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public DocVersionsAnalysisResponse analysis(String docId, String layerName, String sha256) { return this.rawClient.analysis(docId, layerName, sha256).body(); } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public DocVersionsAnalysisResponse analysis( String docId, String layerName, String sha256, RequestOptions requestOptions) { @@ -80,7 +80,7 @@ public DocVersionsAnalysisResponse analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public DocVersionsAnalysisResponse analysis( String docId, String layerName, String sha256, AnalysisVersionsRequest request) { @@ -88,7 +88,7 @@ public DocVersionsAnalysisResponse analysis( } /** - * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. + * Exactly one of since.signature / since.revision; until=<revision> defaults to the last. The same answer for every caller. A version never changes, but the rules that judge it can: with engine, the analysis value of the layer's head, a settled answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. */ public DocVersionsAnalysisResponse analysis( String docId, @@ -152,10 +152,16 @@ public InputStream revision( .body(); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public DocVersionsSignaturesResponse signatures(String docId, String layerName, String sha256) { return this.rawClient.signatures(docId, layerName, sha256).body(); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public DocVersionsSignaturesResponse signatures( String docId, String layerName, String sha256, RequestOptions requestOptions) { return this.rawClient @@ -163,11 +169,17 @@ public DocVersionsSignaturesResponse signatures( .body(); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public DocVersionsSignaturesResponse signatures( String docId, String layerName, String sha256, SignaturesVersionsRequest request) { return this.rawClient.signatures(docId, layerName, sha256, request).body(); } + /** + * A version never changes, but what the server reads from it can: with engine, the signatures value of the layer's head, the answer is immutable. Without it, or with another value, the answer is this server's own, with no-store and the current value in EmbedPDF-Engine. + */ public DocVersionsSignaturesResponse signatures( String docId, String layerName, diff --git a/src/main/java/api/resources/doc/versions/requests/AnalysisVersionsRequest.java b/src/main/java/api/resources/doc/versions/requests/AnalysisVersionsRequest.java index 5e1ff1f..c8d65db 100644 --- a/src/main/java/api/resources/doc/versions/requests/AnalysisVersionsRequest.java +++ b/src/main/java/api/resources/doc/versions/requests/AnalysisVersionsRequest.java @@ -32,7 +32,7 @@ public final class AnalysisVersionsRequest { private final Optional until; - private final Optional policy; + private final Optional engine; private final Map additionalProperties; @@ -42,14 +42,14 @@ private AnalysisVersionsRequest( Optional sinceRevision, Optional level, Optional until, - Optional policy, + Optional engine, Map additionalProperties) { this.documentPassword = documentPassword; this.sinceSignature = sinceSignature; this.sinceRevision = sinceRevision; this.level = level; this.until = until; - this.policy = policy; + this.engine = engine; this.additionalProperties = additionalProperties; } @@ -81,9 +81,12 @@ public Optional getUntil() { return until; } - @JsonProperty("policy") - public Optional getPolicy() { - return policy; + /** + * @return The analysis engine value from the layer's head (engine.analysis): the rules the answer is judged with. With it, a settled answer is cached. + */ + @JsonProperty("engine") + public Optional getEngine() { + return engine; } @java.lang.Override @@ -103,13 +106,13 @@ private boolean equalTo(AnalysisVersionsRequest other) { && sinceRevision.equals(other.sinceRevision) && level.equals(other.level) && until.equals(other.until) - && policy.equals(other.policy); + && engine.equals(other.engine); } @java.lang.Override public int hashCode() { return Objects.hash( - this.documentPassword, this.sinceSignature, this.sinceRevision, this.level, this.until, this.policy); + this.documentPassword, this.sinceSignature, this.sinceRevision, this.level, this.until, this.engine); } @java.lang.Override @@ -133,7 +136,7 @@ public static final class Builder { private Optional until = Optional.empty(); - private Optional policy = Optional.empty(); + private Optional engine = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -146,7 +149,7 @@ public Builder from(AnalysisVersionsRequest other) { sinceRevision(other.getSinceRevision()); level(other.getLevel()); until(other.getUntil()); - policy(other.getPolicy()); + engine(other.getEngine()); return this; } @@ -207,20 +210,23 @@ public Builder until(Integer until) { return this; } - @JsonSetter(value = "policy", nulls = Nulls.SKIP) - public Builder policy(Optional policy) { - this.policy = policy; + /** + *

The analysis engine value from the layer's head (engine.analysis): the rules the answer is judged with. With it, a settled answer is cached.

+ */ + @JsonSetter(value = "engine", nulls = Nulls.SKIP) + public Builder engine(Optional engine) { + this.engine = engine; return this; } - public Builder policy(Integer policy) { - this.policy = Optional.ofNullable(policy); + public Builder engine(String engine) { + this.engine = Optional.ofNullable(engine); return this; } public AnalysisVersionsRequest build() { return new AnalysisVersionsRequest( - documentPassword, sinceSignature, sinceRevision, level, until, policy, additionalProperties); + documentPassword, sinceSignature, sinceRevision, level, until, engine, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/api/resources/doc/versions/requests/SignaturesVersionsRequest.java b/src/main/java/api/resources/doc/versions/requests/SignaturesVersionsRequest.java index c60fa39..155b277 100644 --- a/src/main/java/api/resources/doc/versions/requests/SignaturesVersionsRequest.java +++ b/src/main/java/api/resources/doc/versions/requests/SignaturesVersionsRequest.java @@ -9,6 +9,9 @@ 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; @@ -20,10 +23,14 @@ public final class SignaturesVersionsRequest { private final Optional documentPassword; + private final Optional engine; + private final Map additionalProperties; - private SignaturesVersionsRequest(Optional documentPassword, Map additionalProperties) { + private SignaturesVersionsRequest( + Optional documentPassword, Optional engine, Map additionalProperties) { this.documentPassword = documentPassword; + this.engine = engine; this.additionalProperties = additionalProperties; } @@ -35,6 +42,14 @@ public Optional getDocumentPassword() { return documentPassword; } + /** + * @return The signatures engine value from the layer's head (engine.signatures): what the answer is computed with besides the file. With it, the answer is cached. + */ + @JsonProperty("engine") + public Optional getEngine() { + return engine; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -47,12 +62,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(SignaturesVersionsRequest other) { - return documentPassword.equals(other.documentPassword); + return documentPassword.equals(other.documentPassword) && engine.equals(other.engine); } @java.lang.Override public int hashCode() { - return Objects.hash(this.documentPassword); + return Objects.hash(this.documentPassword, this.engine); } @java.lang.Override @@ -68,6 +83,8 @@ public static Builder builder() { public static final class Builder { private Optional documentPassword = Optional.empty(); + private Optional engine = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -75,6 +92,7 @@ private Builder() {} public Builder from(SignaturesVersionsRequest other) { documentPassword(other.getDocumentPassword()); + engine(other.getEngine()); return this; } @@ -91,8 +109,22 @@ public Builder documentPassword(String documentPassword) { return this; } + /** + *

The signatures engine value from the layer's head (engine.signatures): what the answer is computed with besides the file. With it, the answer is cached.

+ */ + @JsonSetter(value = "engine", nulls = Nulls.SKIP) + public Builder engine(Optional engine) { + this.engine = engine; + return this; + } + + public Builder engine(String engine) { + this.engine = Optional.ofNullable(engine); + return this; + } + public SignaturesVersionsRequest build() { - return new SignaturesVersionsRequest(documentPassword, additionalProperties); + return new SignaturesVersionsRequest(documentPassword, engine, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/api/types/DocSignaturesAddValidationInfoResponse.java b/src/main/java/api/types/DocSignaturesAddValidationInfoResponse.java new file mode 100644 index 0000000..2edb638 --- /dev/null +++ b/src/main/java/api/types/DocSignaturesAddValidationInfoResponse.java @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cloudpdf.api.types; + +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.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DocSignaturesAddValidationInfoResponse.Builder.class) +public final class DocSignaturesAddValidationInfoResponse { + private final DocSignaturesAddValidationInfoResponseAdded added; + + private final MutationMeta meta; + + private final Map additionalProperties; + + private DocSignaturesAddValidationInfoResponse( + DocSignaturesAddValidationInfoResponseAdded added, + MutationMeta meta, + Map additionalProperties) { + this.added = added; + this.meta = meta; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("added") + public DocSignaturesAddValidationInfoResponseAdded getAdded() { + return added; + } + + @JsonProperty("meta") + public MutationMeta getMeta() { + return meta; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DocSignaturesAddValidationInfoResponse + && equalTo((DocSignaturesAddValidationInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DocSignaturesAddValidationInfoResponse other) { + return added.equals(other.added) && meta.equals(other.meta); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.added, this.meta); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AddedStage builder() { + return new Builder(); + } + + public interface AddedStage { + MetaStage added(@NotNull DocSignaturesAddValidationInfoResponseAdded added); + + Builder from(DocSignaturesAddValidationInfoResponse other); + } + + public interface MetaStage { + _FinalStage meta(@NotNull MutationMeta meta); + } + + public interface _FinalStage { + DocSignaturesAddValidationInfoResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AddedStage, MetaStage, _FinalStage { + private DocSignaturesAddValidationInfoResponseAdded added; + + private MutationMeta meta; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DocSignaturesAddValidationInfoResponse other) { + added(other.getAdded()); + meta(other.getMeta()); + return this; + } + + @java.lang.Override + @JsonSetter("added") + public MetaStage added(@NotNull DocSignaturesAddValidationInfoResponseAdded added) { + this.added = Objects.requireNonNull(added, "added must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("meta") + public _FinalStage meta(@NotNull MutationMeta meta) { + this.meta = Objects.requireNonNull(meta, "meta must not be null"); + return this; + } + + @java.lang.Override + public DocSignaturesAddValidationInfoResponse build() { + return new DocSignaturesAddValidationInfoResponse(added, meta, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/api/types/DocSignaturesAddValidationInfoResponseAdded.java b/src/main/java/api/types/DocSignaturesAddValidationInfoResponseAdded.java new file mode 100644 index 0000000..acbeca2 --- /dev/null +++ b/src/main/java/api/types/DocSignaturesAddValidationInfoResponseAdded.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cloudpdf.api.types; + +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.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DocSignaturesAddValidationInfoResponseAdded.Builder.class) +public final class DocSignaturesAddValidationInfoResponseAdded { + private final int certificates; + + private final int ocspResponses; + + private final int crls; + + private final Map additionalProperties; + + private DocSignaturesAddValidationInfoResponseAdded( + int certificates, int ocspResponses, int crls, Map additionalProperties) { + this.certificates = certificates; + this.ocspResponses = ocspResponses; + this.crls = crls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("certificates") + public int getCertificates() { + return certificates; + } + + @JsonProperty("ocspResponses") + public int getOcspResponses() { + return ocspResponses; + } + + @JsonProperty("crls") + public int getCrls() { + return crls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DocSignaturesAddValidationInfoResponseAdded + && equalTo((DocSignaturesAddValidationInfoResponseAdded) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DocSignaturesAddValidationInfoResponseAdded other) { + return certificates == other.certificates && ocspResponses == other.ocspResponses && crls == other.crls; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.certificates, this.ocspResponses, this.crls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CertificatesStage builder() { + return new Builder(); + } + + public interface CertificatesStage { + OcspResponsesStage certificates(int certificates); + + Builder from(DocSignaturesAddValidationInfoResponseAdded other); + } + + public interface OcspResponsesStage { + CrlsStage ocspResponses(int ocspResponses); + } + + public interface CrlsStage { + _FinalStage crls(int crls); + } + + public interface _FinalStage { + DocSignaturesAddValidationInfoResponseAdded build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CertificatesStage, OcspResponsesStage, CrlsStage, _FinalStage { + private int certificates; + + private int ocspResponses; + + private int crls; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DocSignaturesAddValidationInfoResponseAdded other) { + certificates(other.getCertificates()); + ocspResponses(other.getOcspResponses()); + crls(other.getCrls()); + return this; + } + + @java.lang.Override + @JsonSetter("certificates") + public OcspResponsesStage certificates(int certificates) { + this.certificates = certificates; + return this; + } + + @java.lang.Override + @JsonSetter("ocspResponses") + public CrlsStage ocspResponses(int ocspResponses) { + this.ocspResponses = ocspResponses; + return this; + } + + @java.lang.Override + @JsonSetter("crls") + public _FinalStage crls(int crls) { + this.crls = crls; + return this; + } + + @java.lang.Override + public DocSignaturesAddValidationInfoResponseAdded build() { + return new DocSignaturesAddValidationInfoResponseAdded( + certificates, ocspResponses, crls, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/api/types/DocSignaturesPrepareResponse.java b/src/main/java/api/types/DocSignaturesPrepareResponse.java index fecc2d5..23e7e83 100644 --- a/src/main/java/api/types/DocSignaturesPrepareResponse.java +++ b/src/main/java/api/types/DocSignaturesPrepareResponse.java @@ -43,6 +43,8 @@ public final class DocSignaturesPrepareResponse { private final Optional expiresAt; + private final Optional field; + private final Map additionalProperties; private DocSignaturesPrepareResponse( @@ -54,6 +56,7 @@ private DocSignaturesPrepareResponse( String subFilter, DocSignaturesPrepareResponseExpectedVersion expectedVersion, Optional expiresAt, + Optional field, Map additionalProperties) { this.signingId = signingId; this.digest = digest; @@ -63,6 +66,7 @@ private DocSignaturesPrepareResponse( this.subFilter = subFilter; this.expectedVersion = expectedVersion; this.expiresAt = expiresAt; + this.field = field; this.additionalProperties = additionalProperties; } @@ -109,6 +113,11 @@ public Optional getExpiresAt() { return expiresAt; } + @JsonProperty("field") + public Optional getField() { + return field; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("expiresAt") private Optional _getExpiresAt() { @@ -134,7 +143,8 @@ private boolean equalTo(DocSignaturesPrepareResponse other) { && contentsSizeBytes == other.contentsSizeBytes && subFilter.equals(other.subFilter) && expectedVersion.equals(other.expectedVersion) - && expiresAt.equals(other.expiresAt); + && expiresAt.equals(other.expiresAt) + && field.equals(other.field); } @java.lang.Override @@ -147,7 +157,8 @@ public int hashCode() { this.contentsSizeBytes, this.subFilter, this.expectedVersion, - this.expiresAt); + this.expiresAt, + this.field); } @java.lang.Override @@ -203,6 +214,10 @@ public interface _FinalStage { _FinalStage expiresAt(OffsetDateTime expiresAt); _FinalStage expiresAt(Nullable expiresAt); + + _FinalStage field(Optional field); + + _FinalStage field(FormFieldRef field); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -226,6 +241,8 @@ public static final class Builder private DocSignaturesPrepareResponseExpectedVersion expectedVersion; + private Optional field = Optional.empty(); + private Optional expiresAt = Optional.empty(); private List byteRange = new ArrayList<>(); @@ -245,6 +262,7 @@ public Builder from(DocSignaturesPrepareResponse other) { subFilter(other.getSubFilter()); expectedVersion(other.getExpectedVersion()); expiresAt(other.getExpiresAt()); + field(other.getField()); return this; } @@ -290,6 +308,19 @@ public _FinalStage expectedVersion(@NotNull DocSignaturesPrepareResponseExpected return this; } + @java.lang.Override + public _FinalStage field(FormFieldRef field) { + this.field = Optional.ofNullable(field); + return this; + } + + @java.lang.Override + @JsonSetter(value = "field", nulls = Nulls.SKIP) + public _FinalStage field(Optional field) { + this.field = field; + return this; + } + @java.lang.Override public _FinalStage expiresAt(Nullable expiresAt) { if (expiresAt.isNull()) { @@ -350,6 +381,7 @@ public DocSignaturesPrepareResponse build() { subFilter, expectedVersion, expiresAt, + field, additionalProperties); } diff --git a/src/main/java/api/types/DocSignaturesValidationInfoResponse.java b/src/main/java/api/types/DocSignaturesValidationInfoResponse.java new file mode 100644 index 0000000..a1193ce --- /dev/null +++ b/src/main/java/api/types/DocSignaturesValidationInfoResponse.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.cloudpdf.api.types; + +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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DocSignaturesValidationInfoResponse.Builder.class) +public final class DocSignaturesValidationInfoResponse { + private final List certificates; + + private final List ocspResponses; + + private final List crls; + + private final Map additionalProperties; + + private DocSignaturesValidationInfoResponse( + List certificates, + List ocspResponses, + List crls, + Map additionalProperties) { + this.certificates = certificates; + this.ocspResponses = ocspResponses; + this.crls = crls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("certificates") + public List getCertificates() { + return certificates; + } + + @JsonProperty("ocspResponses") + public List getOcspResponses() { + return ocspResponses; + } + + @JsonProperty("crls") + public List getCrls() { + return crls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DocSignaturesValidationInfoResponse + && equalTo((DocSignaturesValidationInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DocSignaturesValidationInfoResponse other) { + return certificates.equals(other.certificates) + && ocspResponses.equals(other.ocspResponses) + && crls.equals(other.crls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.certificates, this.ocspResponses, this.crls); + } + + @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 List certificates = new ArrayList<>(); + + private List ocspResponses = new ArrayList<>(); + + private List crls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DocSignaturesValidationInfoResponse other) { + certificates(other.getCertificates()); + ocspResponses(other.getOcspResponses()); + crls(other.getCrls()); + return this; + } + + @JsonSetter(value = "certificates", nulls = Nulls.SKIP) + public Builder certificates(List certificates) { + this.certificates.clear(); + if (certificates != null) { + this.certificates.addAll(certificates); + } + return this; + } + + public Builder addCertificates(String certificates) { + this.certificates.add(certificates); + return this; + } + + public Builder addAllCertificates(List certificates) { + if (certificates != null) { + this.certificates.addAll(certificates); + } + return this; + } + + @JsonSetter(value = "ocspResponses", nulls = Nulls.SKIP) + public Builder ocspResponses(List ocspResponses) { + this.ocspResponses.clear(); + if (ocspResponses != null) { + this.ocspResponses.addAll(ocspResponses); + } + return this; + } + + public Builder addOcspResponses(String ocspResponses) { + this.ocspResponses.add(ocspResponses); + return this; + } + + public Builder addAllOcspResponses(List ocspResponses) { + if (ocspResponses != null) { + this.ocspResponses.addAll(ocspResponses); + } + return this; + } + + @JsonSetter(value = "crls", nulls = Nulls.SKIP) + public Builder crls(List crls) { + this.crls.clear(); + if (crls != null) { + this.crls.addAll(crls); + } + return this; + } + + public Builder addCrls(String crls) { + this.crls.add(crls); + return this; + } + + public Builder addAllCrls(List crls) { + if (crls != null) { + this.crls.addAll(crls); + } + return this; + } + + public DocSignaturesValidationInfoResponse build() { + return new DocSignaturesValidationInfoResponse(certificates, ocspResponses, crls, 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; + } + } +}