docges-api-py 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docges_api_py-0.1.6/src/docges_api_py.egg-info → docges_api_py-0.1.7}/PKG-INFO +2 -2
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/README.md +1 -1
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/pyproject.toml +1 -1
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/client.py +9 -2
- {docges_api_py-0.1.6 → docges_api_py-0.1.7/src/docges_api_py.egg-info}/PKG-INFO +2 -2
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_check_dir_struct.py +36 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/LICENSE +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/setup.cfg +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/__init__.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/models/__init__.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/models/auth.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/models/document.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/models/requests.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py/models/responses.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py.egg-info/SOURCES.txt +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py.egg-info/dependency_links.txt +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py.egg-info/requires.txt +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/src/docges_api_py.egg-info/top_level.txt +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_client_auth.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_content_methods.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_endpoints.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_examples.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_get_document.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_initial_cats.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_models_auth.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_models_init.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_models_requests.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_models_responses.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_remaining_methods.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_retry.py +0 -0
- {docges_api_py-0.1.6 → docges_api_py-0.1.7}/tests/test_token_refresh.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docges-api-py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Async, typed Python client for DocGes REST API
|
|
5
5
|
Author-email: "ct.galega" <soporte@ctgalega.com>
|
|
6
6
|
License: MIT
|
|
@@ -78,7 +78,7 @@ pip install -e ".[dev]"
|
|
|
78
78
|
| `create_category(parent_sid, name)` | `POST /Content/CreateCategory` | Create a subcategory |
|
|
79
79
|
| `rename_category(sid, new_name)` | `POST /Content/RenameCategory` | Rename a category |
|
|
80
80
|
| `delete_category(sid)` | `POST /Content/DeleteCategory` | Delete a category |
|
|
81
|
-
| `check_dir_struct(root_sid, path_names, create_if_not_exist)` | — | Check or create nested directory structure |
|
|
81
|
+
| `check_dir_struct(root_sid, path_names, create_if_not_exist, full_info)` | — | Check or create nested directory structure (full_info=False returns only last dir) |
|
|
82
82
|
|
|
83
83
|
### Document Management
|
|
84
84
|
| Method | Endpoint | Description |
|
|
@@ -58,7 +58,7 @@ pip install -e ".[dev]"
|
|
|
58
58
|
| `create_category(parent_sid, name)` | `POST /Content/CreateCategory` | Create a subcategory |
|
|
59
59
|
| `rename_category(sid, new_name)` | `POST /Content/RenameCategory` | Rename a category |
|
|
60
60
|
| `delete_category(sid)` | `POST /Content/DeleteCategory` | Delete a category |
|
|
61
|
-
| `check_dir_struct(root_sid, path_names, create_if_not_exist)` | — | Check or create nested directory structure |
|
|
61
|
+
| `check_dir_struct(root_sid, path_names, create_if_not_exist, full_info)` | — | Check or create nested directory structure (full_info=False returns only last dir) |
|
|
62
62
|
|
|
63
63
|
### Document Management
|
|
64
64
|
| Method | Endpoint | Description |
|
|
@@ -367,7 +367,8 @@ class AsyncDocGes:
|
|
|
367
367
|
root_sid: str,
|
|
368
368
|
path_names: list[str],
|
|
369
369
|
create_if_not_exist: bool = False,
|
|
370
|
-
|
|
370
|
+
full_info: bool = True,
|
|
371
|
+
) -> list[dict] | dict | None:
|
|
371
372
|
"""
|
|
372
373
|
Check or create a directory structure under a given root SID.
|
|
373
374
|
|
|
@@ -380,9 +381,11 @@ class AsyncDocGes:
|
|
|
380
381
|
root_sid: The root SID to start from
|
|
381
382
|
path_names: List of category names to traverse/create (e.g., ["2025", "PM-001"])
|
|
382
383
|
create_if_not_exist: If True, create missing categories
|
|
384
|
+
full_info: If True, returns full path info. If False, returns only last directory.
|
|
383
385
|
|
|
384
386
|
Returns:
|
|
385
387
|
List of dicts with keys: sid, parent_sid, name (one per level)
|
|
388
|
+
OR single dict with sid, parent_sid, name (if full_info=False)
|
|
386
389
|
None on error
|
|
387
390
|
"""
|
|
388
391
|
results: list[dict] = []
|
|
@@ -420,7 +423,11 @@ class AsyncDocGes:
|
|
|
420
423
|
else:
|
|
421
424
|
return None
|
|
422
425
|
|
|
423
|
-
|
|
426
|
+
if full_info:
|
|
427
|
+
return results
|
|
428
|
+
else:
|
|
429
|
+
# Return only the last directory
|
|
430
|
+
return results[-1] if results else None
|
|
424
431
|
|
|
425
432
|
except Exception:
|
|
426
433
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docges-api-py
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Async, typed Python client for DocGes REST API
|
|
5
5
|
Author-email: "ct.galega" <soporte@ctgalega.com>
|
|
6
6
|
License: MIT
|
|
@@ -78,7 +78,7 @@ pip install -e ".[dev]"
|
|
|
78
78
|
| `create_category(parent_sid, name)` | `POST /Content/CreateCategory` | Create a subcategory |
|
|
79
79
|
| `rename_category(sid, new_name)` | `POST /Content/RenameCategory` | Rename a category |
|
|
80
80
|
| `delete_category(sid)` | `POST /Content/DeleteCategory` | Delete a category |
|
|
81
|
-
| `check_dir_struct(root_sid, path_names, create_if_not_exist)` | — | Check or create nested directory structure |
|
|
81
|
+
| `check_dir_struct(root_sid, path_names, create_if_not_exist, full_info)` | — | Check or create nested directory structure (full_info=False returns only last dir) |
|
|
82
82
|
|
|
83
83
|
### Document Management
|
|
84
84
|
| Method | Endpoint | Description |
|
|
@@ -133,3 +133,39 @@ async def test_check_dir_struct_mixed_path(client):
|
|
|
133
133
|
{"sid": "sid-2025", "parent_sid": "root-sid", "name": "2025"},
|
|
134
134
|
{"sid": "new-sid-pm", "parent_sid": "sid-2025", "name": "PM-001"},
|
|
135
135
|
]
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@pytest.mark.asyncio
|
|
139
|
+
async def test_check_dir_struct_full_info_false(client):
|
|
140
|
+
"""When full_info=False, returns only the last directory."""
|
|
141
|
+
with respx.mock:
|
|
142
|
+
# First level exists, second needs creation
|
|
143
|
+
respx.post("http://test.example.com/Content/LoadChilds").mock(
|
|
144
|
+
side_effect=[
|
|
145
|
+
httpx.Response(
|
|
146
|
+
200,
|
|
147
|
+
json={
|
|
148
|
+
"result": {
|
|
149
|
+
"CategoriasHijas": [{"SID": "sid-2025", "Nombre": "2025"}],
|
|
150
|
+
"Documentos": [],
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
httpx.Response(
|
|
155
|
+
200,
|
|
156
|
+
json={"result": {"CategoriasHijas": [], "Documentos": []}},
|
|
157
|
+
),
|
|
158
|
+
]
|
|
159
|
+
)
|
|
160
|
+
respx.post("http://test.example.com/Content/CreateCategory").mock(
|
|
161
|
+
return_value=httpx.Response(200, json={"result": "new-sid-pm"})
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
result = await client.check_dir_struct(
|
|
165
|
+
root_sid="root-sid",
|
|
166
|
+
path_names=["2025", "PM-001"],
|
|
167
|
+
create_if_not_exist=True,
|
|
168
|
+
full_info=False,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
assert result == {"sid": "new-sid-pm", "parent_sid": "sid-2025", "name": "PM-001"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|