From ddeb4b46d70582bd638d7469e80e247c423c6115 Mon Sep 17 00:00:00 2001 From: cloudpdf-sdk-bot Date: Thu, 29 Oct 2026 14:44:03 +0000 Subject: [PATCH] chore: generate CloudPDF Python SDK 3.0.0a18 --- .fern/metadata.json | 4 +- cloudpdf-generation.json | 8 +- pyproject.toml | 2 +- reference.md | 1022 +++++++++++++-- src/cloudpdf/__init__.py | 133 +- src/cloudpdf/client.py | 19 + src/cloudpdf/core/client_wrapper.py | 4 +- src/cloudpdf/doc/signatures/client.py | 8 +- src/cloudpdf/doc/signatures/raw_client.py | 8 +- src/cloudpdf/doc/versions/client.py | 104 +- src/cloudpdf/doc/versions/raw_client.py | 78 +- src/cloudpdf/documents/__init__.py | 6 + src/cloudpdf/documents/client.py | 185 ++- src/cloudpdf/documents/raw_client.py | 259 ++++ src/cloudpdf/documents/types/__init__.py | 6 + .../types/list_documents_request_order.py | 5 + .../types/list_documents_request_sort.py | 5 + src/cloudpdf/folders/__init__.py | 4 + src/cloudpdf/folders/client.py | 610 +++++++++ src/cloudpdf/folders/raw_client.py | 1108 +++++++++++++++++ src/cloudpdf/shares/client.py | 17 + src/cloudpdf/shares/raw_client.py | 25 + src/cloudpdf/types/__init__.py | 123 +- .../types/doc_versions_list200response.py | 4 +- .../documents_commit200response_document.py | 10 + .../documents_get200response_document.py | 10 + ...cuments_import_from200response_document.py | 10 + ...cuments_import_from202response_document.py | 10 + ...uments_init200response_created_document.py | 10 + ...uments_init200response_deduped_document.py | 10 + ...uments_init200response_resumed_document.py | 10 + ...ocuments_list200response_documents_item.py | 10 + .../types/documents_update200response.py | 20 + .../documents_update200response_document.py | 61 + ...uments_update200response_document_state.py | 7 + ...ate200response_document_thumbnail_state.py | 7 + .../types/documents_update400response.py | 5 + .../types/documents_update403response.py | 5 + .../types/documents_update404response.py | 5 + .../types/engine_error_payload_code.py | 1 - .../types/folders_create200response.py | 20 + .../types/folders_create200response_folder.py | 37 + .../types/folders_create400response.py | 5 + .../types/folders_create403response.py | 5 + .../types/folders_create404response.py | 5 + .../types/folders_create409response.py | 5 + .../types/folders_delete403response.py | 5 + .../types/folders_delete404response.py | 5 + .../types/folders_delete409response.py | 5 + src/cloudpdf/types/folders_get200response.py | 25 + .../types/folders_get200response_folder.py | 37 + .../types/folders_get200response_path_item.py | 20 + src/cloudpdf/types/folders_get403response.py | 5 + src/cloudpdf/types/folders_get404response.py | 5 + src/cloudpdf/types/folders_list200response.py | 25 + .../folders_list200response_folders_item.py | 37 + src/cloudpdf/types/folders_list400response.py | 5 + src/cloudpdf/types/folders_list403response.py | 5 + src/cloudpdf/types/folders_list404response.py | 5 + .../types/folders_move_into400response.py | 5 + .../types/folders_move_into403response.py | 5 + .../types/folders_move_into404response.py | 5 + .../types/folders_move_into409response.py | 5 + .../types/folders_update200response.py | 20 + .../types/folders_update200response_folder.py | 37 + .../types/folders_update400response.py | 5 + .../types/folders_update403response.py | 5 + .../types/folders_update404response.py | 5 + .../types/folders_update409response.py | 5 + ...ue_request_doc_identity.py => identity.py} | 2 +- .../types/shares_archive200response_share.py | 2 + .../types/shares_create200response_share.py | 2 + .../types/shares_get200response_share.py | 2 + .../shares_list200response_shares_item.py | 2 + .../types/shares_update200response_share.py | 2 + src/cloudpdf/types/tokens_issue_request.py | 7 +- .../types/tokens_issue_request_doc.py | 4 +- .../types/tokens_issue_request_tenant.py | 3 +- .../tokens_issue_request_tenant_scope_item.py | 10 - ...ens_issue_request_tenant_scope_item_one.py | 8 - ...ns_issue_request_tenant_scope_item_zero.py | 5 - 81 files changed, 4096 insertions(+), 249 deletions(-) create mode 100644 src/cloudpdf/documents/types/list_documents_request_order.py create mode 100644 src/cloudpdf/documents/types/list_documents_request_sort.py create mode 100644 src/cloudpdf/folders/__init__.py create mode 100644 src/cloudpdf/folders/client.py create mode 100644 src/cloudpdf/folders/raw_client.py create mode 100644 src/cloudpdf/types/documents_update200response.py create mode 100644 src/cloudpdf/types/documents_update200response_document.py create mode 100644 src/cloudpdf/types/documents_update200response_document_state.py create mode 100644 src/cloudpdf/types/documents_update200response_document_thumbnail_state.py create mode 100644 src/cloudpdf/types/documents_update400response.py create mode 100644 src/cloudpdf/types/documents_update403response.py create mode 100644 src/cloudpdf/types/documents_update404response.py create mode 100644 src/cloudpdf/types/folders_create200response.py create mode 100644 src/cloudpdf/types/folders_create200response_folder.py create mode 100644 src/cloudpdf/types/folders_create400response.py create mode 100644 src/cloudpdf/types/folders_create403response.py create mode 100644 src/cloudpdf/types/folders_create404response.py create mode 100644 src/cloudpdf/types/folders_create409response.py create mode 100644 src/cloudpdf/types/folders_delete403response.py create mode 100644 src/cloudpdf/types/folders_delete404response.py create mode 100644 src/cloudpdf/types/folders_delete409response.py create mode 100644 src/cloudpdf/types/folders_get200response.py create mode 100644 src/cloudpdf/types/folders_get200response_folder.py create mode 100644 src/cloudpdf/types/folders_get200response_path_item.py create mode 100644 src/cloudpdf/types/folders_get403response.py create mode 100644 src/cloudpdf/types/folders_get404response.py create mode 100644 src/cloudpdf/types/folders_list200response.py create mode 100644 src/cloudpdf/types/folders_list200response_folders_item.py create mode 100644 src/cloudpdf/types/folders_list400response.py create mode 100644 src/cloudpdf/types/folders_list403response.py create mode 100644 src/cloudpdf/types/folders_list404response.py create mode 100644 src/cloudpdf/types/folders_move_into400response.py create mode 100644 src/cloudpdf/types/folders_move_into403response.py create mode 100644 src/cloudpdf/types/folders_move_into404response.py create mode 100644 src/cloudpdf/types/folders_move_into409response.py create mode 100644 src/cloudpdf/types/folders_update200response.py create mode 100644 src/cloudpdf/types/folders_update200response_folder.py create mode 100644 src/cloudpdf/types/folders_update400response.py create mode 100644 src/cloudpdf/types/folders_update403response.py create mode 100644 src/cloudpdf/types/folders_update404response.py create mode 100644 src/cloudpdf/types/folders_update409response.py rename src/cloudpdf/types/{tokens_issue_request_doc_identity.py => identity.py} (95%) delete mode 100644 src/cloudpdf/types/tokens_issue_request_tenant_scope_item.py delete mode 100644 src/cloudpdf/types/tokens_issue_request_tenant_scope_item_one.py delete mode 100644 src/cloudpdf/types/tokens_issue_request_tenant_scope_item_zero.py diff --git a/.fern/metadata.json b/.fern/metadata.json index 6ee7c28..9b1a6d9 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -7,9 +7,9 @@ "client_class_name": "CloudPDFClient", "environment_class_name": "CloudPDFEnvironment" }, - "originGitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977", + "originGitCommit": "3a88df90980e5c0546a5ebbfd1252d8fca77ff9b", "originGitCommitIsDirty": false, "invokedBy": "ci", - "requestedVersion": "3.0.0a17", + "requestedVersion": "3.0.0a18", "ciProvider": "github" } \ No newline at end of file diff --git a/cloudpdf-generation.json b/cloudpdf-generation.json index 2ade0f4..737cc89 100644 --- a/cloudpdf-generation.json +++ b/cloudpdf-generation.json @@ -1,12 +1,12 @@ { "language": "python", - "canonicalVersion": "3.0.0-next.17", - "sdkVersion": "3.0.0a17", + "canonicalVersion": "3.0.0-next.18", + "sdkVersion": "3.0.0a18", "source": { "repository": "embedpdf/embed-pdf-viewer", "openapi": "cloudpdf/contract/openapi.json", - "openapiSha256": "8fa53cef2776eb0de9ec50c263aa547b309a04d1a2ecb6ee54b6338d6698dc00", - "gitCommit": "07aa3f26c82243b36a5ec94f7072130c7298d977", + "openapiSha256": "ad2a3baa628061e7b3e8b597cfd15bcda7f103d0f829cb01388a0fed6c4f5873", + "gitCommit": "3a88df90980e5c0546a5ebbfd1252d8fca77ff9b", "gitCommitIsDirty": false }, "fern": { diff --git a/pyproject.toml b/pyproject.toml index b2c26d2..10774ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "cloudpdf" -version = "3.0.0a17" +version = "3.0.0a18" description = "The official Python SDK for the CloudPDF API." readme = "README.md" authors = ["CloudPDF "] diff --git a/reference.md b/reference.md index 7fa3bb4..18101bc 100644 --- a/reference.md +++ b/reference.md @@ -962,6 +962,14 @@ client.shares.create(
+**identity:** `typing.Optional[Identity]` + +
+
+ +
+
+ **origins:** `typing.Optional[typing.List[str]]`
@@ -1235,6 +1243,14 @@ client.shares.update(
+**identity:** `typing.Optional[Identity]` + +
+
+ +
+
+ **scope:** `typing.Optional[typing.List[str]]`
@@ -1918,7 +1934,39 @@ client.documents.list(
-**state:** `typing.Optional[ListDocumentsRequestState]` +**state:** `typing.Optional[ListDocumentsRequestState]` — Only documents in this state. Without it, every state except deleting. + +
+
+ +
+
+ +**q:** `typing.Optional[str]` — Only documents whose name contains this text, ignoring case. + +
+
+ +
+
+ +**folder_id:** `typing.Optional[str]` — Only documents directly in this folder (root: the top level). Without it, documents in every folder. + +
+
+ +
+
+ +**sort:** `typing.Optional[ListDocumentsRequestSort]` — createdAt (default), name (ignoring case), or size (stored bytes; 0 while pending). + +
+
+ +
+
+ +**order:** `typing.Optional[ListDocumentsRequestOrder]` — Defaults to the reading order of the sort: A to Z for name, newest and largest first otherwise.
@@ -1985,7 +2033,680 @@ client.documents.get(
-**id:** `str` +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+ +
+ + + +
+ + +
client.documents.delete(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.delete( + tenant_id="tenantId", + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.update(...) -> DocumentsUpdate200Response +
+
+ +#### 📝 Description + +
+
+ +
+
+ +A document that is being deleted answers 404. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.update( + tenant_id="tenantId", + id="id", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**name:** `str` — What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.commit(...) -> DocumentsCommit200Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.commit( + tenant_id="tenantId", + id="id", + sha256="sha256", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**sha256:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.download(...) -> typing.Iterator[bytes] +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.download( + tenant_id="tenantId", + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.thumbnail(...) -> typing.Iterator[bytes] +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.thumbnail( + tenant_id="tenantId", + id="id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.upload_proxy(...) -> DocumentsUploadProxy200Response +
+
+ +#### 📝 Description + +
+
+ +
+
+ +This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.upload_proxy( + tenant_id="tenantId", + id="id", + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**file:** `core.File` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.import_from(...) -> DocumentsImportFrom200Response +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient +from cloudpdf.documents import DocumentsImportFromRequestSource_Url + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.import_from( + tenant_id="tenantId", + source=DocumentsImportFromRequestSource_Url( + url="url", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**source:** `DocumentsImportFromRequestSource` — Where CloudPDF pulls the bytes from. The two shapes differ in who supplies the authority to read, not in which storage vendor holds the file. + +
+
+ +
+
+ +**expected:** `typing.Optional[DocumentsImportFromRequestExpected]` — Integrity pins, enforced when present. When absent, the server-observed values become authoritative. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + +
+
+ +
+
+ +**folder_id:** `typing.Optional[str]` — A folder id, or root for the top level. + +
+
+ +
+
+ +**metadata:** `typing.Optional[typing.Dict[str, typing.Any]]` + +
+
+ +
+
+ +**idempotency_key:** `typing.Optional[str]` — Retrying with the same key resumes the same document rather than importing a second copy — including after a 502. + +
+
+ +
+
+ +**dedup_mode:** `typing.Optional[DocumentsImportFromRequestDedupMode]` — always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice. + +
+
+ +
+
+ +**doc_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**mode:** `typing.Optional[DocumentsImportFromRequestMode]` — sync (default) holds the response open for the whole transfer. async answers 202 with the document pending and transfers in the background; it requires a connection source, and filesystem connections additionally require expected.sha256. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.documents.init(...) -> DocumentsInit200Response +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from cloudpdf import CloudPDFClient + +client = CloudPDFClient( + token="", + base_url="https://yourhost.com/path/to/api", +) + +client.documents.init( + tenant_id="tenantId", + content_length=1.1, + content_sha256="contentSha256", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tenant_id:** `str` + +
+
+ +
+
+ +**content_length:** `float`
@@ -1993,58 +2714,63 @@ client.documents.get(
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. +**content_sha256:** `str`
-
-
+
+
+**name:** `typing.Optional[str]` — What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. +
-
-
client.documents.delete(...)
-#### 🔌 Usage +**folder_id:** `typing.Optional[str]` — A folder id, or root for the top level. + +
+
+**metadata:** `typing.Optional[typing.Dict[str, typing.Any]]` + +
+
+
-```python -from cloudpdf import CloudPDFClient - -client = CloudPDFClient( - token="", - base_url="https://yourhost.com/path/to/api", -) - -client.documents.delete( - tenant_id="tenantId", - id="id", -) - -``` +**idempotency_key:** `typing.Optional[str]` +
+ +
+
+ +**dedup_mode:** `typing.Optional[DocumentsInitRequestDedupMode]` — always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice. +
-#### ⚙️ Parameters -
+**doc_id:** `typing.Optional[str]` + +
+
+
-**tenant_id:** `str` +**upload_ttl_sec:** `typing.Optional[float]`
@@ -2052,7 +2778,7 @@ client.documents.delete(
-**id:** `str` +**upload_preference:** `typing.Optional[DocumentsInitRequestUploadPreference]`
@@ -2072,7 +2798,8 @@ client.documents.delete(
-
client.documents.commit(...) -> DocumentsCommit200Response +## Folders +
client.folders.list(...) -> FoldersList200Response
@@ -2092,10 +2819,8 @@ client = CloudPDFClient( base_url="https://yourhost.com/path/to/api", ) -client.documents.commit( +client.folders.list( tenant_id="tenantId", - id="id", - sha256="sha256", ) ``` @@ -2120,7 +2845,7 @@ client.documents.commit(
-**id:** `str` +**limit:** `typing.Optional[int]`
@@ -2128,7 +2853,15 @@ client.documents.commit(
-**sha256:** `str` +**cursor:** `typing.Optional[str]` + +
+
+ +
+
+ +**parent_id:** `typing.Optional[str]` — Only the folders directly in this folder (root: the top level). Without it, every folder.
@@ -2148,10 +2881,24 @@ client.documents.commit(
-
client.documents.download(...) -> typing.Iterator[bytes] +
client.folders.create(...) -> FoldersCreate200Response +
+
+ +#### 📝 Description + +
+
+
+409 Conflict carries `details.reason`: `name-taken` (a sibling has the name, ignoring case; `details.name`) or `too-deep` (folders nest at most 100 levels; `details.maxDepth`). 404 when the parent folder does not exist. +
+
+
+
+ #### 🔌 Usage
@@ -2168,9 +2915,9 @@ client = CloudPDFClient( base_url="https://yourhost.com/path/to/api", ) -client.documents.download( +client.folders.create( tenant_id="tenantId", - id="id", + name="name", ) ``` @@ -2195,7 +2942,15 @@ client.documents.download(
-**id:** `str` +**name:** `str` — What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + +
+
+ +
+
+ +**parent_id:** `typing.Optional[str]` — A folder id, or root for the top level.
@@ -2215,7 +2970,7 @@ client.documents.download(
-
client.documents.thumbnail(...) -> typing.Iterator[bytes] +
client.folders.get(...) -> FoldersGet200Response
@@ -2235,9 +2990,9 @@ client = CloudPDFClient( base_url="https://yourhost.com/path/to/api", ) -client.documents.thumbnail( +client.folders.get( tenant_id="tenantId", - id="id", + folder_id="folderId", ) ``` @@ -2262,7 +3017,7 @@ client.documents.thumbnail(
-**id:** `str` +**folder_id:** `str`
@@ -2282,7 +3037,7 @@ client.documents.thumbnail(
-
client.documents.upload_proxy(...) -> DocumentsUploadProxy200Response +
client.folders.delete(...)
@@ -2294,7 +3049,7 @@ client.documents.thumbnail(
-This bounded origin-mediated fallback must only be used after documents.init returns upload.kind=proxy. Auto mode prefers a presigned object-store PUT whenever available. +Without recursive, a folder with anything inside is refused: 409 Conflict with `details.reason` `not-empty` and what it holds, counted over every level below, in `details.folders` and `details.documents`. With recursive=true, the folder and every folder under it go at once, and every document in them stops opening, leaves every list and stops answering its share links at once; their stored files and links are removed in the background. Uploads into those folders that have not committed cannot commit.
@@ -2316,10 +3071,9 @@ client = CloudPDFClient( base_url="https://yourhost.com/path/to/api", ) -client.documents.upload_proxy( +client.folders.delete( tenant_id="tenantId", - id="id", - file="example_file", + folder_id="folderId", ) ``` @@ -2344,7 +3098,7 @@ client.documents.upload_proxy(
-**id:** `str` +**folder_id:** `str`
@@ -2352,7 +3106,7 @@ client.documents.upload_proxy(
-**file:** `core.File` +**recursive:** `typing.Optional[bool]` — true deletes everything in the folder too. Never the default.
@@ -2372,7 +3126,7 @@ client.documents.upload_proxy(
-
client.documents.import_from(...) -> DocumentsImportFrom200Response +
client.folders.update(...) -> FoldersUpdate200Response
@@ -2384,7 +3138,7 @@ client.documents.upload_proxy(
-Default mode is synchronous and bounded: the response returns only after the transfer verified and committed (or failed). mode=async (connection sources only) answers 202 immediately and an in-process worker performs the transfer with leased, fenced retries; poll the document until ready/failed. The deployment import policy gates scheme, network range, and size; sources must declare a length. CloudPDF copies and owns the bytes — the source is never referenced in place. A 502 marks a retryable upstream failure: retry with the same idempotencyKey to resume the same document. URL sources are capabilities and never echoed back. Connection sources name operator-registered storage (bucket/prefix scope, allowed credential classes, and tenant bindings are deployment configuration); `revision` is provider-interpreted (S3 VersionId, GCS generation, Azure version id). +409 Conflict with `details.reason` `name-taken` when a sibling has the name, ignoring case.
@@ -2400,18 +3154,16 @@ Default mode is synchronous and bounded: the response returns only after the tra ```python from cloudpdf import CloudPDFClient -from cloudpdf.documents import DocumentsImportFromRequestSource_Url client = CloudPDFClient( token="", base_url="https://yourhost.com/path/to/api", ) -client.documents.import_from( +client.folders.update( tenant_id="tenantId", - source=DocumentsImportFromRequestSource_Url( - url="url", - ), + folder_id="folderId", + name="name", ) ``` @@ -2436,7 +3188,7 @@ client.documents.import_from(
-**source:** `DocumentsImportFromRequestSource` — Where CloudPDF pulls the bytes from. The two shapes differ in who supplies the authority to read, not in which storage vendor holds the file. +**folder_id:** `str`
@@ -2444,7 +3196,7 @@ client.documents.import_from(
-**expected:** `typing.Optional[DocumentsImportFromRequestExpected]` — Integrity pins, enforced when present. When absent, the server-observed values become authoritative. +**name:** `str` — What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case.
@@ -2452,61 +3204,35 @@ client.documents.import_from(
-**metadata:** `typing.Optional[typing.Dict[str, typing.Any]]` +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
- -
-
- -**idempotency_key:** `typing.Optional[str]` — Retrying with the same key resumes the same document rather than importing a second copy — including after a 502. -
-
-
-**dedup_mode:** `typing.Optional[DocumentsImportFromRequestDedupMode]` — always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice. -
+
+
client.folders.move_into(...)
-**doc_id:** `typing.Optional[str]` - -
-
+#### 📝 Description
-**mode:** `typing.Optional[DocumentsImportFromRequestMode]` — sync (default) holds the response open for the whole transfer. async answers 202 with the document pending and transfers in the background; it requires a connection source, and filesystem connections additionally require expected.sha256. - -
-
-
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
+Up to 1,000 ids in total. A folder moves with everything in it. 404 NotFound names the ids that do not exist or are being deleted in `details.documentIds` and `details.folderIds`. 409 Conflict carries `details.reason`: `cycle` (the destination is a moved folder or inside one; `details.folderId`), `too-deep` (the move would nest folders deeper than 100 levels; `details.maxDepth`) or `name-taken` (a moved folder's name is taken in the destination, ignoring case; `details.name`). - - -
- -
client.documents.init(...) -> DocumentsInit200Response -
-
#### 🔌 Usage @@ -2524,10 +3250,9 @@ client = CloudPDFClient( base_url="https://yourhost.com/path/to/api", ) -client.documents.init( +client.folders.move_into( tenant_id="tenantId", - content_length=1.1, - content_sha256="contentSha256", + folder_id="folderId", ) ``` @@ -2552,47 +3277,7 @@ client.documents.init(
-**content_length:** `float` - -
-
- -
-
- -**content_sha256:** `str` - -
-
- -
-
- -**metadata:** `typing.Optional[typing.Dict[str, typing.Any]]` - -
-
- -
-
- -**idempotency_key:** `typing.Optional[str]` - -
-
- -
-
- -**dedup_mode:** `typing.Optional[DocumentsInitRequestDedupMode]` — always-create (default) creates a new document every time. reuse-existing returns a document that already holds the same content instead of storing it twice. - -
-
- -
-
- -**doc_id:** `typing.Optional[str]` +**folder_id:** `str` — A folder id, or root for the top level.
@@ -2600,7 +3285,7 @@ client.documents.init(
-**upload_ttl_sec:** `typing.Optional[float]` +**document_ids:** `typing.Optional[typing.List[str]]`
@@ -2608,7 +3293,7 @@ client.documents.init(
-**upload_preference:** `typing.Optional[DocumentsInitRequestUploadPreference]` +**folder_ids:** `typing.Optional[typing.List[str]]`
@@ -5731,7 +6416,7 @@ client.doc.signatures.cancel(
-`cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion. +`cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. The new version is the layer's own: only this layer moves to it, and the document and every other layer stay as they were. Refetch the manifest after a completion.
@@ -5964,7 +6649,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). A layer behind the document head cannot sign (StaleBase). +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.
@@ -6063,7 +6748,7 @@ client.doc.signatures.prepare(
-Every completed signature publishes a new version. Never cached: the list grows. +Every completed signature makes a new version of its layer; another layer's versions are never listed. Never cached: the list grows.
@@ -6087,6 +6772,7 @@ client = CloudPDFClient( client.doc.versions.list( doc_id="docId", + layer_name="layerName", ) ``` @@ -6111,6 +6797,14 @@ client.doc.versions.list(
+**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.
@@ -6143,7 +6837,7 @@ client.doc.versions.list(
-Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every layer and every caller. +Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller.
@@ -6167,6 +6861,7 @@ client = CloudPDFClient( client.doc.versions.analysis( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -6192,6 +6887,14 @@ client.doc.versions.analysis(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
@@ -6282,6 +6985,7 @@ client = CloudPDFClient( client.doc.versions.download( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -6307,6 +7011,14 @@ client.doc.versions.download(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
@@ -6357,6 +7069,7 @@ client = CloudPDFClient( client.doc.versions.revision( doc_id="docId", + layer_name="layerName", sha="sha", index=1, ) @@ -6383,6 +7096,14 @@ client.doc.versions.revision(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
@@ -6441,6 +7162,7 @@ client = CloudPDFClient( client.doc.versions.signatures( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -6466,6 +7188,14 @@ client.doc.versions.signatures(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
@@ -6530,6 +7260,7 @@ client = CloudPDFClient( client.doc.versions.signature_contents( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", ) @@ -6556,6 +7287,14 @@ client.doc.versions.signature_contents(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
@@ -6628,6 +7367,7 @@ client = CloudPDFClient( client.doc.versions.signature_digest( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", algorithm="sha1", @@ -6655,6 +7395,14 @@ client.doc.versions.signature_digest(
+**layer_name:** `str` + +
+
+ +
+
+ **sha:** `str`
diff --git a/src/cloudpdf/__init__.py b/src/cloudpdf/__init__.py index 09dd051..1a72eee 100644 --- a/src/cloudpdf/__init__.py +++ b/src/cloudpdf/__init__.py @@ -1576,6 +1576,13 @@ DocumentsList400Response, DocumentsThumbnailResponse, DocumentsThumbnailResponseError, + DocumentsUpdate200Response, + DocumentsUpdate200ResponseDocument, + DocumentsUpdate200ResponseDocumentState, + DocumentsUpdate200ResponseDocumentThumbnailState, + DocumentsUpdate400Response, + DocumentsUpdate403Response, + DocumentsUpdate404Response, DocumentsUploadProxy200Response, DocumentsUploadProxy400Response, DocumentsUploadProxy409Response, @@ -1588,6 +1595,35 @@ FieldPositionZero, FieldScriptWrite, FieldScriptWriteType, + FoldersCreate200Response, + FoldersCreate200ResponseFolder, + FoldersCreate400Response, + FoldersCreate403Response, + FoldersCreate404Response, + FoldersCreate409Response, + FoldersDelete403Response, + FoldersDelete404Response, + FoldersDelete409Response, + FoldersGet200Response, + FoldersGet200ResponseFolder, + FoldersGet200ResponsePathItem, + FoldersGet403Response, + FoldersGet404Response, + FoldersList200Response, + FoldersList200ResponseFoldersItem, + FoldersList400Response, + FoldersList403Response, + FoldersList404Response, + FoldersMoveInto400Response, + FoldersMoveInto403Response, + FoldersMoveInto404Response, + FoldersMoveInto409Response, + FoldersUpdate200Response, + FoldersUpdate200ResponseFolder, + FoldersUpdate400Response, + FoldersUpdate403Response, + FoldersUpdate404Response, + FoldersUpdate409Response, FormField, FormFieldCheckbox, FormFieldCheckboxDefaultValueEntry, @@ -1790,6 +1826,7 @@ FormField_Unknown, FormMutationMeta, FormWidget, + Identity, MetadataPatch, MetadataPatchTrapped, MutationMeta, @@ -2031,11 +2068,7 @@ TokensIssue404Response, TokensIssueRequest, TokensIssueRequestDoc, - TokensIssueRequestDocIdentity, TokensIssueRequestTenant, - TokensIssueRequestTenantScopeItem, - TokensIssueRequestTenantScopeItemOne, - TokensIssueRequestTenantScopeItemZero, TokensIssueRequest_Doc, TokensIssueRequest_Tenant, TokensRevokeResponse, @@ -2080,7 +2113,7 @@ NotImplementedError, UnprocessableEntityError, ) - from . import deployment, doc, documents, shares, tenants, tokens + from . import deployment, doc, documents, folders, shares, tenants, tokens from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient from .client import AsyncCloudPDFClient, CloudPDFClient from .doc import DocChangesRequestChangesItem @@ -2095,6 +2128,8 @@ DocumentsImportFromRequestSource_Url, DocumentsInitRequestDedupMode, DocumentsInitRequestUploadPreference, + ListDocumentsRequestOrder, + ListDocumentsRequestSort, ListDocumentsRequestState, ) from .shares import ( @@ -3708,6 +3743,13 @@ "DocumentsList400Response": ".types", "DocumentsThumbnailResponse": ".types", "DocumentsThumbnailResponseError": ".types", + "DocumentsUpdate200Response": ".types", + "DocumentsUpdate200ResponseDocument": ".types", + "DocumentsUpdate200ResponseDocumentState": ".types", + "DocumentsUpdate200ResponseDocumentThumbnailState": ".types", + "DocumentsUpdate400Response": ".types", + "DocumentsUpdate403Response": ".types", + "DocumentsUpdate404Response": ".types", "DocumentsUploadProxy200Response": ".types", "DocumentsUploadProxy400Response": ".types", "DocumentsUploadProxy409Response": ".types", @@ -3720,6 +3762,35 @@ "FieldPositionZero": ".types", "FieldScriptWrite": ".types", "FieldScriptWriteType": ".types", + "FoldersCreate200Response": ".types", + "FoldersCreate200ResponseFolder": ".types", + "FoldersCreate400Response": ".types", + "FoldersCreate403Response": ".types", + "FoldersCreate404Response": ".types", + "FoldersCreate409Response": ".types", + "FoldersDelete403Response": ".types", + "FoldersDelete404Response": ".types", + "FoldersDelete409Response": ".types", + "FoldersGet200Response": ".types", + "FoldersGet200ResponseFolder": ".types", + "FoldersGet200ResponsePathItem": ".types", + "FoldersGet403Response": ".types", + "FoldersGet404Response": ".types", + "FoldersList200Response": ".types", + "FoldersList200ResponseFoldersItem": ".types", + "FoldersList400Response": ".types", + "FoldersList403Response": ".types", + "FoldersList404Response": ".types", + "FoldersMoveInto400Response": ".types", + "FoldersMoveInto403Response": ".types", + "FoldersMoveInto404Response": ".types", + "FoldersMoveInto409Response": ".types", + "FoldersUpdate200Response": ".types", + "FoldersUpdate200ResponseFolder": ".types", + "FoldersUpdate400Response": ".types", + "FoldersUpdate403Response": ".types", + "FoldersUpdate404Response": ".types", + "FoldersUpdate409Response": ".types", "ForbiddenError": ".errors", "FormField": ".types", "FormFieldCheckbox": ".types", @@ -3924,6 +3995,9 @@ "FormMutationMeta": ".types", "FormWidget": ".types", "GoneError": ".errors", + "Identity": ".types", + "ListDocumentsRequestOrder": ".documents", + "ListDocumentsRequestSort": ".documents", "ListDocumentsRequestState": ".documents", "MetadataPatch": ".types", "MetadataPatchTrapped": ".types", @@ -4187,11 +4261,7 @@ "TokensIssue404Response": ".types", "TokensIssueRequest": ".types", "TokensIssueRequestDoc": ".types", - "TokensIssueRequestDocIdentity": ".types", "TokensIssueRequestTenant": ".types", - "TokensIssueRequestTenantScopeItem": ".types", - "TokensIssueRequestTenantScopeItemOne": ".types", - "TokensIssueRequestTenantScopeItemZero": ".types", "TokensIssueRequest_Doc": ".types", "TokensIssueRequest_Tenant": ".types", "TokensRevokeResponse": ".types", @@ -4229,6 +4299,7 @@ "deployment": ".deployment", "doc": ".doc", "documents": ".documents", + "folders": ".folders", "shares": ".shares", "tenants": ".tenants", "tokens": ".tokens", @@ -5845,6 +5916,13 @@ def __dir__(): "DocumentsList400Response", "DocumentsThumbnailResponse", "DocumentsThumbnailResponseError", + "DocumentsUpdate200Response", + "DocumentsUpdate200ResponseDocument", + "DocumentsUpdate200ResponseDocumentState", + "DocumentsUpdate200ResponseDocumentThumbnailState", + "DocumentsUpdate400Response", + "DocumentsUpdate403Response", + "DocumentsUpdate404Response", "DocumentsUploadProxy200Response", "DocumentsUploadProxy400Response", "DocumentsUploadProxy409Response", @@ -5857,6 +5935,35 @@ def __dir__(): "FieldPositionZero", "FieldScriptWrite", "FieldScriptWriteType", + "FoldersCreate200Response", + "FoldersCreate200ResponseFolder", + "FoldersCreate400Response", + "FoldersCreate403Response", + "FoldersCreate404Response", + "FoldersCreate409Response", + "FoldersDelete403Response", + "FoldersDelete404Response", + "FoldersDelete409Response", + "FoldersGet200Response", + "FoldersGet200ResponseFolder", + "FoldersGet200ResponsePathItem", + "FoldersGet403Response", + "FoldersGet404Response", + "FoldersList200Response", + "FoldersList200ResponseFoldersItem", + "FoldersList400Response", + "FoldersList403Response", + "FoldersList404Response", + "FoldersMoveInto400Response", + "FoldersMoveInto403Response", + "FoldersMoveInto404Response", + "FoldersMoveInto409Response", + "FoldersUpdate200Response", + "FoldersUpdate200ResponseFolder", + "FoldersUpdate400Response", + "FoldersUpdate403Response", + "FoldersUpdate404Response", + "FoldersUpdate409Response", "ForbiddenError", "FormField", "FormFieldCheckbox", @@ -6061,6 +6168,9 @@ def __dir__(): "FormMutationMeta", "FormWidget", "GoneError", + "Identity", + "ListDocumentsRequestOrder", + "ListDocumentsRequestSort", "ListDocumentsRequestState", "MetadataPatch", "MetadataPatchTrapped", @@ -6324,11 +6434,7 @@ def __dir__(): "TokensIssue404Response", "TokensIssueRequest", "TokensIssueRequestDoc", - "TokensIssueRequestDocIdentity", "TokensIssueRequestTenant", - "TokensIssueRequestTenantScopeItem", - "TokensIssueRequestTenantScopeItemOne", - "TokensIssueRequestTenantScopeItemZero", "TokensIssueRequest_Doc", "TokensIssueRequest_Tenant", "TokensRevokeResponse", @@ -6366,6 +6472,7 @@ def __dir__(): "deployment", "doc", "documents", + "folders", "shares", "tenants", "tokens", diff --git a/src/cloudpdf/client.py b/src/cloudpdf/client.py index 926f71f..5509116 100644 --- a/src/cloudpdf/client.py +++ b/src/cloudpdf/client.py @@ -12,6 +12,7 @@ from .deployment.client import AsyncDeploymentClient, DeploymentClient from .doc.client import AsyncDocClient, DocClient from .documents.client import AsyncDocumentsClient, DocumentsClient + from .folders.client import AsyncFoldersClient, FoldersClient from .shares.client import AsyncSharesClient, SharesClient from .tenants.client import AsyncTenantsClient, TenantsClient from .tokens.client import AsyncTokensClient, TokensClient @@ -97,6 +98,7 @@ def __init__( self._shares: typing.Optional[SharesClient] = None self._tenants: typing.Optional[TenantsClient] = None self._documents: typing.Optional[DocumentsClient] = None + self._folders: typing.Optional[FoldersClient] = None self._tokens: typing.Optional[TokensClient] = None @property @@ -139,6 +141,14 @@ def documents(self): self._documents = DocumentsClient(client_wrapper=self._client_wrapper) return self._documents + @property + def folders(self): + if self._folders is None: + from .folders.client import FoldersClient # noqa: E402 + + self._folders = FoldersClient(client_wrapper=self._client_wrapper) + return self._folders + @property def tokens(self): if self._tokens is None: @@ -249,6 +259,7 @@ def __init__( self._shares: typing.Optional[AsyncSharesClient] = None self._tenants: typing.Optional[AsyncTenantsClient] = None self._documents: typing.Optional[AsyncDocumentsClient] = None + self._folders: typing.Optional[AsyncFoldersClient] = None self._tokens: typing.Optional[AsyncTokensClient] = None @property @@ -291,6 +302,14 @@ def documents(self): self._documents = AsyncDocumentsClient(client_wrapper=self._client_wrapper) return self._documents + @property + def folders(self): + if self._folders is None: + from .folders.client import AsyncFoldersClient # noqa: E402 + + self._folders = AsyncFoldersClient(client_wrapper=self._client_wrapper) + return self._folders + @property def tokens(self): if self._tokens is None: diff --git a/src/cloudpdf/core/client_wrapper.py b/src/cloudpdf/core/client_wrapper.py index 09a1f55..3e8a032 100644 --- a/src/cloudpdf/core/client_wrapper.py +++ b/src/cloudpdf/core/client_wrapper.py @@ -33,12 +33,12 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "cloudpdf/3.0.0a17", + "User-Agent": "cloudpdf/3.0.0a18", "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.0.0a17", + "X-Fern-SDK-Version": "3.0.0a18", **(self.get_custom_headers() or {}), } token = self._get_token() diff --git a/src/cloudpdf/doc/signatures/client.py b/src/cloudpdf/doc/signatures/client.py index 8890c09..f729fb9 100644 --- a/src/cloudpdf/doc/signatures/client.py +++ b/src/cloudpdf/doc/signatures/client.py @@ -139,7 +139,7 @@ def complete( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesComplete200Response: """ - `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion. + `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. The new version is the layer's own: only this layer moves to it, and the document and every other layer stay as they were. Refetch the manifest after a completion. Parameters ---------- @@ -266,7 +266,7 @@ def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesPrepare200Response: """ - 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 layer behind the document head cannot sign (StaleBase). + 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. Parameters ---------- @@ -444,7 +444,7 @@ async def complete( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesComplete200Response: """ - `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion. + `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. The new version is the layer's own: only this layer moves to it, and the document and every other layer stay as they were. Refetch the manifest after a completion. Parameters ---------- @@ -587,7 +587,7 @@ async def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> DocSignaturesPrepare200Response: """ - 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 layer behind the document head cannot sign (StaleBase). + 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. Parameters ---------- diff --git a/src/cloudpdf/doc/signatures/raw_client.py b/src/cloudpdf/doc/signatures/raw_client.py index 434bf2d..042c2b5 100644 --- a/src/cloudpdf/doc/signatures/raw_client.py +++ b/src/cloudpdf/doc/signatures/raw_client.py @@ -177,7 +177,7 @@ def complete( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocSignaturesComplete200Response]: """ - `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion. + `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. The new version is the layer's own: only this layer moves to it, and the document and every other layer stay as they were. Refetch the manifest after a completion. Parameters ---------- @@ -371,7 +371,7 @@ def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocSignaturesPrepare200Response]: """ - 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 layer behind the document head cannot sign (StaleBase). + 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. Parameters ---------- @@ -609,7 +609,7 @@ async def complete( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocSignaturesComplete200Response]: """ - `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. Every layer of the document then sits over the new version; refetch the manifest after a completion. + `cms` is the detached CMS over the prepared digest, base64. `expectedVersion` must be what prepare returned. Idempotent by signing id: the same CMS again answers `already-completed`. The new version is the layer's own: only this layer moves to it, and the document and every other layer stay as they were. Refetch the manifest after a completion. Parameters ---------- @@ -803,7 +803,7 @@ async def prepare( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocSignaturesPrepare200Response]: """ - 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 layer behind the document head cannot sign (StaleBase). + 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. Parameters ---------- diff --git a/src/cloudpdf/doc/versions/client.py b/src/cloudpdf/doc/versions/client.py index bf36920..4759fa4 100644 --- a/src/cloudpdf/doc/versions/client.py +++ b/src/cloudpdf/doc/versions/client.py @@ -30,17 +30,20 @@ def with_raw_response(self) -> RawVersionsClient: def list( self, doc_id: str, + layer_name: str, *, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsList200Response: """ - Every completed signature publishes a new version. Never cached: the list grows. + Every completed signature makes a new version of its layer; another layer's versions are never listed. Never cached: the list grows. 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. @@ -62,14 +65,18 @@ def list( ) client.doc.versions.list( doc_id="docId", + layer_name="layerName", ) """ - _response = self._raw_client.list(doc_id, document_password=document_password, request_options=request_options) + _response = self._raw_client.list( + doc_id, layer_name, document_password=document_password, request_options=request_options + ) return _response.data def analysis( self, doc_id: str, + layer_name: str, sha: str, *, since_signature: typing.Optional[int] = None, @@ -81,12 +88,14 @@ def analysis( request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsAnalysis200Response: """ - Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every layer and every caller. + Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. Parameters ---------- doc_id : str + layer_name : str + sha : str since_signature : typing.Optional[int] @@ -120,11 +129,13 @@ def analysis( ) client.doc.versions.analysis( doc_id="docId", + layer_name="layerName", sha="sha", ) """ _response = self._raw_client.analysis( doc_id, + layer_name, sha, since_signature=since_signature, since_revision=since_revision, @@ -139,6 +150,7 @@ def analysis( def download( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -149,6 +161,8 @@ def download( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -172,17 +186,19 @@ def download( ) client.doc.versions.download( doc_id="docId", + layer_name="layerName", sha="sha", ) """ with self._raw_client.download( - doc_id, sha, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, document_password=document_password, request_options=request_options ) as r: yield from r.data def revision( self, doc_id: str, + layer_name: str, sha: str, index: int, *, @@ -194,6 +210,8 @@ def revision( ---------- doc_id : str + layer_name : str + sha : str index : int @@ -219,18 +237,20 @@ def revision( ) client.doc.versions.revision( doc_id="docId", + layer_name="layerName", sha="sha", index=1, ) """ with self._raw_client.revision( - doc_id, sha, index, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, index, document_password=document_password, request_options=request_options ) as r: yield from r.data def signatures( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -241,6 +261,8 @@ def signatures( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -264,17 +286,19 @@ def signatures( ) client.doc.versions.signatures( doc_id="docId", + layer_name="layerName", sha="sha", ) """ _response = self._raw_client.signatures( - doc_id, sha, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, document_password=document_password, request_options=request_options ) return _response.data def signature_contents( self, doc_id: str, + layer_name: str, sha: str, field_key: str, *, @@ -288,6 +312,8 @@ def signature_contents( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -313,18 +339,20 @@ def signature_contents( ) client.doc.versions.signature_contents( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", ) """ with self._raw_client.signature_contents( - doc_id, sha, field_key, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, field_key, document_password=document_password, request_options=request_options ) as r: yield from r.data def signature_digest( self, doc_id: str, + layer_name: str, sha: str, field_key: str, algorithm: SignatureDigestVersionsRequestAlgorithm, @@ -339,6 +367,8 @@ def signature_digest( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -366,13 +396,20 @@ def signature_digest( ) client.doc.versions.signature_digest( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", algorithm="sha1", ) """ with self._raw_client.signature_digest( - doc_id, sha, field_key, algorithm, document_password=document_password, request_options=request_options + doc_id, + layer_name, + sha, + field_key, + algorithm, + document_password=document_password, + request_options=request_options, ) as r: yield from r.data @@ -395,17 +432,20 @@ def with_raw_response(self) -> AsyncRawVersionsClient: async def list( self, doc_id: str, + layer_name: str, *, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsList200Response: """ - Every completed signature publishes a new version. Never cached: the list grows. + Every completed signature makes a new version of its layer; another layer's versions are never listed. Never cached: the list grows. 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. @@ -432,19 +472,21 @@ async def list( async def main() -> None: await client.doc.versions.list( doc_id="docId", + layer_name="layerName", ) asyncio.run(main()) """ _response = await self._raw_client.list( - doc_id, document_password=document_password, request_options=request_options + doc_id, layer_name, document_password=document_password, request_options=request_options ) return _response.data async def analysis( self, doc_id: str, + layer_name: str, sha: str, *, since_signature: typing.Optional[int] = None, @@ -456,12 +498,14 @@ async def analysis( request_options: typing.Optional[RequestOptions] = None, ) -> DocVersionsAnalysis200Response: """ - Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every layer and every caller. + Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. Parameters ---------- doc_id : str + layer_name : str + sha : str since_signature : typing.Optional[int] @@ -500,6 +544,7 @@ async def analysis( async def main() -> None: await client.doc.versions.analysis( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -508,6 +553,7 @@ async def main() -> None: """ _response = await self._raw_client.analysis( doc_id, + layer_name, sha, since_signature=since_signature, since_revision=since_revision, @@ -522,6 +568,7 @@ async def main() -> None: async def download( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -532,6 +579,8 @@ async def download( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -560,6 +609,7 @@ async def download( async def main() -> None: await client.doc.versions.download( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -567,7 +617,7 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.download( - doc_id, sha, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, document_password=document_password, request_options=request_options ) as r: async for _chunk in r.data: yield _chunk @@ -575,6 +625,7 @@ async def main() -> None: async def revision( self, doc_id: str, + layer_name: str, sha: str, index: int, *, @@ -586,6 +637,8 @@ async def revision( ---------- doc_id : str + layer_name : str + sha : str index : int @@ -616,6 +669,7 @@ async def revision( async def main() -> None: await client.doc.versions.revision( doc_id="docId", + layer_name="layerName", sha="sha", index=1, ) @@ -624,7 +678,7 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.revision( - doc_id, sha, index, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, index, document_password=document_password, request_options=request_options ) as r: async for _chunk in r.data: yield _chunk @@ -632,6 +686,7 @@ async def main() -> None: async def signatures( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -642,6 +697,8 @@ async def signatures( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -670,6 +727,7 @@ async def signatures( async def main() -> None: await client.doc.versions.signatures( doc_id="docId", + layer_name="layerName", sha="sha", ) @@ -677,13 +735,14 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.signatures( - doc_id, sha, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, document_password=document_password, request_options=request_options ) return _response.data async def signature_contents( self, doc_id: str, + layer_name: str, sha: str, field_key: str, *, @@ -697,6 +756,8 @@ async def signature_contents( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -727,6 +788,7 @@ async def signature_contents( async def main() -> None: await client.doc.versions.signature_contents( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", ) @@ -735,7 +797,7 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.signature_contents( - doc_id, sha, field_key, document_password=document_password, request_options=request_options + doc_id, layer_name, sha, field_key, document_password=document_password, request_options=request_options ) as r: async for _chunk in r.data: yield _chunk @@ -743,6 +805,7 @@ async def main() -> None: async def signature_digest( self, doc_id: str, + layer_name: str, sha: str, field_key: str, algorithm: SignatureDigestVersionsRequestAlgorithm, @@ -757,6 +820,8 @@ async def signature_digest( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -789,6 +854,7 @@ async def signature_digest( async def main() -> None: await client.doc.versions.signature_digest( doc_id="docId", + layer_name="layerName", sha="sha", field_key="fieldKey", algorithm="sha1", @@ -798,7 +864,13 @@ async def main() -> None: asyncio.run(main()) """ async with self._raw_client.signature_digest( - doc_id, sha, field_key, algorithm, document_password=document_password, request_options=request_options + doc_id, + layer_name, + sha, + field_key, + algorithm, + document_password=document_password, + request_options=request_options, ) as r: async for _chunk in r.data: yield _chunk diff --git a/src/cloudpdf/doc/versions/raw_client.py b/src/cloudpdf/doc/versions/raw_client.py index e648ad5..a0d988d 100644 --- a/src/cloudpdf/doc/versions/raw_client.py +++ b/src/cloudpdf/doc/versions/raw_client.py @@ -28,17 +28,20 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def list( self, doc_id: str, + layer_name: str, *, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocVersionsList200Response]: """ - Every completed signature publishes a new version. Never cached: the list grows. + Every completed signature makes a new version of its layer; another layer's versions are never listed. Never cached: the list grows. 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. @@ -51,7 +54,7 @@ def list( OK """ _response = self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -91,6 +94,7 @@ def list( def analysis( self, doc_id: str, + layer_name: str, sha: str, *, since_signature: typing.Optional[int] = None, @@ -102,12 +106,14 @@ def analysis( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocVersionsAnalysis200Response]: """ - Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every layer and every caller. + Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. Parameters ---------- doc_id : str + layer_name : str + sha : str since_signature : typing.Optional[int] @@ -132,7 +138,7 @@ def analysis( OK """ _response = self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions/analysis/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/analysis/{encode_path_param(sha)}", method="GET", params={ "since.signature": since_signature, @@ -191,6 +197,7 @@ def analysis( def download( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -201,6 +208,8 @@ def download( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -215,7 +224,7 @@ def download( OK """ with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/download/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/download/{encode_path_param(sha)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -262,6 +271,7 @@ def _stream() -> HttpResponse[typing.Iterator[bytes]]: def revision( self, doc_id: str, + layer_name: str, sha: str, index: int, *, @@ -273,6 +283,8 @@ def revision( ---------- doc_id : str + layer_name : str + sha : str index : int @@ -289,7 +301,7 @@ def revision( OK """ with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/revisions/{encode_path_param(sha)}/{encode_path_param(index)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/revisions/{encode_path_param(sha)}/{encode_path_param(index)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -335,6 +347,7 @@ def _stream() -> HttpResponse[typing.Iterator[bytes]]: def signatures( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -345,6 +358,8 @@ def signatures( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -359,7 +374,7 @@ def signatures( OK """ _response = self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -400,6 +415,7 @@ def signatures( def signature_contents( self, doc_id: str, + layer_name: str, sha: str, field_key: str, *, @@ -413,6 +429,8 @@ def signature_contents( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -429,7 +447,7 @@ def signature_contents( OK """ with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/contents", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/contents", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -476,6 +494,7 @@ def _stream() -> HttpResponse[typing.Iterator[bytes]]: def signature_digest( self, doc_id: str, + layer_name: str, sha: str, field_key: str, algorithm: SignatureDigestVersionsRequestAlgorithm, @@ -490,6 +509,8 @@ def signature_digest( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -508,7 +529,7 @@ def signature_digest( OK """ with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/digest/{encode_path_param(algorithm)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/digest/{encode_path_param(algorithm)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -559,17 +580,20 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def list( self, doc_id: str, + layer_name: str, *, document_password: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocVersionsList200Response]: """ - Every completed signature publishes a new version. Never cached: the list grows. + Every completed signature makes a new version of its layer; another layer's versions are never listed. Never cached: the list grows. 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. @@ -582,7 +606,7 @@ async def list( OK """ _response = await self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -622,6 +646,7 @@ async def list( async def analysis( self, doc_id: str, + layer_name: str, sha: str, *, since_signature: typing.Optional[int] = None, @@ -633,12 +658,14 @@ async def analysis( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocVersionsAnalysis200Response]: """ - Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every layer and every caller. + Exactly one of `since.signature` / `since.revision`; `until=` defaults to the last. The same answer for every caller. Parameters ---------- doc_id : str + layer_name : str + sha : str since_signature : typing.Optional[int] @@ -663,7 +690,7 @@ async def analysis( OK """ _response = await self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions/analysis/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/analysis/{encode_path_param(sha)}", method="GET", params={ "since.signature": since_signature, @@ -722,6 +749,7 @@ async def analysis( async def download( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -732,6 +760,8 @@ async def download( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -746,7 +776,7 @@ async def download( OK """ async with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/download/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/download/{encode_path_param(sha)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -794,6 +824,7 @@ async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: async def revision( self, doc_id: str, + layer_name: str, sha: str, index: int, *, @@ -805,6 +836,8 @@ async def revision( ---------- doc_id : str + layer_name : str + sha : str index : int @@ -821,7 +854,7 @@ async def revision( OK """ async with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/revisions/{encode_path_param(sha)}/{encode_path_param(index)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/revisions/{encode_path_param(sha)}/{encode_path_param(index)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -868,6 +901,7 @@ async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: async def signatures( self, doc_id: str, + layer_name: str, sha: str, *, document_password: typing.Optional[str] = None, @@ -878,6 +912,8 @@ async def signatures( ---------- doc_id : str + layer_name : str + sha : str document_password : typing.Optional[str] @@ -892,7 +928,7 @@ async def signatures( OK """ _response = await self._client_wrapper.httpx_client.request( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -933,6 +969,7 @@ async def signatures( async def signature_contents( self, doc_id: str, + layer_name: str, sha: str, field_key: str, *, @@ -946,6 +983,8 @@ async def signature_contents( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -962,7 +1001,7 @@ async def signature_contents( OK """ async with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/contents", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/contents", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, @@ -1010,6 +1049,7 @@ async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: async def signature_digest( self, doc_id: str, + layer_name: str, sha: str, field_key: str, algorithm: SignatureDigestVersionsRequestAlgorithm, @@ -1024,6 +1064,8 @@ async def signature_digest( ---------- doc_id : str + layer_name : str + sha : str field_key : str @@ -1042,7 +1084,7 @@ async def signature_digest( OK """ async with self._client_wrapper.httpx_client.stream( - f"v1/docs/{encode_path_param(doc_id)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/digest/{encode_path_param(algorithm)}", + f"v1/docs/{encode_path_param(doc_id)}/layers/{encode_path_param(layer_name)}/versions/signatures/{encode_path_param(sha)}/{encode_path_param(field_key)}/digest/{encode_path_param(algorithm)}", method="GET", headers={ "X-Document-Password": str(document_password) if document_password is not None else None, diff --git a/src/cloudpdf/documents/__init__.py b/src/cloudpdf/documents/__init__.py index a5a6a0c..61abcc4 100644 --- a/src/cloudpdf/documents/__init__.py +++ b/src/cloudpdf/documents/__init__.py @@ -17,6 +17,8 @@ DocumentsImportFromRequestSource_Url, DocumentsInitRequestDedupMode, DocumentsInitRequestUploadPreference, + ListDocumentsRequestOrder, + ListDocumentsRequestSort, ListDocumentsRequestState, ) from . import layers @@ -31,6 +33,8 @@ "DocumentsImportFromRequestSource_Url": ".types", "DocumentsInitRequestDedupMode": ".types", "DocumentsInitRequestUploadPreference": ".types", + "ListDocumentsRequestOrder": ".types", + "ListDocumentsRequestSort": ".types", "ListDocumentsRequestState": ".types", "layers": ".layers", } @@ -68,6 +72,8 @@ def __dir__(): "DocumentsImportFromRequestSource_Url", "DocumentsInitRequestDedupMode", "DocumentsInitRequestUploadPreference", + "ListDocumentsRequestOrder", + "ListDocumentsRequestSort", "ListDocumentsRequestState", "layers", ] diff --git a/src/cloudpdf/documents/client.py b/src/cloudpdf/documents/client.py index c9c1b51..b5ce5db 100644 --- a/src/cloudpdf/documents/client.py +++ b/src/cloudpdf/documents/client.py @@ -12,6 +12,7 @@ from ..types.documents_import_from200response import DocumentsImportFrom200Response from ..types.documents_init200response import DocumentsInit200Response from ..types.documents_list200response import DocumentsList200Response +from ..types.documents_update200response import DocumentsUpdate200Response from ..types.documents_upload_proxy200response import DocumentsUploadProxy200Response from .raw_client import AsyncRawDocumentsClient, RawDocumentsClient from .types.documents_import_from_request_dedup_mode import DocumentsImportFromRequestDedupMode @@ -20,6 +21,8 @@ from .types.documents_import_from_request_source import DocumentsImportFromRequestSource from .types.documents_init_request_dedup_mode import DocumentsInitRequestDedupMode from .types.documents_init_request_upload_preference import DocumentsInitRequestUploadPreference +from .types.list_documents_request_order import ListDocumentsRequestOrder +from .types.list_documents_request_sort import ListDocumentsRequestSort from .types.list_documents_request_state import ListDocumentsRequestState if typing.TYPE_CHECKING: @@ -52,6 +55,10 @@ def list( limit: typing.Optional[int] = None, cursor: typing.Optional[str] = None, state: typing.Optional[ListDocumentsRequestState] = None, + q: typing.Optional[str] = None, + folder_id: typing.Optional[str] = None, + sort: typing.Optional[ListDocumentsRequestSort] = None, + order: typing.Optional[ListDocumentsRequestOrder] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocumentsList200Response: """ @@ -64,6 +71,19 @@ def list( cursor : typing.Optional[str] state : typing.Optional[ListDocumentsRequestState] + Only documents in this state. Without it, every state except deleting. + + q : typing.Optional[str] + Only documents whose name contains this text, ignoring case. + + folder_id : typing.Optional[str] + Only documents directly in this folder (root: the top level). Without it, documents in every folder. + + sort : typing.Optional[ListDocumentsRequestSort] + createdAt (default), name (ignoring case), or size (stored bytes; 0 while pending). + + order : typing.Optional[ListDocumentsRequestOrder] + Defaults to the reading order of the sort: A to Z for name, newest and largest first otherwise. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -86,7 +106,15 @@ def list( ) """ _response = self._raw_client.list( - tenant_id, limit=limit, cursor=cursor, state=state, request_options=request_options + tenant_id, + limit=limit, + cursor=cursor, + state=state, + q=q, + folder_id=folder_id, + sort=sort, + order=order, + request_options=request_options, ) return _response.data @@ -155,6 +183,46 @@ def delete(self, tenant_id: str, id: str, *, request_options: typing.Optional[Re _response = self._raw_client.delete(tenant_id, id, request_options=request_options) return _response.data + def update( + self, tenant_id: str, id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentsUpdate200Response: + """ + A document that is being deleted answers 404. + + Parameters + ---------- + tenant_id : str + + id : str + + name : str + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsUpdate200Response + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.documents.update( + tenant_id="tenantId", + id="id", + name="name", + ) + """ + _response = self._raw_client.update(tenant_id, id, name=name, request_options=request_options) + return _response.data + def commit( self, tenant_id: str, id: str, *, sha256: str, request_options: typing.Optional[RequestOptions] = None ) -> DocumentsCommit200Response: @@ -305,6 +373,8 @@ def import_from( *, source: DocumentsImportFromRequestSource, expected: typing.Optional[DocumentsImportFromRequestExpected] = OMIT, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsImportFromRequestDedupMode] = OMIT, @@ -325,6 +395,12 @@ def import_from( expected : typing.Optional[DocumentsImportFromRequestExpected] Integrity pins, enforced when present. When absent, the server-observed values become authoritative. + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -366,6 +442,8 @@ def import_from( tenant_id, source=source, expected=expected, + name=name, + folder_id=folder_id, metadata=metadata, idempotency_key=idempotency_key, dedup_mode=dedup_mode, @@ -381,6 +459,8 @@ def init( *, content_length: float, content_sha256: str, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsInitRequestDedupMode] = OMIT, @@ -398,6 +478,12 @@ def init( content_sha256 : str + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -437,6 +523,8 @@ def init( tenant_id, content_length=content_length, content_sha256=content_sha256, + name=name, + folder_id=folder_id, metadata=metadata, idempotency_key=idempotency_key, dedup_mode=dedup_mode, @@ -480,6 +568,10 @@ async def list( limit: typing.Optional[int] = None, cursor: typing.Optional[str] = None, state: typing.Optional[ListDocumentsRequestState] = None, + q: typing.Optional[str] = None, + folder_id: typing.Optional[str] = None, + sort: typing.Optional[ListDocumentsRequestSort] = None, + order: typing.Optional[ListDocumentsRequestOrder] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocumentsList200Response: """ @@ -492,6 +584,19 @@ async def list( cursor : typing.Optional[str] state : typing.Optional[ListDocumentsRequestState] + Only documents in this state. Without it, every state except deleting. + + q : typing.Optional[str] + Only documents whose name contains this text, ignoring case. + + folder_id : typing.Optional[str] + Only documents directly in this folder (root: the top level). Without it, documents in every folder. + + sort : typing.Optional[ListDocumentsRequestSort] + createdAt (default), name (ignoring case), or size (stored bytes; 0 while pending). + + order : typing.Optional[ListDocumentsRequestOrder] + Defaults to the reading order of the sort: A to Z for name, newest and largest first otherwise. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -522,7 +627,15 @@ async def main() -> None: asyncio.run(main()) """ _response = await self._raw_client.list( - tenant_id, limit=limit, cursor=cursor, state=state, request_options=request_options + tenant_id, + limit=limit, + cursor=cursor, + state=state, + q=q, + folder_id=folder_id, + sort=sort, + order=order, + request_options=request_options, ) return _response.data @@ -607,6 +720,54 @@ async def main() -> None: _response = await self._raw_client.delete(tenant_id, id, request_options=request_options) return _response.data + async def update( + self, tenant_id: str, id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentsUpdate200Response: + """ + A document that is being deleted answers 404. + + Parameters + ---------- + tenant_id : str + + id : str + + name : str + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsUpdate200Response + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.documents.update( + tenant_id="tenantId", + id="id", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(tenant_id, id, name=name, request_options=request_options) + return _response.data + async def commit( self, tenant_id: str, id: str, *, sha256: str, request_options: typing.Optional[RequestOptions] = None ) -> DocumentsCommit200Response: @@ -791,6 +952,8 @@ async def import_from( *, source: DocumentsImportFromRequestSource, expected: typing.Optional[DocumentsImportFromRequestExpected] = OMIT, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsImportFromRequestDedupMode] = OMIT, @@ -811,6 +974,12 @@ async def import_from( expected : typing.Optional[DocumentsImportFromRequestExpected] Integrity pins, enforced when present. When absent, the server-observed values become authoritative. + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -860,6 +1029,8 @@ async def main() -> None: tenant_id, source=source, expected=expected, + name=name, + folder_id=folder_id, metadata=metadata, idempotency_key=idempotency_key, dedup_mode=dedup_mode, @@ -875,6 +1046,8 @@ async def init( *, content_length: float, content_sha256: str, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsInitRequestDedupMode] = OMIT, @@ -892,6 +1065,12 @@ async def init( content_sha256 : str + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -939,6 +1118,8 @@ async def main() -> None: tenant_id, content_length=content_length, content_sha256=content_sha256, + name=name, + folder_id=folder_id, metadata=metadata, idempotency_key=idempotency_key, dedup_mode=dedup_mode, diff --git a/src/cloudpdf/documents/raw_client.py b/src/cloudpdf/documents/raw_client.py index 2f27a82..721849b 100644 --- a/src/cloudpdf/documents/raw_client.py +++ b/src/cloudpdf/documents/raw_client.py @@ -24,6 +24,7 @@ from ..types.documents_import_from502response import DocumentsImportFrom502Response from ..types.documents_init200response import DocumentsInit200Response from ..types.documents_list200response import DocumentsList200Response +from ..types.documents_update200response import DocumentsUpdate200Response from ..types.documents_upload_proxy200response import DocumentsUploadProxy200Response from .types.documents_import_from_request_dedup_mode import DocumentsImportFromRequestDedupMode from .types.documents_import_from_request_expected import DocumentsImportFromRequestExpected @@ -31,6 +32,8 @@ from .types.documents_import_from_request_source import DocumentsImportFromRequestSource from .types.documents_init_request_dedup_mode import DocumentsInitRequestDedupMode from .types.documents_init_request_upload_preference import DocumentsInitRequestUploadPreference +from .types.list_documents_request_order import ListDocumentsRequestOrder +from .types.list_documents_request_sort import ListDocumentsRequestSort from .types.list_documents_request_state import ListDocumentsRequestState from pydantic import ValidationError @@ -49,6 +52,10 @@ def list( limit: typing.Optional[int] = None, cursor: typing.Optional[str] = None, state: typing.Optional[ListDocumentsRequestState] = None, + q: typing.Optional[str] = None, + folder_id: typing.Optional[str] = None, + sort: typing.Optional[ListDocumentsRequestSort] = None, + order: typing.Optional[ListDocumentsRequestOrder] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocumentsList200Response]: """ @@ -61,6 +68,19 @@ def list( cursor : typing.Optional[str] state : typing.Optional[ListDocumentsRequestState] + Only documents in this state. Without it, every state except deleting. + + q : typing.Optional[str] + Only documents whose name contains this text, ignoring case. + + folder_id : typing.Optional[str] + Only documents directly in this folder (root: the top level). Without it, documents in every folder. + + sort : typing.Optional[ListDocumentsRequestSort] + createdAt (default), name (ignoring case), or size (stored bytes; 0 while pending). + + order : typing.Optional[ListDocumentsRequestOrder] + Defaults to the reading order of the sort: A to Z for name, newest and largest first otherwise. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -77,6 +97,10 @@ def list( "limit": limit, "cursor": cursor, "state": state, + "q": q, + "folderId": folder_id, + "sort": sort, + "order": order, }, request_options=request_options, ) @@ -230,6 +254,93 @@ def delete( ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def update( + self, tenant_id: str, id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DocumentsUpdate200Response]: + """ + A document that is being deleted answers 404. + + Parameters + ---------- + tenant_id : str + + id : str + + name : str + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocumentsUpdate200Response] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/documents/{encode_path_param(id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsUpdate200Response, + parse_obj_as( + type_=DocumentsUpdate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 commit( self, tenant_id: str, id: str, *, sha256: str, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[DocumentsCommit200Response]: @@ -515,6 +626,8 @@ def import_from( *, source: DocumentsImportFromRequestSource, expected: typing.Optional[DocumentsImportFromRequestExpected] = OMIT, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsImportFromRequestDedupMode] = OMIT, @@ -535,6 +648,12 @@ def import_from( expected : typing.Optional[DocumentsImportFromRequestExpected] Integrity pins, enforced when present. When absent, the server-observed values become authoritative. + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -566,6 +685,8 @@ def import_from( "expected": convert_and_respect_annotation_metadata( object_=expected, annotation=DocumentsImportFromRequestExpected, direction="write" ), + "name": name, + "folderId": folder_id, "metadata": metadata, "idempotencyKey": idempotency_key, "dedupMode": dedup_mode, @@ -636,6 +757,8 @@ def init( *, content_length: float, content_sha256: str, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsInitRequestDedupMode] = OMIT, @@ -653,6 +776,12 @@ def init( content_sha256 : str + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -680,6 +809,8 @@ def init( json={ "contentLength": content_length, "contentSha256": content_sha256, + "name": name, + "folderId": folder_id, "metadata": metadata, "idempotencyKey": idempotency_key, "dedupMode": dedup_mode, @@ -735,6 +866,10 @@ async def list( limit: typing.Optional[int] = None, cursor: typing.Optional[str] = None, state: typing.Optional[ListDocumentsRequestState] = None, + q: typing.Optional[str] = None, + folder_id: typing.Optional[str] = None, + sort: typing.Optional[ListDocumentsRequestSort] = None, + order: typing.Optional[ListDocumentsRequestOrder] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocumentsList200Response]: """ @@ -747,6 +882,19 @@ async def list( cursor : typing.Optional[str] state : typing.Optional[ListDocumentsRequestState] + Only documents in this state. Without it, every state except deleting. + + q : typing.Optional[str] + Only documents whose name contains this text, ignoring case. + + folder_id : typing.Optional[str] + Only documents directly in this folder (root: the top level). Without it, documents in every folder. + + sort : typing.Optional[ListDocumentsRequestSort] + createdAt (default), name (ignoring case), or size (stored bytes; 0 while pending). + + order : typing.Optional[ListDocumentsRequestOrder] + Defaults to the reading order of the sort: A to Z for name, newest and largest first otherwise. request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -763,6 +911,10 @@ async def list( "limit": limit, "cursor": cursor, "state": state, + "q": q, + "folderId": folder_id, + "sort": sort, + "order": order, }, request_options=request_options, ) @@ -916,6 +1068,93 @@ async def delete( ) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + async def update( + self, tenant_id: str, id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DocumentsUpdate200Response]: + """ + A document that is being deleted answers 404. + + Parameters + ---------- + tenant_id : str + + id : str + + name : str + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocumentsUpdate200Response] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/documents/{encode_path_param(id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsUpdate200Response, + parse_obj_as( + type_=DocumentsUpdate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 commit( self, tenant_id: str, id: str, *, sha256: str, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[DocumentsCommit200Response]: @@ -1203,6 +1442,8 @@ async def import_from( *, source: DocumentsImportFromRequestSource, expected: typing.Optional[DocumentsImportFromRequestExpected] = OMIT, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsImportFromRequestDedupMode] = OMIT, @@ -1223,6 +1464,12 @@ async def import_from( expected : typing.Optional[DocumentsImportFromRequestExpected] Integrity pins, enforced when present. When absent, the server-observed values become authoritative. + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -1254,6 +1501,8 @@ async def import_from( "expected": convert_and_respect_annotation_metadata( object_=expected, annotation=DocumentsImportFromRequestExpected, direction="write" ), + "name": name, + "folderId": folder_id, "metadata": metadata, "idempotencyKey": idempotency_key, "dedupMode": dedup_mode, @@ -1324,6 +1573,8 @@ async def init( *, content_length: float, content_sha256: str, + name: typing.Optional[str] = OMIT, + folder_id: typing.Optional[str] = OMIT, metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, idempotency_key: typing.Optional[str] = OMIT, dedup_mode: typing.Optional[DocumentsInitRequestDedupMode] = OMIT, @@ -1341,6 +1592,12 @@ async def init( content_sha256 : str + name : typing.Optional[str] + What people call the document: shown in dashboards, searched and sorted by. 1 to 255 characters, no control characters, no leading or trailing whitespace. Names need not be unique. + + folder_id : typing.Optional[str] + A folder id, or root for the top level. + metadata : typing.Optional[typing.Dict[str, typing.Any]] idempotency_key : typing.Optional[str] @@ -1368,6 +1625,8 @@ async def init( json={ "contentLength": content_length, "contentSha256": content_sha256, + "name": name, + "folderId": folder_id, "metadata": metadata, "idempotencyKey": idempotency_key, "dedupMode": dedup_mode, diff --git a/src/cloudpdf/documents/types/__init__.py b/src/cloudpdf/documents/types/__init__.py index 6bec9de..ee6624a 100644 --- a/src/cloudpdf/documents/types/__init__.py +++ b/src/cloudpdf/documents/types/__init__.py @@ -18,6 +18,8 @@ from .documents_import_from_request_source_url import DocumentsImportFromRequestSourceUrl from .documents_init_request_dedup_mode import DocumentsInitRequestDedupMode from .documents_init_request_upload_preference import DocumentsInitRequestUploadPreference + from .list_documents_request_order import ListDocumentsRequestOrder + from .list_documents_request_sort import ListDocumentsRequestSort from .list_documents_request_state import ListDocumentsRequestState _dynamic_imports: typing.Dict[str, str] = { "DocumentsImportFromRequestDedupMode": ".documents_import_from_request_dedup_mode", @@ -30,6 +32,8 @@ "DocumentsImportFromRequestSource_Url": ".documents_import_from_request_source", "DocumentsInitRequestDedupMode": ".documents_init_request_dedup_mode", "DocumentsInitRequestUploadPreference": ".documents_init_request_upload_preference", + "ListDocumentsRequestOrder": ".list_documents_request_order", + "ListDocumentsRequestSort": ".list_documents_request_sort", "ListDocumentsRequestState": ".list_documents_request_state", } @@ -66,5 +70,7 @@ def __dir__(): "DocumentsImportFromRequestSource_Url", "DocumentsInitRequestDedupMode", "DocumentsInitRequestUploadPreference", + "ListDocumentsRequestOrder", + "ListDocumentsRequestSort", "ListDocumentsRequestState", ] diff --git a/src/cloudpdf/documents/types/list_documents_request_order.py b/src/cloudpdf/documents/types/list_documents_request_order.py new file mode 100644 index 0000000..5abdcf2 --- /dev/null +++ b/src/cloudpdf/documents/types/list_documents_request_order.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ListDocumentsRequestOrder = typing.Union[typing.Literal["asc", "desc"], typing.Any] diff --git a/src/cloudpdf/documents/types/list_documents_request_sort.py b/src/cloudpdf/documents/types/list_documents_request_sort.py new file mode 100644 index 0000000..b7e1102 --- /dev/null +++ b/src/cloudpdf/documents/types/list_documents_request_sort.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ListDocumentsRequestSort = typing.Union[typing.Literal["createdAt", "name", "size"], typing.Any] diff --git a/src/cloudpdf/folders/__init__.py b/src/cloudpdf/folders/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/cloudpdf/folders/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/cloudpdf/folders/client.py b/src/cloudpdf/folders/client.py new file mode 100644 index 0000000..b0d6651 --- /dev/null +++ b/src/cloudpdf/folders/client.py @@ -0,0 +1,610 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.folders_create200response import FoldersCreate200Response +from ..types.folders_get200response import FoldersGet200Response +from ..types.folders_list200response import FoldersList200Response +from ..types.folders_update200response import FoldersUpdate200Response +from .raw_client import AsyncRawFoldersClient, RawFoldersClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class FoldersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFoldersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawFoldersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFoldersClient + """ + return self._raw_client + + def list( + self, + tenant_id: str, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + parent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> FoldersList200Response: + """ + Parameters + ---------- + tenant_id : str + + limit : typing.Optional[int] + + cursor : typing.Optional[str] + + parent_id : typing.Optional[str] + Only the folders directly in this folder (root: the top level). Without it, every folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersList200Response + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.list( + tenant_id="tenantId", + ) + """ + _response = self._raw_client.list( + tenant_id, limit=limit, cursor=cursor, parent_id=parent_id, request_options=request_options + ) + return _response.data + + def create( + self, + tenant_id: str, + *, + name: str, + parent_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> FoldersCreate200Response: + """ + 409 Conflict carries `details.reason`: `name-taken` (a sibling has the name, ignoring case; `details.name`) or `too-deep` (folders nest at most 100 levels; `details.maxDepth`). 404 when the parent folder does not exist. + + Parameters + ---------- + tenant_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + parent_id : typing.Optional[str] + A folder id, or root for the top level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersCreate200Response + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.create( + tenant_id="tenantId", + name="name", + ) + """ + _response = self._raw_client.create(tenant_id, name=name, parent_id=parent_id, request_options=request_options) + return _response.data + + def get( + self, tenant_id: str, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> FoldersGet200Response: + """ + Parameters + ---------- + tenant_id : str + + folder_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersGet200Response + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.get( + tenant_id="tenantId", + folder_id="folderId", + ) + """ + _response = self._raw_client.get(tenant_id, folder_id, request_options=request_options) + return _response.data + + def delete( + self, + tenant_id: str, + folder_id: str, + *, + recursive: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Without recursive, a folder with anything inside is refused: 409 Conflict with `details.reason` `not-empty` and what it holds, counted over every level below, in `details.folders` and `details.documents`. With recursive=true, the folder and every folder under it go at once, and every document in them stops opening, leaves every list and stops answering its share links at once; their stored files and links are removed in the background. Uploads into those folders that have not committed cannot commit. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + recursive : typing.Optional[bool] + true deletes everything in the folder too. Never the default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.delete( + tenant_id="tenantId", + folder_id="folderId", + ) + """ + _response = self._raw_client.delete(tenant_id, folder_id, recursive=recursive, request_options=request_options) + return _response.data + + def update( + self, tenant_id: str, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> FoldersUpdate200Response: + """ + 409 Conflict with `details.reason` `name-taken` when a sibling has the name, ignoring case. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersUpdate200Response + OK + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.update( + tenant_id="tenantId", + folder_id="folderId", + name="name", + ) + """ + _response = self._raw_client.update(tenant_id, folder_id, name=name, request_options=request_options) + return _response.data + + def move_into( + self, + tenant_id: str, + folder_id: str, + *, + document_ids: typing.Optional[typing.Sequence[str]] = OMIT, + folder_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Up to 1,000 ids in total. A folder moves with everything in it. 404 NotFound names the ids that do not exist or are being deleted in `details.documentIds` and `details.folderIds`. 409 Conflict carries `details.reason`: `cycle` (the destination is a moved folder or inside one; `details.folderId`), `too-deep` (the move would nest folders deeper than 100 levels; `details.maxDepth`) or `name-taken` (a moved folder's name is taken in the destination, ignoring case; `details.name`). + + Parameters + ---------- + tenant_id : str + + folder_id : str + A folder id, or root for the top level. + + document_ids : typing.Optional[typing.Sequence[str]] + + folder_ids : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from cloudpdf import CloudPDFClient + + client = CloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.folders.move_into( + tenant_id="tenantId", + folder_id="folderId", + ) + """ + _response = self._raw_client.move_into( + tenant_id, folder_id, document_ids=document_ids, folder_ids=folder_ids, request_options=request_options + ) + return _response.data + + +class AsyncFoldersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFoldersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawFoldersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFoldersClient + """ + return self._raw_client + + async def list( + self, + tenant_id: str, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + parent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> FoldersList200Response: + """ + Parameters + ---------- + tenant_id : str + + limit : typing.Optional[int] + + cursor : typing.Optional[str] + + parent_id : typing.Optional[str] + Only the folders directly in this folder (root: the top level). Without it, every folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersList200Response + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.list( + tenant_id="tenantId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + tenant_id, limit=limit, cursor=cursor, parent_id=parent_id, request_options=request_options + ) + return _response.data + + async def create( + self, + tenant_id: str, + *, + name: str, + parent_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> FoldersCreate200Response: + """ + 409 Conflict carries `details.reason`: `name-taken` (a sibling has the name, ignoring case; `details.name`) or `too-deep` (folders nest at most 100 levels; `details.maxDepth`). 404 when the parent folder does not exist. + + Parameters + ---------- + tenant_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + parent_id : typing.Optional[str] + A folder id, or root for the top level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersCreate200Response + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.create( + tenant_id="tenantId", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + tenant_id, name=name, parent_id=parent_id, request_options=request_options + ) + return _response.data + + async def get( + self, tenant_id: str, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> FoldersGet200Response: + """ + Parameters + ---------- + tenant_id : str + + folder_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersGet200Response + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.get( + tenant_id="tenantId", + folder_id="folderId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(tenant_id, folder_id, request_options=request_options) + return _response.data + + async def delete( + self, + tenant_id: str, + folder_id: str, + *, + recursive: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Without recursive, a folder with anything inside is refused: 409 Conflict with `details.reason` `not-empty` and what it holds, counted over every level below, in `details.folders` and `details.documents`. With recursive=true, the folder and every folder under it go at once, and every document in them stops opening, leaves every list and stops answering its share links at once; their stored files and links are removed in the background. Uploads into those folders that have not committed cannot commit. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + recursive : typing.Optional[bool] + true deletes everything in the folder too. Never the default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.delete( + tenant_id="tenantId", + folder_id="folderId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete( + tenant_id, folder_id, recursive=recursive, request_options=request_options + ) + return _response.data + + async def update( + self, tenant_id: str, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> FoldersUpdate200Response: + """ + 409 Conflict with `details.reason` `name-taken` when a sibling has the name, ignoring case. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + FoldersUpdate200Response + OK + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.update( + tenant_id="tenantId", + folder_id="folderId", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(tenant_id, folder_id, name=name, request_options=request_options) + return _response.data + + async def move_into( + self, + tenant_id: str, + folder_id: str, + *, + document_ids: typing.Optional[typing.Sequence[str]] = OMIT, + folder_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Up to 1,000 ids in total. A folder moves with everything in it. 404 NotFound names the ids that do not exist or are being deleted in `details.documentIds` and `details.folderIds`. 409 Conflict carries `details.reason`: `cycle` (the destination is a moved folder or inside one; `details.folderId`), `too-deep` (the move would nest folders deeper than 100 levels; `details.maxDepth`) or `name-taken` (a moved folder's name is taken in the destination, ignoring case; `details.name`). + + Parameters + ---------- + tenant_id : str + + folder_id : str + A folder id, or root for the top level. + + document_ids : typing.Optional[typing.Sequence[str]] + + folder_ids : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from cloudpdf import AsyncCloudPDFClient + + client = AsyncCloudPDFClient( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.folders.move_into( + tenant_id="tenantId", + folder_id="folderId", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.move_into( + tenant_id, folder_id, document_ids=document_ids, folder_ids=folder_ids, request_options=request_options + ) + return _response.data diff --git a/src/cloudpdf/folders/raw_client.py b/src/cloudpdf/folders/raw_client.py new file mode 100644 index 0000000..33ccc1b --- /dev/null +++ b/src/cloudpdf/folders/raw_client.py @@ -0,0 +1,1108 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import encode_path_param +from ..core.parse_error import ParsingError +from ..core.pydantic_utilities import parse_obj_as +from ..core.request_options import RequestOptions +from ..errors.bad_request_error import BadRequestError +from ..errors.conflict_error import ConflictError +from ..errors.forbidden_error import ForbiddenError +from ..errors.not_found_error import NotFoundError +from ..types.folders_create200response import FoldersCreate200Response +from ..types.folders_get200response import FoldersGet200Response +from ..types.folders_list200response import FoldersList200Response +from ..types.folders_update200response import FoldersUpdate200Response +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawFoldersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + tenant_id: str, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + parent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[FoldersList200Response]: + """ + Parameters + ---------- + tenant_id : str + + limit : typing.Optional[int] + + cursor : typing.Optional[str] + + parent_id : typing.Optional[str] + Only the folders directly in this folder (root: the top level). Without it, every folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[FoldersList200Response] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders", + method="GET", + params={ + "limit": limit, + "cursor": cursor, + "parentId": parent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersList200Response, + parse_obj_as( + type_=FoldersList200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 create( + self, + tenant_id: str, + *, + name: str, + parent_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[FoldersCreate200Response]: + """ + 409 Conflict carries `details.reason`: `name-taken` (a sibling has the name, ignoring case; `details.name`) or `too-deep` (folders nest at most 100 levels; `details.maxDepth`). 404 when the parent folder does not exist. + + Parameters + ---------- + tenant_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + parent_id : typing.Optional[str] + A folder id, or root for the top level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[FoldersCreate200Response] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders", + method="POST", + json={ + "name": name, + "parentId": parent_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersCreate200Response, + parse_obj_as( + type_=FoldersCreate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 get( + self, tenant_id: str, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[FoldersGet200Response]: + """ + Parameters + ---------- + tenant_id : str + + folder_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[FoldersGet200Response] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersGet200Response, + parse_obj_as( + type_=FoldersGet200Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 delete( + self, + tenant_id: str, + folder_id: str, + *, + recursive: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Without recursive, a folder with anything inside is refused: 409 Conflict with `details.reason` `not-empty` and what it holds, counted over every level below, in `details.folders` and `details.documents`. With recursive=true, the folder and every folder under it go at once, and every document in them stops opening, leaves every list and stops answering its share links at once; their stored files and links are removed in the background. Uploads into those folders that have not committed cannot commit. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + recursive : typing.Optional[bool] + true deletes everything in the folder too. Never the default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="DELETE", + params={ + "recursive": recursive, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 update( + self, tenant_id: str, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[FoldersUpdate200Response]: + """ + 409 Conflict with `details.reason` `name-taken` when a sibling has the name, ignoring case. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[FoldersUpdate200Response] + OK + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersUpdate200Response, + parse_obj_as( + type_=FoldersUpdate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 move_into( + self, + tenant_id: str, + folder_id: str, + *, + document_ids: typing.Optional[typing.Sequence[str]] = OMIT, + folder_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Up to 1,000 ids in total. A folder moves with everything in it. 404 NotFound names the ids that do not exist or are being deleted in `details.documentIds` and `details.folderIds`. 409 Conflict carries `details.reason`: `cycle` (the destination is a moved folder or inside one; `details.folderId`), `too-deep` (the move would nest folders deeper than 100 levels; `details.maxDepth`) or `name-taken` (a moved folder's name is taken in the destination, ignoring case; `details.name`). + + Parameters + ---------- + tenant_id : str + + folder_id : str + A folder id, or root for the top level. + + document_ids : typing.Optional[typing.Sequence[str]] + + folder_ids : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}/move-into", + method="POST", + json={ + "documentIds": document_ids, + "folderIds": folder_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 AsyncRawFoldersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + tenant_id: str, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + parent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[FoldersList200Response]: + """ + Parameters + ---------- + tenant_id : str + + limit : typing.Optional[int] + + cursor : typing.Optional[str] + + parent_id : typing.Optional[str] + Only the folders directly in this folder (root: the top level). Without it, every folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[FoldersList200Response] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders", + method="GET", + params={ + "limit": limit, + "cursor": cursor, + "parentId": parent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersList200Response, + parse_obj_as( + type_=FoldersList200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 create( + self, + tenant_id: str, + *, + name: str, + parent_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[FoldersCreate200Response]: + """ + 409 Conflict carries `details.reason`: `name-taken` (a sibling has the name, ignoring case; `details.name`) or `too-deep` (folders nest at most 100 levels; `details.maxDepth`). 404 when the parent folder does not exist. + + Parameters + ---------- + tenant_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + parent_id : typing.Optional[str] + A folder id, or root for the top level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[FoldersCreate200Response] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders", + method="POST", + json={ + "name": name, + "parentId": parent_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersCreate200Response, + parse_obj_as( + type_=FoldersCreate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 get( + self, tenant_id: str, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[FoldersGet200Response]: + """ + Parameters + ---------- + tenant_id : str + + folder_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[FoldersGet200Response] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersGet200Response, + parse_obj_as( + type_=FoldersGet200Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 delete( + self, + tenant_id: str, + folder_id: str, + *, + recursive: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Without recursive, a folder with anything inside is refused: 409 Conflict with `details.reason` `not-empty` and what it holds, counted over every level below, in `details.folders` and `details.documents`. With recursive=true, the folder and every folder under it go at once, and every document in them stops opening, leaves every list and stops answering its share links at once; their stored files and links are removed in the background. Uploads into those folders that have not committed cannot commit. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + recursive : typing.Optional[bool] + true deletes everything in the folder too. Never the default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="DELETE", + params={ + "recursive": recursive, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 update( + self, tenant_id: str, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[FoldersUpdate200Response]: + """ + 409 Conflict with `details.reason` `name-taken` when a sibling has the name, ignoring case. + + Parameters + ---------- + tenant_id : str + + folder_id : str + + name : str + What people call the folder: 1 to 255 characters, no control characters, no leading or trailing whitespace, and unique among the folder's siblings, ignoring case. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[FoldersUpdate200Response] + OK + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + FoldersUpdate200Response, + parse_obj_as( + type_=FoldersUpdate200Response, # 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( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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 move_into( + self, + tenant_id: str, + folder_id: str, + *, + document_ids: typing.Optional[typing.Sequence[str]] = OMIT, + folder_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Up to 1,000 ids in total. A folder moves with everything in it. 404 NotFound names the ids that do not exist or are being deleted in `details.documentIds` and `details.folderIds`. 409 Conflict carries `details.reason`: `cycle` (the destination is a moved folder or inside one; `details.folderId`), `too-deep` (the move would nest folders deeper than 100 levels; `details.maxDepth`) or `name-taken` (a moved folder's name is taken in the destination, ignoring case; `details.name`). + + Parameters + ---------- + tenant_id : str + + folder_id : str + A folder id, or root for the top level. + + document_ids : typing.Optional[typing.Sequence[str]] + + folder_ids : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/tenants/{encode_path_param(tenant_id)}/folders/{encode_path_param(folder_id)}/move-into", + method="POST", + json={ + "documentIds": document_ids, + "folderIds": folder_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # 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/shares/client.py b/src/cloudpdf/shares/client.py index 90b9520..28e9e6e 100644 --- a/src/cloudpdf/shares/client.py +++ b/src/cloudpdf/shares/client.py @@ -6,6 +6,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions +from ..types.identity import Identity from ..types.shares_archive200response import SharesArchive200Response from ..types.shares_create200response import SharesCreate200Response from ..types.shares_exchange200response import SharesExchange200Response @@ -156,6 +157,7 @@ def create( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesCreateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, session_ttl_seconds: typing.Optional[int] = OMIT, @@ -183,6 +185,8 @@ def create( visitor_identity : typing.Optional[SharesCreateRequestVisitorIdentity] + identity : typing.Optional[Identity] + origins : typing.Optional[typing.Sequence[str]] password : typing.Optional[str] @@ -222,6 +226,7 @@ def create( keep_visitor_layers=keep_visitor_layers, visitor_idle_seconds=visitor_idle_seconds, visitor_identity=visitor_identity, + identity=identity, origins=origins, password=password, session_ttl_seconds=session_ttl_seconds, @@ -305,6 +310,7 @@ def update( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesUpdateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, scope: typing.Optional[typing.Sequence[str]] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, @@ -330,6 +336,8 @@ def update( visitor_identity : typing.Optional[SharesUpdateRequestVisitorIdentity] + identity : typing.Optional[Identity] + scope : typing.Optional[typing.Sequence[str]] origins : typing.Optional[typing.Sequence[str]] @@ -371,6 +379,7 @@ def update( keep_visitor_layers=keep_visitor_layers, visitor_idle_seconds=visitor_idle_seconds, visitor_identity=visitor_identity, + identity=identity, scope=scope, origins=origins, password=password, @@ -573,6 +582,7 @@ async def create( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesCreateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, session_ttl_seconds: typing.Optional[int] = OMIT, @@ -600,6 +610,8 @@ async def create( visitor_identity : typing.Optional[SharesCreateRequestVisitorIdentity] + identity : typing.Optional[Identity] + origins : typing.Optional[typing.Sequence[str]] password : typing.Optional[str] @@ -647,6 +659,7 @@ async def main() -> None: keep_visitor_layers=keep_visitor_layers, visitor_idle_seconds=visitor_idle_seconds, visitor_identity=visitor_identity, + identity=identity, origins=origins, password=password, session_ttl_seconds=session_ttl_seconds, @@ -748,6 +761,7 @@ async def update( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesUpdateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, scope: typing.Optional[typing.Sequence[str]] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, @@ -773,6 +787,8 @@ async def update( visitor_identity : typing.Optional[SharesUpdateRequestVisitorIdentity] + identity : typing.Optional[Identity] + scope : typing.Optional[typing.Sequence[str]] origins : typing.Optional[typing.Sequence[str]] @@ -822,6 +838,7 @@ async def main() -> None: keep_visitor_layers=keep_visitor_layers, visitor_idle_seconds=visitor_idle_seconds, visitor_identity=visitor_identity, + identity=identity, scope=scope, origins=origins, password=password, diff --git a/src/cloudpdf/shares/raw_client.py b/src/cloudpdf/shares/raw_client.py index 87fd54f..cf8f911 100644 --- a/src/cloudpdf/shares/raw_client.py +++ b/src/cloudpdf/shares/raw_client.py @@ -17,6 +17,7 @@ from ..errors.gone_error import GoneError from ..errors.not_found_error import NotFoundError from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.identity import Identity from ..types.shares_archive200response import SharesArchive200Response from ..types.shares_create200response import SharesCreate200Response from ..types.shares_exchange200response import SharesExchange200Response @@ -248,6 +249,7 @@ def create( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesCreateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, session_ttl_seconds: typing.Optional[int] = OMIT, @@ -275,6 +277,8 @@ def create( visitor_identity : typing.Optional[SharesCreateRequestVisitorIdentity] + identity : typing.Optional[Identity] + origins : typing.Optional[typing.Sequence[str]] password : typing.Optional[str] @@ -305,6 +309,9 @@ def create( annotation=typing.Optional[SharesCreateRequestVisitorIdentity], direction="write", ), + "identity": convert_and_respect_annotation_metadata( + object_=identity, annotation=typing.Optional[Identity], direction="write" + ), "scope": scope, "origins": origins, "password": password, @@ -488,6 +495,7 @@ def update( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesUpdateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, scope: typing.Optional[typing.Sequence[str]] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, @@ -513,6 +521,8 @@ def update( visitor_identity : typing.Optional[SharesUpdateRequestVisitorIdentity] + identity : typing.Optional[Identity] + scope : typing.Optional[typing.Sequence[str]] origins : typing.Optional[typing.Sequence[str]] @@ -546,6 +556,9 @@ def update( annotation=typing.Optional[SharesUpdateRequestVisitorIdentity], direction="write", ), + "identity": convert_and_respect_annotation_metadata( + object_=identity, annotation=typing.Optional[Identity], direction="write" + ), "scope": scope, "origins": origins, "password": password, @@ -879,6 +892,7 @@ async def create( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesCreateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, session_ttl_seconds: typing.Optional[int] = OMIT, @@ -906,6 +920,8 @@ async def create( visitor_identity : typing.Optional[SharesCreateRequestVisitorIdentity] + identity : typing.Optional[Identity] + origins : typing.Optional[typing.Sequence[str]] password : typing.Optional[str] @@ -936,6 +952,9 @@ async def create( annotation=typing.Optional[SharesCreateRequestVisitorIdentity], direction="write", ), + "identity": convert_and_respect_annotation_metadata( + object_=identity, annotation=typing.Optional[Identity], direction="write" + ), "scope": scope, "origins": origins, "password": password, @@ -1119,6 +1138,7 @@ async def update( keep_visitor_layers: typing.Optional[bool] = OMIT, visitor_idle_seconds: typing.Optional[int] = OMIT, visitor_identity: typing.Optional[SharesUpdateRequestVisitorIdentity] = OMIT, + identity: typing.Optional[Identity] = OMIT, scope: typing.Optional[typing.Sequence[str]] = OMIT, origins: typing.Optional[typing.Sequence[str]] = OMIT, password: typing.Optional[str] = OMIT, @@ -1144,6 +1164,8 @@ async def update( visitor_identity : typing.Optional[SharesUpdateRequestVisitorIdentity] + identity : typing.Optional[Identity] + scope : typing.Optional[typing.Sequence[str]] origins : typing.Optional[typing.Sequence[str]] @@ -1177,6 +1199,9 @@ async def update( annotation=typing.Optional[SharesUpdateRequestVisitorIdentity], direction="write", ), + "identity": convert_and_respect_annotation_metadata( + object_=identity, annotation=typing.Optional[Identity], direction="write" + ), "scope": scope, "origins": origins, "password": password, diff --git a/src/cloudpdf/types/__init__.py b/src/cloudpdf/types/__init__.py index 998df05..b972621 100644 --- a/src/cloudpdf/types/__init__.py +++ b/src/cloudpdf/types/__init__.py @@ -2197,6 +2197,13 @@ from .documents_list400response import DocumentsList400Response from .documents_thumbnail_response import DocumentsThumbnailResponse from .documents_thumbnail_response_error import DocumentsThumbnailResponseError + from .documents_update200response import DocumentsUpdate200Response + from .documents_update200response_document import DocumentsUpdate200ResponseDocument + from .documents_update200response_document_state import DocumentsUpdate200ResponseDocumentState + from .documents_update200response_document_thumbnail_state import DocumentsUpdate200ResponseDocumentThumbnailState + from .documents_update400response import DocumentsUpdate400Response + from .documents_update403response import DocumentsUpdate403Response + from .documents_update404response import DocumentsUpdate404Response from .documents_upload_proxy200response import DocumentsUploadProxy200Response from .documents_upload_proxy400response import DocumentsUploadProxy400Response from .documents_upload_proxy409response import DocumentsUploadProxy409Response @@ -2209,6 +2216,35 @@ from .field_position_zero import FieldPositionZero from .field_script_write import FieldScriptWrite from .field_script_write_type import FieldScriptWriteType + from .folders_create200response import FoldersCreate200Response + from .folders_create200response_folder import FoldersCreate200ResponseFolder + from .folders_create400response import FoldersCreate400Response + from .folders_create403response import FoldersCreate403Response + from .folders_create404response import FoldersCreate404Response + from .folders_create409response import FoldersCreate409Response + from .folders_delete403response import FoldersDelete403Response + from .folders_delete404response import FoldersDelete404Response + from .folders_delete409response import FoldersDelete409Response + from .folders_get200response import FoldersGet200Response + from .folders_get200response_folder import FoldersGet200ResponseFolder + from .folders_get200response_path_item import FoldersGet200ResponsePathItem + from .folders_get403response import FoldersGet403Response + from .folders_get404response import FoldersGet404Response + from .folders_list200response import FoldersList200Response + from .folders_list200response_folders_item import FoldersList200ResponseFoldersItem + from .folders_list400response import FoldersList400Response + from .folders_list403response import FoldersList403Response + from .folders_list404response import FoldersList404Response + from .folders_move_into400response import FoldersMoveInto400Response + from .folders_move_into403response import FoldersMoveInto403Response + from .folders_move_into404response import FoldersMoveInto404Response + from .folders_move_into409response import FoldersMoveInto409Response + from .folders_update200response import FoldersUpdate200Response + from .folders_update200response_folder import FoldersUpdate200ResponseFolder + from .folders_update400response import FoldersUpdate400Response + from .folders_update403response import FoldersUpdate403Response + from .folders_update404response import FoldersUpdate404Response + from .folders_update409response import FoldersUpdate409Response from .form_field import ( FormField, FormField_Checkbox, @@ -2445,6 +2481,7 @@ from .form_field_value import FormFieldValue from .form_mutation_meta import FormMutationMeta from .form_widget import FormWidget + from .identity import Identity from .metadata_patch import MetadataPatch from .metadata_patch_trapped import MetadataPatchTrapped from .mutation_meta import MutationMeta @@ -2770,11 +2807,7 @@ from .tokens_issue404response import TokensIssue404Response from .tokens_issue_request import TokensIssueRequest, TokensIssueRequest_Doc, TokensIssueRequest_Tenant from .tokens_issue_request_doc import TokensIssueRequestDoc - from .tokens_issue_request_doc_identity import TokensIssueRequestDocIdentity from .tokens_issue_request_tenant import TokensIssueRequestTenant - from .tokens_issue_request_tenant_scope_item import TokensIssueRequestTenantScopeItem - from .tokens_issue_request_tenant_scope_item_one import TokensIssueRequestTenantScopeItemOne - from .tokens_issue_request_tenant_scope_item_zero import TokensIssueRequestTenantScopeItemZero from .tokens_revoke_response import TokensRevokeResponse from .widget_actions_patch import WidgetActionsPatch from .widget_annotation import WidgetAnnotation @@ -4375,6 +4408,13 @@ "DocumentsList400Response": ".documents_list400response", "DocumentsThumbnailResponse": ".documents_thumbnail_response", "DocumentsThumbnailResponseError": ".documents_thumbnail_response_error", + "DocumentsUpdate200Response": ".documents_update200response", + "DocumentsUpdate200ResponseDocument": ".documents_update200response_document", + "DocumentsUpdate200ResponseDocumentState": ".documents_update200response_document_state", + "DocumentsUpdate200ResponseDocumentThumbnailState": ".documents_update200response_document_thumbnail_state", + "DocumentsUpdate400Response": ".documents_update400response", + "DocumentsUpdate403Response": ".documents_update403response", + "DocumentsUpdate404Response": ".documents_update404response", "DocumentsUploadProxy200Response": ".documents_upload_proxy200response", "DocumentsUploadProxy400Response": ".documents_upload_proxy400response", "DocumentsUploadProxy409Response": ".documents_upload_proxy409response", @@ -4387,6 +4427,35 @@ "FieldPositionZero": ".field_position_zero", "FieldScriptWrite": ".field_script_write", "FieldScriptWriteType": ".field_script_write_type", + "FoldersCreate200Response": ".folders_create200response", + "FoldersCreate200ResponseFolder": ".folders_create200response_folder", + "FoldersCreate400Response": ".folders_create400response", + "FoldersCreate403Response": ".folders_create403response", + "FoldersCreate404Response": ".folders_create404response", + "FoldersCreate409Response": ".folders_create409response", + "FoldersDelete403Response": ".folders_delete403response", + "FoldersDelete404Response": ".folders_delete404response", + "FoldersDelete409Response": ".folders_delete409response", + "FoldersGet200Response": ".folders_get200response", + "FoldersGet200ResponseFolder": ".folders_get200response_folder", + "FoldersGet200ResponsePathItem": ".folders_get200response_path_item", + "FoldersGet403Response": ".folders_get403response", + "FoldersGet404Response": ".folders_get404response", + "FoldersList200Response": ".folders_list200response", + "FoldersList200ResponseFoldersItem": ".folders_list200response_folders_item", + "FoldersList400Response": ".folders_list400response", + "FoldersList403Response": ".folders_list403response", + "FoldersList404Response": ".folders_list404response", + "FoldersMoveInto400Response": ".folders_move_into400response", + "FoldersMoveInto403Response": ".folders_move_into403response", + "FoldersMoveInto404Response": ".folders_move_into404response", + "FoldersMoveInto409Response": ".folders_move_into409response", + "FoldersUpdate200Response": ".folders_update200response", + "FoldersUpdate200ResponseFolder": ".folders_update200response_folder", + "FoldersUpdate400Response": ".folders_update400response", + "FoldersUpdate403Response": ".folders_update403response", + "FoldersUpdate404Response": ".folders_update404response", + "FoldersUpdate409Response": ".folders_update409response", "FormField": ".form_field", "FormFieldCheckbox": ".form_field_checkbox", "FormFieldCheckboxDefaultValueEntry": ".form_field_checkbox_default_value_entry", @@ -4589,6 +4658,7 @@ "FormField_Unknown": ".form_field", "FormMutationMeta": ".form_mutation_meta", "FormWidget": ".form_widget", + "Identity": ".identity", "MetadataPatch": ".metadata_patch", "MetadataPatchTrapped": ".metadata_patch_trapped", "MutationMeta": ".mutation_meta", @@ -4830,11 +4900,7 @@ "TokensIssue404Response": ".tokens_issue404response", "TokensIssueRequest": ".tokens_issue_request", "TokensIssueRequestDoc": ".tokens_issue_request_doc", - "TokensIssueRequestDocIdentity": ".tokens_issue_request_doc_identity", "TokensIssueRequestTenant": ".tokens_issue_request_tenant", - "TokensIssueRequestTenantScopeItem": ".tokens_issue_request_tenant_scope_item", - "TokensIssueRequestTenantScopeItemOne": ".tokens_issue_request_tenant_scope_item_one", - "TokensIssueRequestTenantScopeItemZero": ".tokens_issue_request_tenant_scope_item_zero", "TokensIssueRequest_Doc": ".tokens_issue_request", "TokensIssueRequest_Tenant": ".tokens_issue_request", "TokensRevokeResponse": ".tokens_revoke_response", @@ -6461,6 +6527,13 @@ def __dir__(): "DocumentsList400Response", "DocumentsThumbnailResponse", "DocumentsThumbnailResponseError", + "DocumentsUpdate200Response", + "DocumentsUpdate200ResponseDocument", + "DocumentsUpdate200ResponseDocumentState", + "DocumentsUpdate200ResponseDocumentThumbnailState", + "DocumentsUpdate400Response", + "DocumentsUpdate403Response", + "DocumentsUpdate404Response", "DocumentsUploadProxy200Response", "DocumentsUploadProxy400Response", "DocumentsUploadProxy409Response", @@ -6473,6 +6546,35 @@ def __dir__(): "FieldPositionZero", "FieldScriptWrite", "FieldScriptWriteType", + "FoldersCreate200Response", + "FoldersCreate200ResponseFolder", + "FoldersCreate400Response", + "FoldersCreate403Response", + "FoldersCreate404Response", + "FoldersCreate409Response", + "FoldersDelete403Response", + "FoldersDelete404Response", + "FoldersDelete409Response", + "FoldersGet200Response", + "FoldersGet200ResponseFolder", + "FoldersGet200ResponsePathItem", + "FoldersGet403Response", + "FoldersGet404Response", + "FoldersList200Response", + "FoldersList200ResponseFoldersItem", + "FoldersList400Response", + "FoldersList403Response", + "FoldersList404Response", + "FoldersMoveInto400Response", + "FoldersMoveInto403Response", + "FoldersMoveInto404Response", + "FoldersMoveInto409Response", + "FoldersUpdate200Response", + "FoldersUpdate200ResponseFolder", + "FoldersUpdate400Response", + "FoldersUpdate403Response", + "FoldersUpdate404Response", + "FoldersUpdate409Response", "FormField", "FormFieldCheckbox", "FormFieldCheckboxDefaultValueEntry", @@ -6675,6 +6777,7 @@ def __dir__(): "FormField_Unknown", "FormMutationMeta", "FormWidget", + "Identity", "MetadataPatch", "MetadataPatchTrapped", "MutationMeta", @@ -6916,11 +7019,7 @@ def __dir__(): "TokensIssue404Response", "TokensIssueRequest", "TokensIssueRequestDoc", - "TokensIssueRequestDocIdentity", "TokensIssueRequestTenant", - "TokensIssueRequestTenantScopeItem", - "TokensIssueRequestTenantScopeItemOne", - "TokensIssueRequestTenantScopeItemZero", "TokensIssueRequest_Doc", "TokensIssueRequest_Tenant", "TokensRevokeResponse", diff --git a/src/cloudpdf/types/doc_versions_list200response.py b/src/cloudpdf/types/doc_versions_list200response.py index da27292..136bf39 100644 --- a/src/cloudpdf/types/doc_versions_list200response.py +++ b/src/cloudpdf/types/doc_versions_list200response.py @@ -3,12 +3,14 @@ import typing import pydantic +import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from ..core.serialization import FieldMetadata from .doc_versions_list200response_versions_item import DocVersionsList200ResponseVersionsItem class DocVersionsList200Response(UniversalBaseModel): - head: str + base_sha: typing_extensions.Annotated[str, FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha")] versions: typing.List[DocVersionsList200ResponseVersionsItem] if IS_PYDANTIC_V2: diff --git a/src/cloudpdf/types/documents_commit200response_document.py b/src/cloudpdf/types/documents_commit200response_document.py index a90b3fe..c521c5f 100644 --- a/src/cloudpdf/types/documents_commit200response_document.py +++ b/src/cloudpdf/types/documents_commit200response_document.py @@ -13,6 +13,16 @@ class DocumentsCommit200ResponseDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsCommit200ResponseDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_get200response_document.py b/src/cloudpdf/types/documents_get200response_document.py index 721c7c3..7f17c1b 100644 --- a/src/cloudpdf/types/documents_get200response_document.py +++ b/src/cloudpdf/types/documents_get200response_document.py @@ -13,6 +13,16 @@ class DocumentsGet200ResponseDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsGet200ResponseDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_import_from200response_document.py b/src/cloudpdf/types/documents_import_from200response_document.py index 2b6a725..505f98c 100644 --- a/src/cloudpdf/types/documents_import_from200response_document.py +++ b/src/cloudpdf/types/documents_import_from200response_document.py @@ -15,6 +15,16 @@ class DocumentsImportFrom200ResponseDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsImportFrom200ResponseDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_import_from202response_document.py b/src/cloudpdf/types/documents_import_from202response_document.py index 7142127..3ff63c4 100644 --- a/src/cloudpdf/types/documents_import_from202response_document.py +++ b/src/cloudpdf/types/documents_import_from202response_document.py @@ -15,6 +15,16 @@ class DocumentsImportFrom202ResponseDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsImportFrom202ResponseDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_init200response_created_document.py b/src/cloudpdf/types/documents_init200response_created_document.py index 3ad649b..3ff8cc4 100644 --- a/src/cloudpdf/types/documents_init200response_created_document.py +++ b/src/cloudpdf/types/documents_init200response_created_document.py @@ -15,6 +15,16 @@ class DocumentsInit200ResponseCreatedDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsInit200ResponseCreatedDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_init200response_deduped_document.py b/src/cloudpdf/types/documents_init200response_deduped_document.py index c407987..ddb5364 100644 --- a/src/cloudpdf/types/documents_init200response_deduped_document.py +++ b/src/cloudpdf/types/documents_init200response_deduped_document.py @@ -15,6 +15,16 @@ class DocumentsInit200ResponseDedupedDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsInit200ResponseDedupedDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_init200response_resumed_document.py b/src/cloudpdf/types/documents_init200response_resumed_document.py index 90ff748..c1e37b3 100644 --- a/src/cloudpdf/types/documents_init200response_resumed_document.py +++ b/src/cloudpdf/types/documents_init200response_resumed_document.py @@ -15,6 +15,16 @@ class DocumentsInit200ResponseResumedDocument(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsInit200ResponseResumedDocumentState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_list200response_documents_item.py b/src/cloudpdf/types/documents_list200response_documents_item.py index 39a6474..2812c40 100644 --- a/src/cloudpdf/types/documents_list200response_documents_item.py +++ b/src/cloudpdf/types/documents_list200response_documents_item.py @@ -15,6 +15,16 @@ class DocumentsList200ResponseDocumentsItem(UniversalBaseModel): id: str tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + state: DocumentsList200ResponseDocumentsItemState base_sha: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") diff --git a/src/cloudpdf/types/documents_update200response.py b/src/cloudpdf/types/documents_update200response.py new file mode 100644 index 0000000..08d4b96 --- /dev/null +++ b/src/cloudpdf/types/documents_update200response.py @@ -0,0 +1,20 @@ +# 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 .documents_update200response_document import DocumentsUpdate200ResponseDocument + + +class DocumentsUpdate200Response(UniversalBaseModel): + document: DocumentsUpdate200ResponseDocument + + 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/documents_update200response_document.py b/src/cloudpdf/types/documents_update200response_document.py new file mode 100644 index 0000000..d0a8493 --- /dev/null +++ b/src/cloudpdf/types/documents_update200response_document.py @@ -0,0 +1,61 @@ +# 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 +from .documents_update200response_document_state import DocumentsUpdate200ResponseDocumentState +from .documents_update200response_document_thumbnail_state import DocumentsUpdate200ResponseDocumentThumbnailState + + +class DocumentsUpdate200ResponseDocument(UniversalBaseModel): + id: str + tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + name: str + folder_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="folderId"), + pydantic.Field(alias="folderId", description="The folder the document is in, or root."), + ] + """ + The folder the document is in, or root. + """ + + state: DocumentsUpdate200ResponseDocumentState + base_sha: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="baseSha"), pydantic.Field(alias="baseSha") + ] = None + storage_size_bytes: typing_extensions.Annotated[ + typing.Optional[float], FieldMetadata(alias="storageSizeBytes"), pydantic.Field(alias="storageSizeBytes") + ] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = None + idempotency_key: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="idempotencyKey"), pydantic.Field(alias="idempotencyKey") + ] = None + failure_reason: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="failureReason"), pydantic.Field(alias="failureReason") + ] = None + thumbnail_state: typing_extensions.Annotated[ + typing.Optional[DocumentsUpdate200ResponseDocumentThumbnailState], + FieldMetadata(alias="thumbnailState"), + pydantic.Field(alias="thumbnailState"), + ] = None + thumbnail_url: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="thumbnailUrl"), pydantic.Field(alias="thumbnailUrl") + ] = None + created_at: typing_extensions.Annotated[float, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")] + updated_at: typing_extensions.Annotated[float, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")] + created_by: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy") + ] = None + + 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/documents_update200response_document_state.py b/src/cloudpdf/types/documents_update200response_document_state.py new file mode 100644 index 0000000..d53c5a3 --- /dev/null +++ b/src/cloudpdf/types/documents_update200response_document_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentsUpdate200ResponseDocumentState = typing.Union[ + typing.Literal["pending", "ready", "failed", "deleting"], typing.Any +] diff --git a/src/cloudpdf/types/documents_update200response_document_thumbnail_state.py b/src/cloudpdf/types/documents_update200response_document_thumbnail_state.py new file mode 100644 index 0000000..c44dd98 --- /dev/null +++ b/src/cloudpdf/types/documents_update200response_document_thumbnail_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentsUpdate200ResponseDocumentThumbnailState = typing.Union[ + typing.Literal["pending", "ready", "locked", "failed"], typing.Any +] diff --git a/src/cloudpdf/types/documents_update400response.py b/src/cloudpdf/types/documents_update400response.py new file mode 100644 index 0000000..51dd33e --- /dev/null +++ b/src/cloudpdf/types/documents_update400response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +DocumentsUpdate400Response = AdminErrorPayload diff --git a/src/cloudpdf/types/documents_update403response.py b/src/cloudpdf/types/documents_update403response.py new file mode 100644 index 0000000..08ba47d --- /dev/null +++ b/src/cloudpdf/types/documents_update403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +DocumentsUpdate403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/documents_update404response.py b/src/cloudpdf/types/documents_update404response.py new file mode 100644 index 0000000..11dd362 --- /dev/null +++ b/src/cloudpdf/types/documents_update404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +DocumentsUpdate404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/engine_error_payload_code.py b/src/cloudpdf/types/engine_error_payload_code.py index df45fb5..7895710 100644 --- a/src/cloudpdf/types/engine_error_payload_code.py +++ b/src/cloudpdf/types/engine_error_payload_code.py @@ -26,7 +26,6 @@ "SigningVersionMismatch", "SignatureRefused", "ProtectedDocument", - "StaleBase", "PayloadTooLarge", "ObjectNumberUnavailable", "LayerFull", diff --git a/src/cloudpdf/types/folders_create200response.py b/src/cloudpdf/types/folders_create200response.py new file mode 100644 index 0000000..151d788 --- /dev/null +++ b/src/cloudpdf/types/folders_create200response.py @@ -0,0 +1,20 @@ +# 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 .folders_create200response_folder import FoldersCreate200ResponseFolder + + +class FoldersCreate200Response(UniversalBaseModel): + folder: FoldersCreate200ResponseFolder + + 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/folders_create200response_folder.py b/src/cloudpdf/types/folders_create200response_folder.py new file mode 100644 index 0000000..62a7411 --- /dev/null +++ b/src/cloudpdf/types/folders_create200response_folder.py @@ -0,0 +1,37 @@ +# 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 FoldersCreate200ResponseFolder(UniversalBaseModel): + id: str + tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + parent_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="parentId"), + pydantic.Field(alias="parentId", description="The folder it is in, or root."), + ] + """ + The folder it is in, or root. + """ + + name: str + created_at: typing_extensions.Annotated[float, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")] + updated_at: typing_extensions.Annotated[float, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")] + created_by: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy") + ] = None + + 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/folders_create400response.py b/src/cloudpdf/types/folders_create400response.py new file mode 100644 index 0000000..7b73edf --- /dev/null +++ b/src/cloudpdf/types/folders_create400response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersCreate400Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_create403response.py b/src/cloudpdf/types/folders_create403response.py new file mode 100644 index 0000000..1e944df --- /dev/null +++ b/src/cloudpdf/types/folders_create403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersCreate403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_create404response.py b/src/cloudpdf/types/folders_create404response.py new file mode 100644 index 0000000..fd273c7 --- /dev/null +++ b/src/cloudpdf/types/folders_create404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersCreate404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_create409response.py b/src/cloudpdf/types/folders_create409response.py new file mode 100644 index 0000000..6e15d71 --- /dev/null +++ b/src/cloudpdf/types/folders_create409response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersCreate409Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_delete403response.py b/src/cloudpdf/types/folders_delete403response.py new file mode 100644 index 0000000..d041064 --- /dev/null +++ b/src/cloudpdf/types/folders_delete403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersDelete403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_delete404response.py b/src/cloudpdf/types/folders_delete404response.py new file mode 100644 index 0000000..039ab2e --- /dev/null +++ b/src/cloudpdf/types/folders_delete404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersDelete404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_delete409response.py b/src/cloudpdf/types/folders_delete409response.py new file mode 100644 index 0000000..7f787a2 --- /dev/null +++ b/src/cloudpdf/types/folders_delete409response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersDelete409Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_get200response.py b/src/cloudpdf/types/folders_get200response.py new file mode 100644 index 0000000..4239ae3 --- /dev/null +++ b/src/cloudpdf/types/folders_get200response.py @@ -0,0 +1,25 @@ +# 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 .folders_get200response_folder import FoldersGet200ResponseFolder +from .folders_get200response_path_item import FoldersGet200ResponsePathItem + + +class FoldersGet200Response(UniversalBaseModel): + folder: FoldersGet200ResponseFolder + path: typing.List[FoldersGet200ResponsePathItem] = pydantic.Field() + """ + The folders above this one, from the top level down. Neither root nor the folder itself. + """ + + 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/folders_get200response_folder.py b/src/cloudpdf/types/folders_get200response_folder.py new file mode 100644 index 0000000..72aa8b1 --- /dev/null +++ b/src/cloudpdf/types/folders_get200response_folder.py @@ -0,0 +1,37 @@ +# 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 FoldersGet200ResponseFolder(UniversalBaseModel): + id: str + tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + parent_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="parentId"), + pydantic.Field(alias="parentId", description="The folder it is in, or root."), + ] + """ + The folder it is in, or root. + """ + + name: str + created_at: typing_extensions.Annotated[float, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")] + updated_at: typing_extensions.Annotated[float, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")] + created_by: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy") + ] = None + + 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/folders_get200response_path_item.py b/src/cloudpdf/types/folders_get200response_path_item.py new file mode 100644 index 0000000..a5084e7 --- /dev/null +++ b/src/cloudpdf/types/folders_get200response_path_item.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class FoldersGet200ResponsePathItem(UniversalBaseModel): + id: str + name: 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 diff --git a/src/cloudpdf/types/folders_get403response.py b/src/cloudpdf/types/folders_get403response.py new file mode 100644 index 0000000..7fc9406 --- /dev/null +++ b/src/cloudpdf/types/folders_get403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersGet403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_get404response.py b/src/cloudpdf/types/folders_get404response.py new file mode 100644 index 0000000..48bf865 --- /dev/null +++ b/src/cloudpdf/types/folders_get404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersGet404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_list200response.py b/src/cloudpdf/types/folders_list200response.py new file mode 100644 index 0000000..ac14dc8 --- /dev/null +++ b/src/cloudpdf/types/folders_list200response.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 +from .folders_list200response_folders_item import FoldersList200ResponseFoldersItem + + +class FoldersList200Response(UniversalBaseModel): + folders: typing.List[FoldersList200ResponseFoldersItem] + next_cursor: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="nextCursor"), pydantic.Field(alias="nextCursor") + ] = None + + 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/folders_list200response_folders_item.py b/src/cloudpdf/types/folders_list200response_folders_item.py new file mode 100644 index 0000000..6619894 --- /dev/null +++ b/src/cloudpdf/types/folders_list200response_folders_item.py @@ -0,0 +1,37 @@ +# 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 FoldersList200ResponseFoldersItem(UniversalBaseModel): + id: str + tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + parent_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="parentId"), + pydantic.Field(alias="parentId", description="The folder it is in, or root."), + ] + """ + The folder it is in, or root. + """ + + name: str + created_at: typing_extensions.Annotated[float, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")] + updated_at: typing_extensions.Annotated[float, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")] + created_by: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy") + ] = None + + 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/folders_list400response.py b/src/cloudpdf/types/folders_list400response.py new file mode 100644 index 0000000..216a21e --- /dev/null +++ b/src/cloudpdf/types/folders_list400response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersList400Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_list403response.py b/src/cloudpdf/types/folders_list403response.py new file mode 100644 index 0000000..b4e8adb --- /dev/null +++ b/src/cloudpdf/types/folders_list403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersList403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_list404response.py b/src/cloudpdf/types/folders_list404response.py new file mode 100644 index 0000000..2f1b393 --- /dev/null +++ b/src/cloudpdf/types/folders_list404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersList404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_move_into400response.py b/src/cloudpdf/types/folders_move_into400response.py new file mode 100644 index 0000000..24f0df5 --- /dev/null +++ b/src/cloudpdf/types/folders_move_into400response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersMoveInto400Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_move_into403response.py b/src/cloudpdf/types/folders_move_into403response.py new file mode 100644 index 0000000..9f070e0 --- /dev/null +++ b/src/cloudpdf/types/folders_move_into403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersMoveInto403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_move_into404response.py b/src/cloudpdf/types/folders_move_into404response.py new file mode 100644 index 0000000..341e790 --- /dev/null +++ b/src/cloudpdf/types/folders_move_into404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersMoveInto404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_move_into409response.py b/src/cloudpdf/types/folders_move_into409response.py new file mode 100644 index 0000000..cb8cc89 --- /dev/null +++ b/src/cloudpdf/types/folders_move_into409response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersMoveInto409Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_update200response.py b/src/cloudpdf/types/folders_update200response.py new file mode 100644 index 0000000..be9321b --- /dev/null +++ b/src/cloudpdf/types/folders_update200response.py @@ -0,0 +1,20 @@ +# 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 .folders_update200response_folder import FoldersUpdate200ResponseFolder + + +class FoldersUpdate200Response(UniversalBaseModel): + folder: FoldersUpdate200ResponseFolder + + 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/folders_update200response_folder.py b/src/cloudpdf/types/folders_update200response_folder.py new file mode 100644 index 0000000..43943e1 --- /dev/null +++ b/src/cloudpdf/types/folders_update200response_folder.py @@ -0,0 +1,37 @@ +# 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 FoldersUpdate200ResponseFolder(UniversalBaseModel): + id: str + tenant_id: typing_extensions.Annotated[str, FieldMetadata(alias="tenantId"), pydantic.Field(alias="tenantId")] + parent_id: typing_extensions.Annotated[ + str, + FieldMetadata(alias="parentId"), + pydantic.Field(alias="parentId", description="The folder it is in, or root."), + ] + """ + The folder it is in, or root. + """ + + name: str + created_at: typing_extensions.Annotated[float, FieldMetadata(alias="createdAt"), pydantic.Field(alias="createdAt")] + updated_at: typing_extensions.Annotated[float, FieldMetadata(alias="updatedAt"), pydantic.Field(alias="updatedAt")] + created_by: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="createdBy"), pydantic.Field(alias="createdBy") + ] = None + + 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/folders_update400response.py b/src/cloudpdf/types/folders_update400response.py new file mode 100644 index 0000000..5ea7052 --- /dev/null +++ b/src/cloudpdf/types/folders_update400response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersUpdate400Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_update403response.py b/src/cloudpdf/types/folders_update403response.py new file mode 100644 index 0000000..8a7b590 --- /dev/null +++ b/src/cloudpdf/types/folders_update403response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersUpdate403Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_update404response.py b/src/cloudpdf/types/folders_update404response.py new file mode 100644 index 0000000..964ce1d --- /dev/null +++ b/src/cloudpdf/types/folders_update404response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersUpdate404Response = AdminErrorPayload diff --git a/src/cloudpdf/types/folders_update409response.py b/src/cloudpdf/types/folders_update409response.py new file mode 100644 index 0000000..ace53c8 --- /dev/null +++ b/src/cloudpdf/types/folders_update409response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .admin_error_payload import AdminErrorPayload + +FoldersUpdate409Response = AdminErrorPayload diff --git a/src/cloudpdf/types/tokens_issue_request_doc_identity.py b/src/cloudpdf/types/identity.py similarity index 95% rename from src/cloudpdf/types/tokens_issue_request_doc_identity.py rename to src/cloudpdf/types/identity.py index 1362ef7..4b03e96 100644 --- a/src/cloudpdf/types/tokens_issue_request_doc_identity.py +++ b/src/cloudpdf/types/identity.py @@ -8,7 +8,7 @@ from ..core.serialization import FieldMetadata -class TokensIssueRequestDocIdentity(UniversalBaseModel): +class Identity(UniversalBaseModel): user_id: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="userId"), pydantic.Field(alias="userId") ] = None diff --git a/src/cloudpdf/types/shares_archive200response_share.py b/src/cloudpdf/types/shares_archive200response_share.py index 81e3678..7ebd063 100644 --- a/src/cloudpdf/types/shares_archive200response_share.py +++ b/src/cloudpdf/types/shares_archive200response_share.py @@ -6,6 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .identity import Identity from .shares_archive200response_share_layer_mode import SharesArchive200ResponseShareLayerMode from .shares_archive200response_share_visitor_identity import SharesArchive200ResponseShareVisitorIdentity @@ -31,6 +32,7 @@ class SharesArchive200ResponseShare(UniversalBaseModel): FieldMetadata(alias="visitorIdentity"), pydantic.Field(alias="visitorIdentity"), ] = None + identity: typing.Optional[Identity] = None scope: typing.List[str] origins: typing.Optional[typing.List[str]] = None password_protected: typing_extensions.Annotated[ diff --git a/src/cloudpdf/types/shares_create200response_share.py b/src/cloudpdf/types/shares_create200response_share.py index 62fa576..73b9179 100644 --- a/src/cloudpdf/types/shares_create200response_share.py +++ b/src/cloudpdf/types/shares_create200response_share.py @@ -6,6 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .identity import Identity from .shares_create200response_share_layer_mode import SharesCreate200ResponseShareLayerMode from .shares_create200response_share_visitor_identity import SharesCreate200ResponseShareVisitorIdentity @@ -31,6 +32,7 @@ class SharesCreate200ResponseShare(UniversalBaseModel): FieldMetadata(alias="visitorIdentity"), pydantic.Field(alias="visitorIdentity"), ] = None + identity: typing.Optional[Identity] = None scope: typing.List[str] origins: typing.Optional[typing.List[str]] = None password_protected: typing_extensions.Annotated[ diff --git a/src/cloudpdf/types/shares_get200response_share.py b/src/cloudpdf/types/shares_get200response_share.py index 00d32bf..b44509c 100644 --- a/src/cloudpdf/types/shares_get200response_share.py +++ b/src/cloudpdf/types/shares_get200response_share.py @@ -6,6 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .identity import Identity from .shares_get200response_share_layer_mode import SharesGet200ResponseShareLayerMode from .shares_get200response_share_visitor_identity import SharesGet200ResponseShareVisitorIdentity @@ -31,6 +32,7 @@ class SharesGet200ResponseShare(UniversalBaseModel): FieldMetadata(alias="visitorIdentity"), pydantic.Field(alias="visitorIdentity"), ] = None + identity: typing.Optional[Identity] = None scope: typing.List[str] origins: typing.Optional[typing.List[str]] = None password_protected: typing_extensions.Annotated[ diff --git a/src/cloudpdf/types/shares_list200response_shares_item.py b/src/cloudpdf/types/shares_list200response_shares_item.py index 75139da..a82c5d6 100644 --- a/src/cloudpdf/types/shares_list200response_shares_item.py +++ b/src/cloudpdf/types/shares_list200response_shares_item.py @@ -6,6 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .identity import Identity from .shares_list200response_shares_item_layer_mode import SharesList200ResponseSharesItemLayerMode from .shares_list200response_shares_item_visitor_identity import SharesList200ResponseSharesItemVisitorIdentity @@ -31,6 +32,7 @@ class SharesList200ResponseSharesItem(UniversalBaseModel): FieldMetadata(alias="visitorIdentity"), pydantic.Field(alias="visitorIdentity"), ] = None + identity: typing.Optional[Identity] = None scope: typing.List[str] origins: typing.Optional[typing.List[str]] = None password_protected: typing_extensions.Annotated[ diff --git a/src/cloudpdf/types/shares_update200response_share.py b/src/cloudpdf/types/shares_update200response_share.py index 9bab969..9583552 100644 --- a/src/cloudpdf/types/shares_update200response_share.py +++ b/src/cloudpdf/types/shares_update200response_share.py @@ -6,6 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata +from .identity import Identity from .shares_update200response_share_layer_mode import SharesUpdate200ResponseShareLayerMode from .shares_update200response_share_visitor_identity import SharesUpdate200ResponseShareVisitorIdentity @@ -31,6 +32,7 @@ class SharesUpdate200ResponseShare(UniversalBaseModel): FieldMetadata(alias="visitorIdentity"), pydantic.Field(alias="visitorIdentity"), ] = None + identity: typing.Optional[Identity] = None scope: typing.List[str] origins: typing.Optional[typing.List[str]] = None password_protected: typing_extensions.Annotated[ diff --git a/src/cloudpdf/types/tokens_issue_request.py b/src/cloudpdf/types/tokens_issue_request.py index 75a17bb..aff7bda 100644 --- a/src/cloudpdf/types/tokens_issue_request.py +++ b/src/cloudpdf/types/tokens_issue_request.py @@ -8,8 +8,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata -from .tokens_issue_request_doc_identity import TokensIssueRequestDocIdentity -from .tokens_issue_request_tenant_scope_item import TokensIssueRequestTenantScopeItem +from .identity import Identity class TokensIssueRequest_Doc(UniversalBaseModel): @@ -20,7 +19,7 @@ class TokensIssueRequest_Doc(UniversalBaseModel): typing.Optional[str], FieldMetadata(alias="layerName"), pydantic.Field(alias="layerName") ] = None scope: typing.List[str] - identity: typing.Optional[TokensIssueRequestDocIdentity] = None + identity: typing.Optional[Identity] = None origins: typing.Optional[typing.List[str]] = None expires_in: typing_extensions.Annotated[int, FieldMetadata(alias="expiresIn"), pydantic.Field(alias="expiresIn")] @@ -37,7 +36,7 @@ class Config: class TokensIssueRequest_Tenant(UniversalBaseModel): kind: typing.Literal["tenant"] = "tenant" sub: str - scope: typing.List[TokensIssueRequestTenantScopeItem] + scope: typing.List[str] expires_in: typing_extensions.Annotated[int, FieldMetadata(alias="expiresIn"), pydantic.Field(alias="expiresIn")] if IS_PYDANTIC_V2: diff --git a/src/cloudpdf/types/tokens_issue_request_doc.py b/src/cloudpdf/types/tokens_issue_request_doc.py index 13e8327..8958746 100644 --- a/src/cloudpdf/types/tokens_issue_request_doc.py +++ b/src/cloudpdf/types/tokens_issue_request_doc.py @@ -6,7 +6,7 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata -from .tokens_issue_request_doc_identity import TokensIssueRequestDocIdentity +from .identity import Identity class TokensIssueRequestDoc(UniversalBaseModel): @@ -16,7 +16,7 @@ class TokensIssueRequestDoc(UniversalBaseModel): typing.Optional[str], FieldMetadata(alias="layerName"), pydantic.Field(alias="layerName") ] = None scope: typing.List[str] - identity: typing.Optional[TokensIssueRequestDocIdentity] = None + identity: typing.Optional[Identity] = None origins: typing.Optional[typing.List[str]] = None expires_in: typing_extensions.Annotated[int, FieldMetadata(alias="expiresIn"), pydantic.Field(alias="expiresIn")] diff --git a/src/cloudpdf/types/tokens_issue_request_tenant.py b/src/cloudpdf/types/tokens_issue_request_tenant.py index b61cf43..4bbb9e8 100644 --- a/src/cloudpdf/types/tokens_issue_request_tenant.py +++ b/src/cloudpdf/types/tokens_issue_request_tenant.py @@ -6,12 +6,11 @@ import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel from ..core.serialization import FieldMetadata -from .tokens_issue_request_tenant_scope_item import TokensIssueRequestTenantScopeItem class TokensIssueRequestTenant(UniversalBaseModel): sub: str - scope: typing.List[TokensIssueRequestTenantScopeItem] + scope: typing.List[str] expires_in: typing_extensions.Annotated[int, FieldMetadata(alias="expiresIn"), pydantic.Field(alias="expiresIn")] if IS_PYDANTIC_V2: diff --git a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item.py b/src/cloudpdf/types/tokens_issue_request_tenant_scope_item.py deleted file mode 100644 index 8bf41c9..0000000 --- a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .tokens_issue_request_tenant_scope_item_one import TokensIssueRequestTenantScopeItemOne -from .tokens_issue_request_tenant_scope_item_zero import TokensIssueRequestTenantScopeItemZero - -TokensIssueRequestTenantScopeItem = typing.Union[ - TokensIssueRequestTenantScopeItemZero, TokensIssueRequestTenantScopeItemOne -] diff --git a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_one.py b/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_one.py deleted file mode 100644 index 34d0d73..0000000 --- a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_one.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -TokensIssueRequestTenantScopeItemOne = typing.Union[ - typing.Literal["docs.create", "docs.read", "docs.delete", "tokens.issue-doc", "tokens.revoke", "shares.manage"], - typing.Any, -] diff --git a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_zero.py b/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_zero.py deleted file mode 100644 index 35273ab..0000000 --- a/src/cloudpdf/types/tokens_issue_request_tenant_scope_item_zero.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -TokensIssueRequestTenantScopeItemZero = typing.Union[typing.Literal["*"], typing.Any]