dalux-build 1.0.0__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.
- dalux_build-1.0.0/PKG-INFO +311 -0
- dalux_build-1.0.0/README.md +283 -0
- dalux_build-1.0.0/dalux_build/__init__.py +126 -0
- dalux_build-1.0.0/dalux_build/api/__init__.py +37 -0
- dalux_build-1.0.0/dalux_build/api/companies.py +39 -0
- dalux_build-1.0.0/dalux_build/api/company_catalog.py +61 -0
- dalux_build-1.0.0/dalux_build/api/file_areas.py +25 -0
- dalux_build-1.0.0/dalux_build/api/file_revisions.py +22 -0
- dalux_build-1.0.0/dalux_build/api/file_upload.py +48 -0
- dalux_build-1.0.0/dalux_build/api/files.py +49 -0
- dalux_build-1.0.0/dalux_build/api/folders.py +40 -0
- dalux_build-1.0.0/dalux_build/api/forms.py +29 -0
- dalux_build-1.0.0/dalux_build/api/inspection_plans.py +43 -0
- dalux_build-1.0.0/dalux_build/api/project_templates.py +17 -0
- dalux_build-1.0.0/dalux_build/api/projects.py +55 -0
- dalux_build-1.0.0/dalux_build/api/tasks.py +37 -0
- dalux_build-1.0.0/dalux_build/api/test_plans.py +43 -0
- dalux_build-1.0.0/dalux_build/api/users.py +29 -0
- dalux_build-1.0.0/dalux_build/api/version_sets.py +49 -0
- dalux_build-1.0.0/dalux_build/api/work_packages.py +19 -0
- dalux_build-1.0.0/dalux_build/api_client.py +107 -0
- dalux_build-1.0.0/dalux_build/configuration.py +23 -0
- dalux_build-1.0.0/dalux_build.egg-info/PKG-INFO +311 -0
- dalux_build-1.0.0/dalux_build.egg-info/SOURCES.txt +29 -0
- dalux_build-1.0.0/dalux_build.egg-info/dependency_links.txt +1 -0
- dalux_build-1.0.0/dalux_build.egg-info/requires.txt +8 -0
- dalux_build-1.0.0/dalux_build.egg-info/top_level.txt +1 -0
- dalux_build-1.0.0/pyproject.toml +47 -0
- dalux_build-1.0.0/setup.cfg +4 -0
- dalux_build-1.0.0/tests/test_api.py +421 -0
- dalux_build-1.0.0/tests/test_core.py +105 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dalux-build
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python client for the Dalux Build REST API
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/bruadam/Dalux-Build-API
|
|
7
|
+
Project-URL: Repository, https://github.com/bruadam/Dalux-Build-API
|
|
8
|
+
Project-URL: Issues, https://github.com/bruadam/Dalux-Build-API/issues
|
|
9
|
+
Keywords: dalux,build,api,client,construction
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: requests>=2.28
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
26
|
+
Requires-Dist: responses>=0.25; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=6.0; extra == "dev"
|
|
28
|
+
|
|
29
|
+
# Dalux Build API – Python Client
|
|
30
|
+
|
|
31
|
+
A lightweight Python client for the [Dalux Build REST API](https://app.swaggerhub.com/apis-docs/Dalux/DaluxBuild-api/4.14).
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- Python 3.8 or later
|
|
36
|
+
- [requests](https://pypi.org/project/requests/) ≥ 2.28
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install dalux-build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Getting Started
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from dalux_build import create_client
|
|
48
|
+
|
|
49
|
+
dalux = create_client(
|
|
50
|
+
base_url="https://<your-company>.dalux.com/api",
|
|
51
|
+
api_key="YOUR_API_KEY",
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The returned `DaluxClient` object exposes one attribute per API resource group (see [API Reference](#api-reference) below).
|
|
56
|
+
|
|
57
|
+
### Examples
|
|
58
|
+
|
|
59
|
+
**List all projects**
|
|
60
|
+
```python
|
|
61
|
+
projects = dalux.projects.list_projects()
|
|
62
|
+
print(projects)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Get a specific project**
|
|
66
|
+
```python
|
|
67
|
+
project = dalux.projects.get_project("my-project-id")
|
|
68
|
+
print(project)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**List tasks on a project**
|
|
72
|
+
```python
|
|
73
|
+
tasks = dalux.tasks.get_project_tasks(
|
|
74
|
+
"my-project-id",
|
|
75
|
+
params={"updatedAfter": "2024-01-01"},
|
|
76
|
+
)
|
|
77
|
+
print(tasks)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Upload a file (chunked)**
|
|
81
|
+
```python
|
|
82
|
+
# 1. Create an upload slot
|
|
83
|
+
upload = dalux.file_upload.create_upload(
|
|
84
|
+
"my-project-id", "my-file-area-id",
|
|
85
|
+
{"fileName": "drawing.pdf", "mimeType": "application/pdf"},
|
|
86
|
+
)
|
|
87
|
+
upload_guid = upload["uploadGuid"]
|
|
88
|
+
|
|
89
|
+
# 2. Upload the file content
|
|
90
|
+
with open("drawing.pdf", "rb") as f:
|
|
91
|
+
dalux.file_upload.upload_file_part(
|
|
92
|
+
"my-project-id", "my-file-area-id", upload_guid, f.read()
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# 3. Finalize
|
|
96
|
+
result = dalux.file_upload.finish_upload(
|
|
97
|
+
"my-project-id", "my-file-area-id", upload_guid,
|
|
98
|
+
{"folderId": "target-folder-id"},
|
|
99
|
+
)
|
|
100
|
+
print("New file ID:", result["fileId"])
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Authentication
|
|
104
|
+
|
|
105
|
+
Every request automatically includes the `X-API-KEY` header with the API key supplied to `create_client`. No additional configuration is required.
|
|
106
|
+
|
|
107
|
+
API keys are managed in the Dalux Build UI under _Settings › Integrations › API Identities_. Contact <support@dalux.com> to activate API access for your company profile.
|
|
108
|
+
|
|
109
|
+
## Error Handling
|
|
110
|
+
|
|
111
|
+
All methods raise `requests.HTTPError` on 4xx / 5xx responses:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import requests
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
project = dalux.projects.get_project("unknown-id")
|
|
118
|
+
except requests.HTTPError as exc:
|
|
119
|
+
print(exc.response.status_code, exc.response.json())
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## API Reference
|
|
123
|
+
|
|
124
|
+
| Attribute | Class | Description |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `projects` | `ProjectsApi` | List, get, create and update projects; project metadata |
|
|
127
|
+
| `companies` | `CompaniesApi` | Project companies (CRUD) |
|
|
128
|
+
| `company_catalog` | `CompanyCatalogApi` | Company catalog (CRUD + metadata) |
|
|
129
|
+
| `tasks` | `TasksApi` | Tasks, approvals, safety issues, observations & good practices |
|
|
130
|
+
| `file_areas` | `FileAreasApi` | File areas on a project |
|
|
131
|
+
| `files` | `FilesApi` | Files within a file area |
|
|
132
|
+
| `folders` | `FoldersApi` | Folders within a file area |
|
|
133
|
+
| `file_upload` | `FileUploadApi` | Chunked upload (create → part → finalize) |
|
|
134
|
+
| `file_revisions` | `FileRevisionsApi` | Download file revision content |
|
|
135
|
+
| `forms` | `FormsApi` | Forms and form attachments |
|
|
136
|
+
| `users` | `UsersApi` | Company and project users |
|
|
137
|
+
| `project_templates` | `ProjectTemplatesApi` | Available project templates |
|
|
138
|
+
| `inspection_plans` | `InspectionPlansApi` | Inspection plans, items, zones, registrations |
|
|
139
|
+
| `test_plans` | `TestPlansApi` | Test plans, items, zones, registrations |
|
|
140
|
+
| `version_sets` | `VersionSetsApi` | Version sets and version set files |
|
|
141
|
+
| `work_packages` | `WorkPackagesApi` | Work packages on a project |
|
|
142
|
+
|
|
143
|
+
### ProjectsApi
|
|
144
|
+
|
|
145
|
+
| Method | HTTP | Path |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| `list_projects(params=None)` | GET | `/5.1/projects` |
|
|
148
|
+
| `get_project(project_id)` | GET | `/5.0/projects/{projectId}` |
|
|
149
|
+
| `create_project(body)` | POST | `/5.0/projects` |
|
|
150
|
+
| `update_project(project_id, body)` | PATCH | `/5.0/projects/{projectId}` |
|
|
151
|
+
| `list_metadata_mappings_for_projects()` | GET | `/1.0/projects/metadata/1.0/mappings` |
|
|
152
|
+
| `list_metadata_values_for_projects(key)` | GET | `/1.0/projects/metadata/1.0/mappings/{key}/values` |
|
|
153
|
+
| `list_project_metadata(project_id)` | GET | `/1.0/projects/{projectId}/metadata` |
|
|
154
|
+
| `list_project_metadata_mappings(project_id)` | GET | `/1.0/projects/{projectId}/metadata/1.0/mappings` |
|
|
155
|
+
| `list_project_metadata_values(project_id, key)` | GET | `/1.0/projects/{projectId}/metadata/1.0/mappings/{key}/values` |
|
|
156
|
+
|
|
157
|
+
### CompaniesApi
|
|
158
|
+
|
|
159
|
+
| Method | HTTP | Path |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `list_project_companies(project_id, params=None)` | GET | `/3.1/projects/{projectId}/companies` |
|
|
162
|
+
| `get_project_company(project_id, company_id)` | GET | `/3.0/projects/{projectId}/companies/{companyId}` |
|
|
163
|
+
| `create_project_company(project_id, body)` | POST | `/3.1/projects/{projectId}/companies` |
|
|
164
|
+
| `update_project_company(project_id, company_id, body)` | PATCH | `/3.0/projects/{projectId}/companies/{companyId}` |
|
|
165
|
+
|
|
166
|
+
### CompanyCatalogApi
|
|
167
|
+
|
|
168
|
+
| Method | HTTP | Path |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `get_companies(params=None)` | GET | `/2.2/companyCatalog` |
|
|
171
|
+
| `get_company(catalog_company_id)` | GET | `/1.2/companyCatalog/{catalogCompanyId}` |
|
|
172
|
+
| `create_company(body)` | POST | `/2.2/companyCatalog` |
|
|
173
|
+
| `update_company(catalog_company_id, body)` | PATCH | `/2.1/companyCatalog/{catalogCompanyId}` |
|
|
174
|
+
| `list_company_metadata(catalog_company_id)` | GET | `/1.0/companyCatalog/{catalogCompanyId}/metadata` |
|
|
175
|
+
| `list_company_metadata_mappings(catalog_company_id)` | GET | `/1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings` |
|
|
176
|
+
| `list_company_metadata_values(catalog_company_id, key)` | GET | `/1.0/.../metadata/1.0/mappings/{key}/values` |
|
|
177
|
+
| `list_metadata_mappings_for_companies()` | GET | `/1.0/companyCatalog/metadata/1.0/mappings` |
|
|
178
|
+
| `list_metadata_values_for_companies(key)` | GET | `/1.0/companyCatalog/metadata/1.0/mappings/{key}/values` |
|
|
179
|
+
|
|
180
|
+
### TasksApi
|
|
181
|
+
|
|
182
|
+
| Method | HTTP | Path |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| `get_project_tasks(project_id, params=None)` | GET | `/5.1/projects/{projectId}/tasks` |
|
|
185
|
+
| `get_task(project_id, task_id)` | GET | `/3.3/projects/{projectId}/tasks/{taskId}` |
|
|
186
|
+
| `get_project_task_changes(project_id, params=None)` | GET | `/2.2/projects/{projectId}/tasks/changes` |
|
|
187
|
+
| `get_project_task_attachments(project_id, params=None)` | GET | `/1.1/projects/{projectId}/tasks/attachments` |
|
|
188
|
+
|
|
189
|
+
### FileAreasApi
|
|
190
|
+
|
|
191
|
+
| Method | HTTP | Path |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| `get_file_areas(project_id, params=None)` | GET | `/5.1/projects/{projectId}/file_areas` |
|
|
194
|
+
| `get_file_area(project_id, file_area_id)` | GET | `/1.0/projects/{projectId}/file_areas/{fileAreaId}` |
|
|
195
|
+
|
|
196
|
+
### FilesApi
|
|
197
|
+
|
|
198
|
+
| Method | HTTP | Path |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| `list_files(project_id, file_area_id, params=None)` | GET | `/6.0/.../files` |
|
|
201
|
+
| `get_file(project_id, file_area_id, file_id)` | GET | `/5.0/.../files/{fileId}` |
|
|
202
|
+
| `get_file_properties_mapping(project_id, file_area_id, file_id)` | GET | `/1.0/.../files/{fileId}/properties/1.0/mappings` |
|
|
203
|
+
| `get_file_property_mapping_values(project_id, file_area_id, file_property_id)` | GET | `/1.0/.../files/properties/1.0/mappings/{filePropertyId}/values` |
|
|
204
|
+
|
|
205
|
+
### FoldersApi
|
|
206
|
+
|
|
207
|
+
| Method | HTTP | Path |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| `list_folders(project_id, file_area_id, params=None)` | GET | `/5.1/.../folders` |
|
|
210
|
+
| `get_folder(project_id, file_area_id, folder_id)` | GET | `/5.0/.../folders/{folderId}` |
|
|
211
|
+
| `get_folder_files_properties(project_id, file_area_id, folder_id)` | GET | `/1.0/.../folders/{folderId}/files/properties/1.0/mappings` |
|
|
212
|
+
|
|
213
|
+
### FileUploadApi
|
|
214
|
+
|
|
215
|
+
| Method | HTTP | Path |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| `create_upload(project_id, file_area_id, body)` | POST | `/1.0/.../upload` |
|
|
218
|
+
| `upload_file_part(project_id, file_area_id, upload_guid, chunk)` | POST | `/1.0/.../upload/{uploadGuid}` |
|
|
219
|
+
| `finish_upload(project_id, file_area_id, upload_guid, body)` | POST | `/2.0/.../upload/{uploadGuid}/finalize` |
|
|
220
|
+
|
|
221
|
+
### FileRevisionsApi
|
|
222
|
+
|
|
223
|
+
| Method | HTTP | Path |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| `get_file_revision_content(project_id, file_area_id, file_id, file_revision_id)` | GET | `/2.0/.../revisions/{fileRevisionId}/content` |
|
|
226
|
+
|
|
227
|
+
### FormsApi
|
|
228
|
+
|
|
229
|
+
| Method | HTTP | Path |
|
|
230
|
+
|---|---|---|
|
|
231
|
+
| `get_project_forms(project_id, params=None)` | GET | `/2.1/projects/{projectId}/forms` |
|
|
232
|
+
| `get_form(project_id, form_id)` | GET | `/1.2/projects/{projectId}/forms/{formId}` |
|
|
233
|
+
| `get_project_form_attachments(project_id, params=None)` | GET | `/2.1/projects/{projectId}/forms/attachments` |
|
|
234
|
+
|
|
235
|
+
### UsersApi
|
|
236
|
+
|
|
237
|
+
| Method | HTTP | Path |
|
|
238
|
+
|---|---|---|
|
|
239
|
+
| `get_user(user_id)` | GET | `/1.1/users/{userId}` |
|
|
240
|
+
| `list_project_users(project_id, params=None)` | GET | `/1.2/projects/{projectId}/users` |
|
|
241
|
+
| `get_project_user(project_id, user_id)` | GET | `/1.1/projects/{projectId}/users/{userId}` |
|
|
242
|
+
|
|
243
|
+
### ProjectTemplatesApi
|
|
244
|
+
|
|
245
|
+
| Method | HTTP | Path |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| `list_project_templates(params=None)` | GET | `/1.1/projectTemplates` |
|
|
248
|
+
|
|
249
|
+
### InspectionPlansApi
|
|
250
|
+
|
|
251
|
+
| Method | HTTP | Path |
|
|
252
|
+
|---|---|---|
|
|
253
|
+
| `list_inspection_plans(project_id, params=None)` | GET | `/1.2/projects/{projectId}/inspectionPlans` |
|
|
254
|
+
| `list_inspection_plan_items(project_id, params=None)` | GET | `/1.1/projects/{projectId}/inspectionPlanItems` |
|
|
255
|
+
| `list_inspection_plan_item_zones(project_id, params=None)` | GET | `/1.1/projects/{projectId}/inspectionPlanItemZones` |
|
|
256
|
+
| `list_inspection_plan_registrations(project_id, params=None)` | GET | `/2.1/projects/{projectId}/inspectionPlanRegistrations` |
|
|
257
|
+
|
|
258
|
+
### TestPlansApi
|
|
259
|
+
|
|
260
|
+
| Method | HTTP | Path |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| `list_test_plans(project_id, params=None)` | GET | `/1.2/projects/{projectId}/testPlans` |
|
|
263
|
+
| `list_test_plan_items(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanItems` |
|
|
264
|
+
| `list_test_plan_item_zones(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanItemZones` |
|
|
265
|
+
| `list_test_plan_registrations(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanRegistrations` |
|
|
266
|
+
|
|
267
|
+
### VersionSetsApi
|
|
268
|
+
|
|
269
|
+
| Method | HTTP | Path |
|
|
270
|
+
|---|---|---|
|
|
271
|
+
| `get_version_sets(project_id, params=None)` | GET | `/2.1/projects/{projectId}/version_sets` |
|
|
272
|
+
| `get_version_set(project_id, version_set_id)` | GET | `/2.0/projects/{projectId}/version_sets/{versionSetId}` |
|
|
273
|
+
| `list_file_area_version_sets(project_id, file_area_id, params=None)` | GET | `/2.1/.../file_areas/{fileAreaId}/version_sets` |
|
|
274
|
+
| `list_version_set_files(project_id, version_set_id, params=None)` | GET | `/3.0/.../version_sets/{versionSetId}/files` |
|
|
275
|
+
|
|
276
|
+
### WorkPackagesApi
|
|
277
|
+
|
|
278
|
+
| Method | HTTP | Path |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| `list_work_packages(project_id, params=None)` | GET | `/1.0/projects/{projectId}/workpackages` |
|
|
281
|
+
|
|
282
|
+
## Advanced Usage
|
|
283
|
+
|
|
284
|
+
### Using individual API classes directly
|
|
285
|
+
|
|
286
|
+
```python
|
|
287
|
+
from dalux_build.configuration import Configuration
|
|
288
|
+
from dalux_build.api_client import ApiClient
|
|
289
|
+
from dalux_build.api import ProjectsApi, TasksApi
|
|
290
|
+
|
|
291
|
+
config = Configuration(
|
|
292
|
+
base_url="https://<company>.dalux.com/api",
|
|
293
|
+
api_key="YOUR_API_KEY",
|
|
294
|
+
)
|
|
295
|
+
api_client = ApiClient(config)
|
|
296
|
+
|
|
297
|
+
projects = ProjectsApi(api_client)
|
|
298
|
+
tasks = TasksApi(api_client)
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Development
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
cd python
|
|
305
|
+
pip install -e ".[dev]"
|
|
306
|
+
pytest tests/ --cov=dalux_build
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## License
|
|
310
|
+
|
|
311
|
+
MIT
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# Dalux Build API – Python Client
|
|
2
|
+
|
|
3
|
+
A lightweight Python client for the [Dalux Build REST API](https://app.swaggerhub.com/apis-docs/Dalux/DaluxBuild-api/4.14).
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Python 3.8 or later
|
|
8
|
+
- [requests](https://pypi.org/project/requests/) ≥ 2.28
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install dalux-build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Getting Started
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from dalux_build import create_client
|
|
20
|
+
|
|
21
|
+
dalux = create_client(
|
|
22
|
+
base_url="https://<your-company>.dalux.com/api",
|
|
23
|
+
api_key="YOUR_API_KEY",
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The returned `DaluxClient` object exposes one attribute per API resource group (see [API Reference](#api-reference) below).
|
|
28
|
+
|
|
29
|
+
### Examples
|
|
30
|
+
|
|
31
|
+
**List all projects**
|
|
32
|
+
```python
|
|
33
|
+
projects = dalux.projects.list_projects()
|
|
34
|
+
print(projects)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Get a specific project**
|
|
38
|
+
```python
|
|
39
|
+
project = dalux.projects.get_project("my-project-id")
|
|
40
|
+
print(project)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**List tasks on a project**
|
|
44
|
+
```python
|
|
45
|
+
tasks = dalux.tasks.get_project_tasks(
|
|
46
|
+
"my-project-id",
|
|
47
|
+
params={"updatedAfter": "2024-01-01"},
|
|
48
|
+
)
|
|
49
|
+
print(tasks)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Upload a file (chunked)**
|
|
53
|
+
```python
|
|
54
|
+
# 1. Create an upload slot
|
|
55
|
+
upload = dalux.file_upload.create_upload(
|
|
56
|
+
"my-project-id", "my-file-area-id",
|
|
57
|
+
{"fileName": "drawing.pdf", "mimeType": "application/pdf"},
|
|
58
|
+
)
|
|
59
|
+
upload_guid = upload["uploadGuid"]
|
|
60
|
+
|
|
61
|
+
# 2. Upload the file content
|
|
62
|
+
with open("drawing.pdf", "rb") as f:
|
|
63
|
+
dalux.file_upload.upload_file_part(
|
|
64
|
+
"my-project-id", "my-file-area-id", upload_guid, f.read()
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# 3. Finalize
|
|
68
|
+
result = dalux.file_upload.finish_upload(
|
|
69
|
+
"my-project-id", "my-file-area-id", upload_guid,
|
|
70
|
+
{"folderId": "target-folder-id"},
|
|
71
|
+
)
|
|
72
|
+
print("New file ID:", result["fileId"])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Authentication
|
|
76
|
+
|
|
77
|
+
Every request automatically includes the `X-API-KEY` header with the API key supplied to `create_client`. No additional configuration is required.
|
|
78
|
+
|
|
79
|
+
API keys are managed in the Dalux Build UI under _Settings › Integrations › API Identities_. Contact <support@dalux.com> to activate API access for your company profile.
|
|
80
|
+
|
|
81
|
+
## Error Handling
|
|
82
|
+
|
|
83
|
+
All methods raise `requests.HTTPError` on 4xx / 5xx responses:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import requests
|
|
87
|
+
|
|
88
|
+
try:
|
|
89
|
+
project = dalux.projects.get_project("unknown-id")
|
|
90
|
+
except requests.HTTPError as exc:
|
|
91
|
+
print(exc.response.status_code, exc.response.json())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## API Reference
|
|
95
|
+
|
|
96
|
+
| Attribute | Class | Description |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `projects` | `ProjectsApi` | List, get, create and update projects; project metadata |
|
|
99
|
+
| `companies` | `CompaniesApi` | Project companies (CRUD) |
|
|
100
|
+
| `company_catalog` | `CompanyCatalogApi` | Company catalog (CRUD + metadata) |
|
|
101
|
+
| `tasks` | `TasksApi` | Tasks, approvals, safety issues, observations & good practices |
|
|
102
|
+
| `file_areas` | `FileAreasApi` | File areas on a project |
|
|
103
|
+
| `files` | `FilesApi` | Files within a file area |
|
|
104
|
+
| `folders` | `FoldersApi` | Folders within a file area |
|
|
105
|
+
| `file_upload` | `FileUploadApi` | Chunked upload (create → part → finalize) |
|
|
106
|
+
| `file_revisions` | `FileRevisionsApi` | Download file revision content |
|
|
107
|
+
| `forms` | `FormsApi` | Forms and form attachments |
|
|
108
|
+
| `users` | `UsersApi` | Company and project users |
|
|
109
|
+
| `project_templates` | `ProjectTemplatesApi` | Available project templates |
|
|
110
|
+
| `inspection_plans` | `InspectionPlansApi` | Inspection plans, items, zones, registrations |
|
|
111
|
+
| `test_plans` | `TestPlansApi` | Test plans, items, zones, registrations |
|
|
112
|
+
| `version_sets` | `VersionSetsApi` | Version sets and version set files |
|
|
113
|
+
| `work_packages` | `WorkPackagesApi` | Work packages on a project |
|
|
114
|
+
|
|
115
|
+
### ProjectsApi
|
|
116
|
+
|
|
117
|
+
| Method | HTTP | Path |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `list_projects(params=None)` | GET | `/5.1/projects` |
|
|
120
|
+
| `get_project(project_id)` | GET | `/5.0/projects/{projectId}` |
|
|
121
|
+
| `create_project(body)` | POST | `/5.0/projects` |
|
|
122
|
+
| `update_project(project_id, body)` | PATCH | `/5.0/projects/{projectId}` |
|
|
123
|
+
| `list_metadata_mappings_for_projects()` | GET | `/1.0/projects/metadata/1.0/mappings` |
|
|
124
|
+
| `list_metadata_values_for_projects(key)` | GET | `/1.0/projects/metadata/1.0/mappings/{key}/values` |
|
|
125
|
+
| `list_project_metadata(project_id)` | GET | `/1.0/projects/{projectId}/metadata` |
|
|
126
|
+
| `list_project_metadata_mappings(project_id)` | GET | `/1.0/projects/{projectId}/metadata/1.0/mappings` |
|
|
127
|
+
| `list_project_metadata_values(project_id, key)` | GET | `/1.0/projects/{projectId}/metadata/1.0/mappings/{key}/values` |
|
|
128
|
+
|
|
129
|
+
### CompaniesApi
|
|
130
|
+
|
|
131
|
+
| Method | HTTP | Path |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| `list_project_companies(project_id, params=None)` | GET | `/3.1/projects/{projectId}/companies` |
|
|
134
|
+
| `get_project_company(project_id, company_id)` | GET | `/3.0/projects/{projectId}/companies/{companyId}` |
|
|
135
|
+
| `create_project_company(project_id, body)` | POST | `/3.1/projects/{projectId}/companies` |
|
|
136
|
+
| `update_project_company(project_id, company_id, body)` | PATCH | `/3.0/projects/{projectId}/companies/{companyId}` |
|
|
137
|
+
|
|
138
|
+
### CompanyCatalogApi
|
|
139
|
+
|
|
140
|
+
| Method | HTTP | Path |
|
|
141
|
+
|---|---|---|
|
|
142
|
+
| `get_companies(params=None)` | GET | `/2.2/companyCatalog` |
|
|
143
|
+
| `get_company(catalog_company_id)` | GET | `/1.2/companyCatalog/{catalogCompanyId}` |
|
|
144
|
+
| `create_company(body)` | POST | `/2.2/companyCatalog` |
|
|
145
|
+
| `update_company(catalog_company_id, body)` | PATCH | `/2.1/companyCatalog/{catalogCompanyId}` |
|
|
146
|
+
| `list_company_metadata(catalog_company_id)` | GET | `/1.0/companyCatalog/{catalogCompanyId}/metadata` |
|
|
147
|
+
| `list_company_metadata_mappings(catalog_company_id)` | GET | `/1.0/companyCatalog/{catalogCompanyId}/metadata/1.0/mappings` |
|
|
148
|
+
| `list_company_metadata_values(catalog_company_id, key)` | GET | `/1.0/.../metadata/1.0/mappings/{key}/values` |
|
|
149
|
+
| `list_metadata_mappings_for_companies()` | GET | `/1.0/companyCatalog/metadata/1.0/mappings` |
|
|
150
|
+
| `list_metadata_values_for_companies(key)` | GET | `/1.0/companyCatalog/metadata/1.0/mappings/{key}/values` |
|
|
151
|
+
|
|
152
|
+
### TasksApi
|
|
153
|
+
|
|
154
|
+
| Method | HTTP | Path |
|
|
155
|
+
|---|---|---|
|
|
156
|
+
| `get_project_tasks(project_id, params=None)` | GET | `/5.1/projects/{projectId}/tasks` |
|
|
157
|
+
| `get_task(project_id, task_id)` | GET | `/3.3/projects/{projectId}/tasks/{taskId}` |
|
|
158
|
+
| `get_project_task_changes(project_id, params=None)` | GET | `/2.2/projects/{projectId}/tasks/changes` |
|
|
159
|
+
| `get_project_task_attachments(project_id, params=None)` | GET | `/1.1/projects/{projectId}/tasks/attachments` |
|
|
160
|
+
|
|
161
|
+
### FileAreasApi
|
|
162
|
+
|
|
163
|
+
| Method | HTTP | Path |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| `get_file_areas(project_id, params=None)` | GET | `/5.1/projects/{projectId}/file_areas` |
|
|
166
|
+
| `get_file_area(project_id, file_area_id)` | GET | `/1.0/projects/{projectId}/file_areas/{fileAreaId}` |
|
|
167
|
+
|
|
168
|
+
### FilesApi
|
|
169
|
+
|
|
170
|
+
| Method | HTTP | Path |
|
|
171
|
+
|---|---|---|
|
|
172
|
+
| `list_files(project_id, file_area_id, params=None)` | GET | `/6.0/.../files` |
|
|
173
|
+
| `get_file(project_id, file_area_id, file_id)` | GET | `/5.0/.../files/{fileId}` |
|
|
174
|
+
| `get_file_properties_mapping(project_id, file_area_id, file_id)` | GET | `/1.0/.../files/{fileId}/properties/1.0/mappings` |
|
|
175
|
+
| `get_file_property_mapping_values(project_id, file_area_id, file_property_id)` | GET | `/1.0/.../files/properties/1.0/mappings/{filePropertyId}/values` |
|
|
176
|
+
|
|
177
|
+
### FoldersApi
|
|
178
|
+
|
|
179
|
+
| Method | HTTP | Path |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `list_folders(project_id, file_area_id, params=None)` | GET | `/5.1/.../folders` |
|
|
182
|
+
| `get_folder(project_id, file_area_id, folder_id)` | GET | `/5.0/.../folders/{folderId}` |
|
|
183
|
+
| `get_folder_files_properties(project_id, file_area_id, folder_id)` | GET | `/1.0/.../folders/{folderId}/files/properties/1.0/mappings` |
|
|
184
|
+
|
|
185
|
+
### FileUploadApi
|
|
186
|
+
|
|
187
|
+
| Method | HTTP | Path |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| `create_upload(project_id, file_area_id, body)` | POST | `/1.0/.../upload` |
|
|
190
|
+
| `upload_file_part(project_id, file_area_id, upload_guid, chunk)` | POST | `/1.0/.../upload/{uploadGuid}` |
|
|
191
|
+
| `finish_upload(project_id, file_area_id, upload_guid, body)` | POST | `/2.0/.../upload/{uploadGuid}/finalize` |
|
|
192
|
+
|
|
193
|
+
### FileRevisionsApi
|
|
194
|
+
|
|
195
|
+
| Method | HTTP | Path |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `get_file_revision_content(project_id, file_area_id, file_id, file_revision_id)` | GET | `/2.0/.../revisions/{fileRevisionId}/content` |
|
|
198
|
+
|
|
199
|
+
### FormsApi
|
|
200
|
+
|
|
201
|
+
| Method | HTTP | Path |
|
|
202
|
+
|---|---|---|
|
|
203
|
+
| `get_project_forms(project_id, params=None)` | GET | `/2.1/projects/{projectId}/forms` |
|
|
204
|
+
| `get_form(project_id, form_id)` | GET | `/1.2/projects/{projectId}/forms/{formId}` |
|
|
205
|
+
| `get_project_form_attachments(project_id, params=None)` | GET | `/2.1/projects/{projectId}/forms/attachments` |
|
|
206
|
+
|
|
207
|
+
### UsersApi
|
|
208
|
+
|
|
209
|
+
| Method | HTTP | Path |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| `get_user(user_id)` | GET | `/1.1/users/{userId}` |
|
|
212
|
+
| `list_project_users(project_id, params=None)` | GET | `/1.2/projects/{projectId}/users` |
|
|
213
|
+
| `get_project_user(project_id, user_id)` | GET | `/1.1/projects/{projectId}/users/{userId}` |
|
|
214
|
+
|
|
215
|
+
### ProjectTemplatesApi
|
|
216
|
+
|
|
217
|
+
| Method | HTTP | Path |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| `list_project_templates(params=None)` | GET | `/1.1/projectTemplates` |
|
|
220
|
+
|
|
221
|
+
### InspectionPlansApi
|
|
222
|
+
|
|
223
|
+
| Method | HTTP | Path |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| `list_inspection_plans(project_id, params=None)` | GET | `/1.2/projects/{projectId}/inspectionPlans` |
|
|
226
|
+
| `list_inspection_plan_items(project_id, params=None)` | GET | `/1.1/projects/{projectId}/inspectionPlanItems` |
|
|
227
|
+
| `list_inspection_plan_item_zones(project_id, params=None)` | GET | `/1.1/projects/{projectId}/inspectionPlanItemZones` |
|
|
228
|
+
| `list_inspection_plan_registrations(project_id, params=None)` | GET | `/2.1/projects/{projectId}/inspectionPlanRegistrations` |
|
|
229
|
+
|
|
230
|
+
### TestPlansApi
|
|
231
|
+
|
|
232
|
+
| Method | HTTP | Path |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| `list_test_plans(project_id, params=None)` | GET | `/1.2/projects/{projectId}/testPlans` |
|
|
235
|
+
| `list_test_plan_items(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanItems` |
|
|
236
|
+
| `list_test_plan_item_zones(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanItemZones` |
|
|
237
|
+
| `list_test_plan_registrations(project_id, params=None)` | GET | `/1.1/projects/{projectId}/testPlanRegistrations` |
|
|
238
|
+
|
|
239
|
+
### VersionSetsApi
|
|
240
|
+
|
|
241
|
+
| Method | HTTP | Path |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| `get_version_sets(project_id, params=None)` | GET | `/2.1/projects/{projectId}/version_sets` |
|
|
244
|
+
| `get_version_set(project_id, version_set_id)` | GET | `/2.0/projects/{projectId}/version_sets/{versionSetId}` |
|
|
245
|
+
| `list_file_area_version_sets(project_id, file_area_id, params=None)` | GET | `/2.1/.../file_areas/{fileAreaId}/version_sets` |
|
|
246
|
+
| `list_version_set_files(project_id, version_set_id, params=None)` | GET | `/3.0/.../version_sets/{versionSetId}/files` |
|
|
247
|
+
|
|
248
|
+
### WorkPackagesApi
|
|
249
|
+
|
|
250
|
+
| Method | HTTP | Path |
|
|
251
|
+
|---|---|---|
|
|
252
|
+
| `list_work_packages(project_id, params=None)` | GET | `/1.0/projects/{projectId}/workpackages` |
|
|
253
|
+
|
|
254
|
+
## Advanced Usage
|
|
255
|
+
|
|
256
|
+
### Using individual API classes directly
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
from dalux_build.configuration import Configuration
|
|
260
|
+
from dalux_build.api_client import ApiClient
|
|
261
|
+
from dalux_build.api import ProjectsApi, TasksApi
|
|
262
|
+
|
|
263
|
+
config = Configuration(
|
|
264
|
+
base_url="https://<company>.dalux.com/api",
|
|
265
|
+
api_key="YOUR_API_KEY",
|
|
266
|
+
)
|
|
267
|
+
api_client = ApiClient(config)
|
|
268
|
+
|
|
269
|
+
projects = ProjectsApi(api_client)
|
|
270
|
+
tasks = TasksApi(api_client)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Development
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
cd python
|
|
277
|
+
pip install -e ".[dev]"
|
|
278
|
+
pytest tests/ --cov=dalux_build
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT
|