From 799722d595e45cb156170a6e3bc4a3dd05a7c082 Mon Sep 17 00:00:00 2001 From: cloudpdf-sdk-bot Date: Mon, 16 Nov 2026 14:02:38 +0000 Subject: [PATCH] chore: generate CloudPDF Python SDK 3.3.0 --- .fern/metadata.json | 4 +- cloudpdf-generation.json | 8 +- pyproject.toml | 2 +- reference.md | 240 +++++++++++- src/cloudpdf/__init__.py | 9 + src/cloudpdf/core/client_wrapper.py | 6 +- src/cloudpdf/doc/signatures/client.py | 242 +++++++++++- src/cloudpdf/doc/signatures/raw_client.py | 356 +++++++++++++++++- src/cloudpdf/doc/versions/client.py | 44 ++- src/cloudpdf/doc/versions/raw_client.py | 58 ++- src/cloudpdf/types/__init__.py | 9 + ...signatures_add_validation_info_response.py | 22 ++ ...ures_add_validation_info_response_added.py | 25 ++ .../types/doc_signatures_prepare_response.py | 2 + ...doc_signatures_validation_info_response.py | 25 ++ 15 files changed, 1017 insertions(+), 35 deletions(-) create mode 100644 src/cloudpdf/types/doc_signatures_add_validation_info_response.py create mode 100644 src/cloudpdf/types/doc_signatures_add_validation_info_response_added.py create mode 100644 src/cloudpdf/types/doc_signatures_validation_info_response.py diff --git a/.fern/metadata.json b/.fern/metadata.json index af92b06..dddffb9 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -7,9 +7,9 @@ "client_class_name": "CloudPDFClient", "environment_class_name": "CloudPDFEnvironment" }, - "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/cloudpdf-generation.json b/cloudpdf-generation.json index ec55a30..d2d2149 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "python", - "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/pyproject.toml b/pyproject.toml index e4ca9af..ba7f2f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "cloudpdf" -version = "3.2.0" +version = "3.3.0" description = "The official Python SDK for the CloudPDF API." readme = "README.md" authors = ["CloudPDF "] diff --git a/reference.md b/reference.md index 622d75a..85d9455 100644 --- a/reference.md +++ b/reference.md @@ -7096,7 +7096,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.
@@ -7179,6 +7179,218 @@ client.doc.signatures.prepare( + + + + +
client.doc.signatures.validation_info(...) -> 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 + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient +from cloudpdf.environment import CloudPDFEnvironment + +client = CloudPDFClient( + token="", + environment=CloudPDFEnvironment.SAAS, +) + +client.doc.signatures.validation_info( + doc_id="docId", + layer_name="layerName", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**doc_id:** `str` + +
+
+ +
+
+ +**layer_name:** `str` + +
+
+ +
+
+ +**document_password:** `typing.Optional[str]` — 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. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.doc.signatures.add_validation_info(...) -> 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 + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient +from cloudpdf.environment import CloudPDFEnvironment + +client = CloudPDFClient( + token="", + environment=CloudPDFEnvironment.SAAS, +) + +client.doc.signatures.add_validation_info( + doc_id="docId", + layer_name="layerName", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**doc_id:** `str` + +
+
+ +
+
+ +**layer_name:** `str` + +
+
+ +
+
+ +**document_password:** `typing.Optional[str]` — 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. + +
+
+ +
+
+ +**idempotency_key:** `typing.Optional[str]` — 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:** `typing.Optional[typing.List[str]]` + +
+
+ +
+
+ +**ocsp_responses:** `typing.Optional[typing.List[str]]` + +
+
+ +
+
+ +**crls:** `typing.Optional[typing.List[str]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -7286,7 +7498,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`.
@@ -7385,7 +7597,7 @@ client.doc.versions.analysis(
-**policy:** `typing.Optional[int]` +**engine:** `typing.Optional[str]` — 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.
@@ -7596,6 +7808,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
@@ -7657,6 +7883,14 @@ client.doc.versions.signatures(
+**engine:** `typing.Optional[str]` — 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. + +
+
+ +
+
+ **document_password:** `typing.Optional[str]` — 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/cloudpdf/__init__.py b/src/cloudpdf/__init__.py index 16c8287..38e38ed 100644 --- a/src/cloudpdf/__init__.py +++ b/src/cloudpdf/__init__.py @@ -1076,6 +1076,8 @@ DocRedactionsApplyResponseResultsItem, DocRedactionsApplyResponseResultsItemStatus, DocRedactionsApplyResponseScope, + DocSignaturesAddValidationInfoResponse, + DocSignaturesAddValidationInfoResponseAdded, DocSignaturesAnalysisResponse, DocSignaturesAnalysisResponseBasis, DocSignaturesAnalysisResponseBasisSource, @@ -1127,6 +1129,7 @@ DocSignaturesPrepareResponse, DocSignaturesPrepareResponseAlgorithm, DocSignaturesPrepareResponseExpectedVersion, + DocSignaturesValidationInfoResponse, DocTextResponse, DocVersionsAnalysisResponse, DocVersionsAnalysisResponseBasis, @@ -2801,6 +2804,8 @@ "DocRedactionsApplyResponseResultsItem": ".types", "DocRedactionsApplyResponseResultsItemStatus": ".types", "DocRedactionsApplyResponseScope": ".types", + "DocSignaturesAddValidationInfoResponse": ".types", + "DocSignaturesAddValidationInfoResponseAdded": ".types", "DocSignaturesAnalysisResponse": ".types", "DocSignaturesAnalysisResponseBasis": ".types", "DocSignaturesAnalysisResponseBasisSource": ".types", @@ -2852,6 +2857,7 @@ "DocSignaturesPrepareResponse": ".types", "DocSignaturesPrepareResponseAlgorithm": ".types", "DocSignaturesPrepareResponseExpectedVersion": ".types", + "DocSignaturesValidationInfoResponse": ".types", "DocTextResponse": ".types", "DocVersionsAnalysisResponse": ".types", "DocVersionsAnalysisResponseBasis": ".types", @@ -4541,6 +4547,8 @@ def __dir__(): "DocRedactionsApplyResponseResultsItem", "DocRedactionsApplyResponseResultsItemStatus", "DocRedactionsApplyResponseScope", + "DocSignaturesAddValidationInfoResponse", + "DocSignaturesAddValidationInfoResponseAdded", "DocSignaturesAnalysisResponse", "DocSignaturesAnalysisResponseBasis", "DocSignaturesAnalysisResponseBasisSource", @@ -4592,6 +4600,7 @@ def __dir__(): "DocSignaturesPrepareResponse", "DocSignaturesPrepareResponseAlgorithm", "DocSignaturesPrepareResponseExpectedVersion", + "DocSignaturesValidationInfoResponse", "DocTextResponse", "DocVersionsAnalysisResponse", "DocVersionsAnalysisResponseBasis", diff --git a/src/cloudpdf/core/client_wrapper.py b/src/cloudpdf/core/client_wrapper.py index d6f22ee..6fea41c 100644 --- a/src/cloudpdf/core/client_wrapper.py +++ b/src/cloudpdf/core/client_wrapper.py @@ -35,18 +35,18 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "cloudpdf/3.2.0", + "User-Agent": "cloudpdf/3.3.0", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "cloudpdf", - "X-Fern-SDK-Version": "3.2.0", + "X-Fern-SDK-Version": "3.3.0", **(self.get_custom_headers() or {}), } token = self._get_token() if token is not None: headers["Authorization"] = f"Bearer {token}" - headers["EmbedPDF-Version"] = self._embed_pdf_version if self._embed_pdf_version is not None else "3.2" + headers["EmbedPDF-Version"] = self._embed_pdf_version if self._embed_pdf_version is not None else "3.3" return headers def _get_token(self) -> typing.Optional[str]: diff --git a/src/cloudpdf/doc/signatures/client.py b/src/cloudpdf/doc/signatures/client.py index 9ca367b..cf40d0c 100644 --- a/src/cloudpdf/doc/signatures/client.py +++ b/src/cloudpdf/doc/signatures/client.py @@ -5,11 +5,13 @@ from ... import core from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ...core.request_options import RequestOptions +from ...types.doc_signatures_add_validation_info_response import DocSignaturesAddValidationInfoResponse from ...types.doc_signatures_analysis_response import DocSignaturesAnalysisResponse from ...types.doc_signatures_cancel_response import DocSignaturesCancelResponse from ...types.doc_signatures_complete_response import DocSignaturesCompleteResponse from ...types.doc_signatures_list_response import DocSignaturesListResponse from ...types.doc_signatures_prepare_response import DocSignaturesPrepareResponse +from ...types.doc_signatures_validation_info_response import DocSignaturesValidationInfoResponse from .raw_client import AsyncRawSignaturesClient, RawSignaturesClient from .types.analysis_signatures_request_level import AnalysisSignaturesRequestLevel from .types.doc_signatures_complete_request_expected_version import DocSignaturesCompleteRequestExpectedVersion @@ -262,7 +264,7 @@ def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesPrepareResponse: """ - 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. Parameters ---------- @@ -301,6 +303,116 @@ def prepare( ) return _response.data + def validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocSignaturesValidationInfoResponse: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocSignaturesValidationInfoResponse + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + ) + client.doc.signatures.validation_info( + doc_id="docId", + layer_name="layerName", + ) + """ + _response = self._raw_client.validation_info( + doc_id, layer_name, document_password=document_password, request_options=request_options + ) + return _response.data + + def add_validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + idempotency_key: typing.Optional[str] = None, + certificates: typing.Optional[typing.Sequence[str]] = OMIT, + ocsp_responses: typing.Optional[typing.Sequence[str]] = OMIT, + crls: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocSignaturesAddValidationInfoResponse: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + idempotency_key : typing.Optional[str] + 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 : typing.Optional[typing.Sequence[str]] + + ocsp_responses : typing.Optional[typing.Sequence[str]] + + crls : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocSignaturesAddValidationInfoResponse + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + ) + client.doc.signatures.add_validation_info( + doc_id="docId", + layer_name="layerName", + ) + """ + _response = self._raw_client.add_validation_info( + doc_id, + layer_name, + document_password=document_password, + idempotency_key=idempotency_key, + certificates=certificates, + ocsp_responses=ocsp_responses, + crls=crls, + request_options=request_options, + ) + return _response.data + class AsyncSignaturesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -578,7 +690,7 @@ async def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesPrepareResponse: """ - 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. Parameters ---------- @@ -624,3 +736,129 @@ async def main() -> None: doc_id, layer_name, file=file, document_password=document_password, request_options=request_options ) return _response.data + + async def validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocSignaturesValidationInfoResponse: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocSignaturesValidationInfoResponse + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.doc.signatures.validation_info( + doc_id="docId", + layer_name="layerName", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.validation_info( + doc_id, layer_name, document_password=document_password, request_options=request_options + ) + return _response.data + + async def add_validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + idempotency_key: typing.Optional[str] = None, + certificates: typing.Optional[typing.Sequence[str]] = OMIT, + ocsp_responses: typing.Optional[typing.Sequence[str]] = OMIT, + crls: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocSignaturesAddValidationInfoResponse: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + idempotency_key : typing.Optional[str] + 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 : typing.Optional[typing.Sequence[str]] + + ocsp_responses : typing.Optional[typing.Sequence[str]] + + crls : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocSignaturesAddValidationInfoResponse + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.doc.signatures.add_validation_info( + doc_id="docId", + layer_name="layerName", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_validation_info( + doc_id, + layer_name, + document_password=document_password, + idempotency_key=idempotency_key, + certificates=certificates, + ocsp_responses=ocsp_responses, + crls=crls, + request_options=request_options, + ) + return _response.data diff --git a/src/cloudpdf/doc/signatures/raw_client.py b/src/cloudpdf/doc/signatures/raw_client.py index 5eec3a3..b39a387 100644 --- a/src/cloudpdf/doc/signatures/raw_client.py +++ b/src/cloudpdf/doc/signatures/raw_client.py @@ -15,11 +15,13 @@ from ...errors.bad_request_error import BadRequestError from ...errors.conflict_error import ConflictError from ...errors.not_found_error import NotFoundError +from ...types.doc_signatures_add_validation_info_response import DocSignaturesAddValidationInfoResponse from ...types.doc_signatures_analysis_response import DocSignaturesAnalysisResponse from ...types.doc_signatures_cancel_response import DocSignaturesCancelResponse from ...types.doc_signatures_complete_response import DocSignaturesCompleteResponse from ...types.doc_signatures_list_response import DocSignaturesListResponse from ...types.doc_signatures_prepare_response import DocSignaturesPrepareResponse +from ...types.doc_signatures_validation_info_response import DocSignaturesValidationInfoResponse from ...types.error_response import ErrorResponse from .types.analysis_signatures_request_level import AnalysisSignaturesRequestLevel from .types.doc_signatures_complete_request_expected_version import DocSignaturesCompleteRequestExpectedVersion @@ -372,7 +374,7 @@ def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocSignaturesPrepareResponse]: """ - 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. Parameters ---------- @@ -460,6 +462,181 @@ def prepare( ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DocSignaturesValidationInfoResponse]: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocSignaturesValidationInfoResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/signatures/validation-info", + method="GET", + headers={ + "X-Document-Password": str(document_password) if document_password is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocSignaturesValidationInfoResponse, + parse_obj_as( + type_=DocSignaturesValidationInfoResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add_validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + idempotency_key: typing.Optional[str] = None, + certificates: typing.Optional[typing.Sequence[str]] = OMIT, + ocsp_responses: typing.Optional[typing.Sequence[str]] = OMIT, + crls: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DocSignaturesAddValidationInfoResponse]: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + idempotency_key : typing.Optional[str] + 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 : typing.Optional[typing.Sequence[str]] + + ocsp_responses : typing.Optional[typing.Sequence[str]] + + crls : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocSignaturesAddValidationInfoResponse] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/signatures/validation-info", + method="POST", + json={ + "certificates": certificates, + "ocspResponses": ocsp_responses, + "crls": crls, + }, + headers={ + "content-type": "application/json", + "X-Document-Password": str(document_password) if document_password is not None else None, + "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocSignaturesAddValidationInfoResponse, + parse_obj_as( + type_=DocSignaturesAddValidationInfoResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + class AsyncRawSignaturesClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -804,7 +981,7 @@ async def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocSignaturesPrepareResponse]: """ - 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. Parameters ---------- @@ -891,3 +1068,178 @@ async def prepare( status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DocSignaturesValidationInfoResponse]: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocSignaturesValidationInfoResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/signatures/validation-info", + method="GET", + headers={ + "X-Document-Password": str(document_password) if document_password is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocSignaturesValidationInfoResponse, + parse_obj_as( + type_=DocSignaturesValidationInfoResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add_validation_info( + self, + doc_id: str, + layer_name: str, + *, + document_password: typing.Optional[str] = None, + idempotency_key: typing.Optional[str] = None, + certificates: typing.Optional[typing.Sequence[str]] = OMIT, + ocsp_responses: typing.Optional[typing.Sequence[str]] = OMIT, + crls: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DocSignaturesAddValidationInfoResponse]: + """ + 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. + + Parameters + ---------- + doc_id : str + + layer_name : str + + document_password : typing.Optional[str] + 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. + + idempotency_key : typing.Optional[str] + 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 : typing.Optional[typing.Sequence[str]] + + ocsp_responses : typing.Optional[typing.Sequence[str]] + + crls : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocSignaturesAddValidationInfoResponse] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/signatures/validation-info", + method="POST", + json={ + "certificates": certificates, + "ocspResponses": ocsp_responses, + "crls": crls, + }, + headers={ + "content-type": "application/json", + "X-Document-Password": str(document_password) if document_password is not None else None, + "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocSignaturesAddValidationInfoResponse, + parse_obj_as( + type_=DocSignaturesAddValidationInfoResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/cloudpdf/doc/versions/client.py b/src/cloudpdf/doc/versions/client.py index 56dd90f..a34509a 100644 --- a/src/cloudpdf/doc/versions/client.py +++ b/src/cloudpdf/doc/versions/client.py @@ -82,12 +82,12 @@ def analysis( since_revision: typing.Optional[int] = None, level: typing.Optional[AnalysisVersionsRequestLevel] = None, until: typing.Optional[int] = None, - policy: typing.Optional[int] = None, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsAnalysisResponse: """ - 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`. Parameters ---------- @@ -105,7 +105,8 @@ def analysis( until : typing.Optional[int] - policy : typing.Optional[int] + engine : typing.Optional[str] + 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. document_password : typing.Optional[str] 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. @@ -139,7 +140,7 @@ def analysis( since_revision=since_revision, level=level, until=until, - policy=policy, + engine=engine, document_password=document_password, request_options=request_options, ) @@ -249,10 +250,13 @@ def signatures( layer_name: str, sha256: str, *, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsSignaturesResponse: """ + 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`. + Parameters ---------- doc_id : str @@ -261,6 +265,9 @@ def signatures( sha256 : str + engine : typing.Optional[str] + 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. + document_password : typing.Optional[str] 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. @@ -286,7 +293,12 @@ def signatures( ) """ _response = self._raw_client.signatures( - doc_id, layer_name, sha256, document_password=document_password, request_options=request_options + doc_id, + layer_name, + sha256, + engine=engine, + document_password=document_password, + request_options=request_options, ) return _response.data @@ -485,12 +497,12 @@ async def analysis( since_revision: typing.Optional[int] = None, level: typing.Optional[AnalysisVersionsRequestLevel] = None, until: typing.Optional[int] = None, - policy: typing.Optional[int] = None, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsAnalysisResponse: """ - 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`. Parameters ---------- @@ -508,7 +520,8 @@ async def analysis( until : typing.Optional[int] - policy : typing.Optional[int] + engine : typing.Optional[str] + 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. document_password : typing.Optional[str] 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. @@ -550,7 +563,7 @@ async def main() -> None: since_revision=since_revision, level=level, until=until, - policy=policy, + engine=engine, document_password=document_password, request_options=request_options, ) @@ -678,10 +691,13 @@ async def signatures( layer_name: str, sha256: str, *, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsSignaturesResponse: """ + 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`. + Parameters ---------- doc_id : str @@ -690,6 +706,9 @@ async def signatures( sha256 : str + engine : typing.Optional[str] + 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. + document_password : typing.Optional[str] 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. @@ -723,7 +742,12 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.signatures( - doc_id, layer_name, sha256, document_password=document_password, request_options=request_options + doc_id, + layer_name, + sha256, + engine=engine, + document_password=document_password, + request_options=request_options, ) return _response.data diff --git a/src/cloudpdf/doc/versions/raw_client.py b/src/cloudpdf/doc/versions/raw_client.py index ed5564c..c776bf5 100644 --- a/src/cloudpdf/doc/versions/raw_client.py +++ b/src/cloudpdf/doc/versions/raw_client.py @@ -102,12 +102,12 @@ def analysis( since_revision: typing.Optional[int] = None, level: typing.Optional[AnalysisVersionsRequestLevel] = None, until: typing.Optional[int] = None, - policy: typing.Optional[int] = None, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocVersionsAnalysisResponse]: """ - 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`. Parameters ---------- @@ -125,7 +125,8 @@ def analysis( until : typing.Optional[int] - policy : typing.Optional[int] + engine : typing.Optional[str] + 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. document_password : typing.Optional[str] 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. @@ -146,7 +147,7 @@ def analysis( "since.revision": since_revision, "level": level, "until": until, - "policy": policy, + "engine": engine, }, headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -351,10 +352,13 @@ def signatures( layer_name: str, sha256: str, *, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocVersionsSignaturesResponse]: """ + 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`. + Parameters ---------- doc_id : str @@ -363,6 +367,9 @@ def signatures( sha256 : str + engine : typing.Optional[str] + 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. + document_password : typing.Optional[str] 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. @@ -377,6 +384,9 @@ def signatures( _response = self._client_wrapper.httpx_client.request( f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha256)}", method="GET", + params={ + "engine": engine, + }, headers={ "X-Document-Password": str(document_password) if document_password is not None else None, }, @@ -392,6 +402,17 @@ def signatures( ), ) return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), @@ -654,12 +675,12 @@ async def analysis( since_revision: typing.Optional[int] = None, level: typing.Optional[AnalysisVersionsRequestLevel] = None, until: typing.Optional[int] = None, - policy: typing.Optional[int] = None, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocVersionsAnalysisResponse]: """ - 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`. Parameters ---------- @@ -677,7 +698,8 @@ async def analysis( until : typing.Optional[int] - policy : typing.Optional[int] + engine : typing.Optional[str] + 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. document_password : typing.Optional[str] 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. @@ -698,7 +720,7 @@ async def analysis( "since.revision": since_revision, "level": level, "until": until, - "policy": policy, + "engine": engine, }, headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -905,10 +927,13 @@ async def signatures( layer_name: str, sha256: str, *, + engine: typing.Optional[str] = None, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocVersionsSignaturesResponse]: """ + 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`. + Parameters ---------- doc_id : str @@ -917,6 +942,9 @@ async def signatures( sha256 : str + engine : typing.Optional[str] + 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. + document_password : typing.Optional[str] 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. @@ -931,6 +959,9 @@ async def signatures( _response = await self._client_wrapper.httpx_client.request( f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha256)}", method="GET", + params={ + "engine": engine, + }, headers={ "X-Document-Password": str(document_password) if document_password is not None else None, }, @@ -946,6 +977,17 @@ async def signatures( ), ) return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ErrorResponse, + parse_obj_as( + type_=ErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 404: raise NotFoundError( headers=dict(_response.headers), diff --git a/src/cloudpdf/types/__init__.py b/src/cloudpdf/types/__init__.py index e09cc00..0839b8f 100644 --- a/src/cloudpdf/types/__init__.py +++ b/src/cloudpdf/types/__init__.py @@ -1335,6 +1335,8 @@ from .doc_redactions_apply_response_results_item import DocRedactionsApplyResponseResultsItem from .doc_redactions_apply_response_results_item_status import DocRedactionsApplyResponseResultsItemStatus from .doc_redactions_apply_response_scope import DocRedactionsApplyResponseScope + from .doc_signatures_add_validation_info_response import DocSignaturesAddValidationInfoResponse + from .doc_signatures_add_validation_info_response_added import DocSignaturesAddValidationInfoResponseAdded from .doc_signatures_analysis_response import DocSignaturesAnalysisResponse from .doc_signatures_analysis_response_basis import DocSignaturesAnalysisResponseBasis from .doc_signatures_analysis_response_basis_source import DocSignaturesAnalysisResponseBasisSource @@ -1404,6 +1406,7 @@ from .doc_signatures_prepare_response import DocSignaturesPrepareResponse from .doc_signatures_prepare_response_algorithm import DocSignaturesPrepareResponseAlgorithm from .doc_signatures_prepare_response_expected_version import DocSignaturesPrepareResponseExpectedVersion + from .doc_signatures_validation_info_response import DocSignaturesValidationInfoResponse from .doc_text_response import DocTextResponse from .doc_versions_analysis_response import DocVersionsAnalysisResponse from .doc_versions_analysis_response_basis import DocVersionsAnalysisResponseBasis @@ -3152,6 +3155,8 @@ "DocRedactionsApplyResponseResultsItem": ".doc_redactions_apply_response_results_item", "DocRedactionsApplyResponseResultsItemStatus": ".doc_redactions_apply_response_results_item_status", "DocRedactionsApplyResponseScope": ".doc_redactions_apply_response_scope", + "DocSignaturesAddValidationInfoResponse": ".doc_signatures_add_validation_info_response", + "DocSignaturesAddValidationInfoResponseAdded": ".doc_signatures_add_validation_info_response_added", "DocSignaturesAnalysisResponse": ".doc_signatures_analysis_response", "DocSignaturesAnalysisResponseBasis": ".doc_signatures_analysis_response_basis", "DocSignaturesAnalysisResponseBasisSource": ".doc_signatures_analysis_response_basis_source", @@ -3203,6 +3208,7 @@ "DocSignaturesPrepareResponse": ".doc_signatures_prepare_response", "DocSignaturesPrepareResponseAlgorithm": ".doc_signatures_prepare_response_algorithm", "DocSignaturesPrepareResponseExpectedVersion": ".doc_signatures_prepare_response_expected_version", + "DocSignaturesValidationInfoResponse": ".doc_signatures_validation_info_response", "DocTextResponse": ".doc_text_response", "DocVersionsAnalysisResponse": ".doc_versions_analysis_response", "DocVersionsAnalysisResponseBasis": ".doc_versions_analysis_response_basis", @@ -4837,6 +4843,8 @@ def __dir__(): "DocRedactionsApplyResponseResultsItem", "DocRedactionsApplyResponseResultsItemStatus", "DocRedactionsApplyResponseScope", + "DocSignaturesAddValidationInfoResponse", + "DocSignaturesAddValidationInfoResponseAdded", "DocSignaturesAnalysisResponse", "DocSignaturesAnalysisResponseBasis", "DocSignaturesAnalysisResponseBasisSource", @@ -4888,6 +4896,7 @@ def __dir__(): "DocSignaturesPrepareResponse", "DocSignaturesPrepareResponseAlgorithm", "DocSignaturesPrepareResponseExpectedVersion", + "DocSignaturesValidationInfoResponse", "DocTextResponse", "DocVersionsAnalysisResponse", "DocVersionsAnalysisResponseBasis", diff --git a/src/cloudpdf/types/doc_signatures_add_validation_info_response.py b/src/cloudpdf/types/doc_signatures_add_validation_info_response.py new file mode 100644 index 0000000..9293a05 --- /dev/null +++ b/src/cloudpdf/types/doc_signatures_add_validation_info_response.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .doc_signatures_add_validation_info_response_added import DocSignaturesAddValidationInfoResponseAdded +from .mutation_meta import MutationMeta + + +class DocSignaturesAddValidationInfoResponse(UniversalBaseModel): + added: DocSignaturesAddValidationInfoResponseAdded + meta: MutationMeta + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/cloudpdf/types/doc_signatures_add_validation_info_response_added.py b/src/cloudpdf/types/doc_signatures_add_validation_info_response_added.py new file mode 100644 index 0000000..20b11cf --- /dev/null +++ b/src/cloudpdf/types/doc_signatures_add_validation_info_response_added.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class DocSignaturesAddValidationInfoResponseAdded(UniversalBaseModel): + certificates: int + ocsp_responses: typing_extensions.Annotated[ + int, FieldMetadata(alias="ocspResponses"), pydantic.Field(alias="ocspResponses") + ] + crls: int + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/cloudpdf/types/doc_signatures_prepare_response.py b/src/cloudpdf/types/doc_signatures_prepare_response.py index 410df11..1628d4f 100644 --- a/src/cloudpdf/types/doc_signatures_prepare_response.py +++ b/src/cloudpdf/types/doc_signatures_prepare_response.py @@ -9,6 +9,7 @@ from ..core.serialization import FieldMetadata from .doc_signatures_prepare_response_algorithm import DocSignaturesPrepareResponseAlgorithm from .doc_signatures_prepare_response_expected_version import DocSignaturesPrepareResponseExpectedVersion +from .form_field_ref import FormFieldRef class DocSignaturesPrepareResponse(UniversalBaseModel): @@ -30,6 +31,7 @@ class DocSignaturesPrepareResponse(UniversalBaseModel): expires_at: typing_extensions.Annotated[ typing.Optional[dt.datetime], FieldMetadata(alias="expiresAt"), pydantic.Field(alias="expiresAt") ] = None + field: typing.Optional[FormFieldRef] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/cloudpdf/types/doc_signatures_validation_info_response.py b/src/cloudpdf/types/doc_signatures_validation_info_response.py new file mode 100644 index 0000000..787463e --- /dev/null +++ b/src/cloudpdf/types/doc_signatures_validation_info_response.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata + + +class DocSignaturesValidationInfoResponse(UniversalBaseModel): + certificates: typing.List[str] + ocsp_responses: typing_extensions.Annotated[ + typing.List[str], FieldMetadata(alias="ocspResponses"), pydantic.Field(alias="ocspResponses") + ] + crls: typing.List[str] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow