evo-files 0.1.0__py3-none-any.whl
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.
- evo/files/__init__.py +26 -0
- evo/files/_model_config.py +20 -0
- evo/files/client.py +327 -0
- evo/files/data.py +74 -0
- evo/files/endpoints/__init__.py +35 -0
- evo/files/endpoints/api/__init__.py +12 -0
- evo/files/endpoints/api/file_v2_api.py +649 -0
- evo/files/endpoints/models.py +124 -0
- evo/files/io.py +190 -0
- evo_files-0.1.0.dist-info/METADATA +58 -0
- evo_files-0.1.0.dist-info/RECORD +14 -0
- evo_files-0.1.0.dist-info/WHEEL +5 -0
- evo_files-0.1.0.dist-info/licenses/LICENSE.md +190 -0
- evo_files-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
# Copyright © 2025 Bentley Systems, Incorporated
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
8
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
# See the License for the specific language governing permissions and
|
|
10
|
+
# limitations under the License.
|
|
11
|
+
"""
|
|
12
|
+
File API
|
|
13
|
+
=============
|
|
14
|
+
|
|
15
|
+
The File API provides the ability to manage files of any type or size, associated with
|
|
16
|
+
your Evo workspace. Enable your product with Evo connected workflows by integrating with the Seequent Evo
|
|
17
|
+
File API. Most file formats and sizes are accepted.
|
|
18
|
+
|
|
19
|
+
Files can be referenced by their UUID, or by a user-defined file path. Files are versioned, so updating or
|
|
20
|
+
replacing them will create a new version of the file. The latest version of the file is always returned
|
|
21
|
+
unless a specific version is requested.
|
|
22
|
+
|
|
23
|
+
For more information on using the File API, see [Overview](https://developer.seequent.com/docs/guides/file/), or the API references here.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
This code is generated from the OpenAPI specification for File API.
|
|
27
|
+
API version: 2.8.0
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from evo.common.connector import APIConnector
|
|
31
|
+
from evo.common.data import EmptyResponse, RequestMethod
|
|
32
|
+
|
|
33
|
+
from ..models import * # noqa: F403
|
|
34
|
+
|
|
35
|
+
__all__ = ["FileV2Api"]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class FileV2Api:
|
|
39
|
+
"""API client for the file_v2 endpoint.
|
|
40
|
+
|
|
41
|
+
NOTE: This class is auto generated by OpenAPI Generator
|
|
42
|
+
Ref: https://openapi-generator.tech
|
|
43
|
+
|
|
44
|
+
Do not edit the class manually.
|
|
45
|
+
|
|
46
|
+
:param connector: Client for communicating with the API.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def __init__(self, connector: APIConnector):
|
|
50
|
+
self.connector = connector
|
|
51
|
+
|
|
52
|
+
async def delete_file_by_id(
|
|
53
|
+
self,
|
|
54
|
+
file_id: str,
|
|
55
|
+
organisation_id: str,
|
|
56
|
+
workspace_id: str,
|
|
57
|
+
additional_headers: dict[str, str] | None = None,
|
|
58
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
59
|
+
) -> EmptyResponse:
|
|
60
|
+
"""Delete a file by ID
|
|
61
|
+
|
|
62
|
+
Request to delete a file. This will delete the file and all historic versions.
|
|
63
|
+
|
|
64
|
+
:param file_id:
|
|
65
|
+
Format: `uuid`
|
|
66
|
+
Example: `'file_id_example'`
|
|
67
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
68
|
+
Format: `uuid`
|
|
69
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
70
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
71
|
+
Format: `uuid`
|
|
72
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
73
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
74
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
75
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
76
|
+
|
|
77
|
+
:return: Returns the result object.
|
|
78
|
+
|
|
79
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
80
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
81
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
82
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
83
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
84
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
85
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
86
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
87
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
88
|
+
type in `response_types_map`.
|
|
89
|
+
"""
|
|
90
|
+
# Prepare the path parameters.
|
|
91
|
+
_path_params = {
|
|
92
|
+
"file_id": file_id,
|
|
93
|
+
"organisation_id": organisation_id,
|
|
94
|
+
"workspace_id": workspace_id,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Prepare the header parameters.
|
|
98
|
+
_header_params = {}
|
|
99
|
+
if additional_headers is not None:
|
|
100
|
+
_header_params.update(additional_headers)
|
|
101
|
+
|
|
102
|
+
# Define the collection formats.
|
|
103
|
+
_collection_formats = {}
|
|
104
|
+
|
|
105
|
+
_response_types_map = {
|
|
106
|
+
"204": EmptyResponse,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return await self.connector.call_api(
|
|
110
|
+
method=RequestMethod.DELETE,
|
|
111
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/{file_id}",
|
|
112
|
+
path_params=_path_params,
|
|
113
|
+
header_params=_header_params,
|
|
114
|
+
collection_formats=_collection_formats,
|
|
115
|
+
response_types_map=_response_types_map,
|
|
116
|
+
request_timeout=request_timeout,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
async def delete_file_by_path(
|
|
120
|
+
self,
|
|
121
|
+
file_path: str,
|
|
122
|
+
organisation_id: str,
|
|
123
|
+
workspace_id: str,
|
|
124
|
+
additional_headers: dict[str, str] | None = None,
|
|
125
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
126
|
+
) -> EmptyResponse:
|
|
127
|
+
"""Delete a file by path
|
|
128
|
+
|
|
129
|
+
Request to delete a file. This will delete the file and all historic versions.
|
|
130
|
+
|
|
131
|
+
:param file_path: Path to the file.
|
|
132
|
+
Example: `'a/b/file.txt'`
|
|
133
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
134
|
+
Format: `uuid`
|
|
135
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
136
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
137
|
+
Format: `uuid`
|
|
138
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
139
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
140
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
141
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
142
|
+
|
|
143
|
+
:return: Returns the result object.
|
|
144
|
+
|
|
145
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
146
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
147
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
148
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
149
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
150
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
151
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
152
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
153
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
154
|
+
type in `response_types_map`.
|
|
155
|
+
"""
|
|
156
|
+
# Prepare the path parameters.
|
|
157
|
+
_path_params = {
|
|
158
|
+
"file_path": file_path,
|
|
159
|
+
"organisation_id": organisation_id,
|
|
160
|
+
"workspace_id": workspace_id,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
# Prepare the header parameters.
|
|
164
|
+
_header_params = {}
|
|
165
|
+
if additional_headers is not None:
|
|
166
|
+
_header_params.update(additional_headers)
|
|
167
|
+
|
|
168
|
+
# Define the collection formats.
|
|
169
|
+
_collection_formats = {}
|
|
170
|
+
|
|
171
|
+
_response_types_map = {
|
|
172
|
+
"204": EmptyResponse,
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return await self.connector.call_api(
|
|
176
|
+
method=RequestMethod.DELETE,
|
|
177
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/path/{file_path}",
|
|
178
|
+
path_params=_path_params,
|
|
179
|
+
header_params=_header_params,
|
|
180
|
+
collection_formats=_collection_formats,
|
|
181
|
+
response_types_map=_response_types_map,
|
|
182
|
+
request_timeout=request_timeout,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def get_file_by_id(
|
|
186
|
+
self,
|
|
187
|
+
file_id: str,
|
|
188
|
+
organisation_id: str,
|
|
189
|
+
workspace_id: str,
|
|
190
|
+
version_id: str | None = None,
|
|
191
|
+
include_versions: bool | None = None,
|
|
192
|
+
deleted: bool | None = None,
|
|
193
|
+
additional_headers: dict[str, str] | None = None,
|
|
194
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
195
|
+
) -> DownloadFileResponse: # noqa: F405
|
|
196
|
+
"""Download a file by ID
|
|
197
|
+
|
|
198
|
+
Request file metadata and a delegated download link for a specified file by ID. The `download` link should be followed to download the file contents from blob storage. This link is pre-signed and will expire after 30 minutes. Set the `include_versions` query parameter to `true` to get the complete list of available versions. Set the `version` query parameter to request a download link for that specific version of the specified file. If `version` is not set, the latest version of the file will be returned.
|
|
199
|
+
|
|
200
|
+
:param file_id: UUID of a file.
|
|
201
|
+
Format: `uuid`
|
|
202
|
+
Example: `'255fa5a6-f37d-11ed-93c1-00155d19a71b'`
|
|
203
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
204
|
+
Format: `uuid`
|
|
205
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
206
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
207
|
+
Format: `uuid`
|
|
208
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
209
|
+
:param version_id: (optional) Optional version ID for the desired file version. By default, the response will return the _latest_ version.
|
|
210
|
+
Format: `int64`
|
|
211
|
+
Example: `'1223372036854775807'`
|
|
212
|
+
:param include_versions: (optional) Optional inclusion of the `DownloadFile.versions`. By default, the response will return `versions` as `null`.
|
|
213
|
+
Example: `False`
|
|
214
|
+
:param deleted: (optional) Optional flag to include deleted files. By default, the response will not include deleted files.
|
|
215
|
+
Example: `True`
|
|
216
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
217
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
218
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
219
|
+
|
|
220
|
+
:return: Returns the result object.
|
|
221
|
+
|
|
222
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
223
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
224
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
225
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
226
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
227
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
228
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
229
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
230
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
231
|
+
type in `response_types_map`.
|
|
232
|
+
"""
|
|
233
|
+
# Prepare the path parameters.
|
|
234
|
+
_path_params = {
|
|
235
|
+
"file_id": file_id,
|
|
236
|
+
"organisation_id": organisation_id,
|
|
237
|
+
"workspace_id": workspace_id,
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
# Prepare the query parameters.
|
|
241
|
+
_query_params = {}
|
|
242
|
+
if version_id is not None:
|
|
243
|
+
_query_params["version_id"] = version_id
|
|
244
|
+
if include_versions is not None:
|
|
245
|
+
_query_params["include_versions"] = include_versions
|
|
246
|
+
if deleted is not None:
|
|
247
|
+
_query_params["deleted"] = deleted
|
|
248
|
+
|
|
249
|
+
# Prepare the header parameters.
|
|
250
|
+
_header_params = {
|
|
251
|
+
"Accept": "application/json",
|
|
252
|
+
}
|
|
253
|
+
if additional_headers is not None:
|
|
254
|
+
_header_params.update(additional_headers)
|
|
255
|
+
|
|
256
|
+
# Define the collection formats.
|
|
257
|
+
_collection_formats = {}
|
|
258
|
+
|
|
259
|
+
_response_types_map = {
|
|
260
|
+
"200": DownloadFileResponse, # noqa: F405
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return await self.connector.call_api(
|
|
264
|
+
method=RequestMethod.GET,
|
|
265
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/{file_id}",
|
|
266
|
+
path_params=_path_params,
|
|
267
|
+
query_params=_query_params,
|
|
268
|
+
header_params=_header_params,
|
|
269
|
+
collection_formats=_collection_formats,
|
|
270
|
+
response_types_map=_response_types_map,
|
|
271
|
+
request_timeout=request_timeout,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
async def get_file_by_path(
|
|
275
|
+
self,
|
|
276
|
+
file_path: str,
|
|
277
|
+
organisation_id: str,
|
|
278
|
+
workspace_id: str,
|
|
279
|
+
version_id: str | None = None,
|
|
280
|
+
include_versions: bool | None = None,
|
|
281
|
+
additional_headers: dict[str, str] | None = None,
|
|
282
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
283
|
+
) -> DownloadFileResponse: # noqa: F405
|
|
284
|
+
"""Download a file by path
|
|
285
|
+
|
|
286
|
+
Request file metadata and a delegated download link for a specified file by path. The `download` link should be followed to download the file contents. This link is pre-signed and will expire after 30 minutes. Set the `include_versions` query parameter to `true` to get the complete list of available versions. Set the `version` query parameter to request a download link for that specific version of the specified file. If `version` is not set, the latest version of the file will be returned.
|
|
287
|
+
|
|
288
|
+
:param file_path: Path to the file.
|
|
289
|
+
Example: `'a/b/file.txt'`
|
|
290
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
291
|
+
Format: `uuid`
|
|
292
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
293
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
294
|
+
Format: `uuid`
|
|
295
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
296
|
+
:param version_id: (optional) Optional version ID for the desired file version. By default, the response will return the _latest_ version.
|
|
297
|
+
Format: `int64`
|
|
298
|
+
Example: `'1223372036854775807'`
|
|
299
|
+
:param include_versions: (optional) Optional inclusion of the `DownloadFile.versions`. By default, the response will return `versions` as `null`.
|
|
300
|
+
Example: `False`
|
|
301
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
302
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
303
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
304
|
+
|
|
305
|
+
:return: Returns the result object.
|
|
306
|
+
|
|
307
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
308
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
309
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
310
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
311
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
312
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
313
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
314
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
315
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
316
|
+
type in `response_types_map`.
|
|
317
|
+
"""
|
|
318
|
+
# Prepare the path parameters.
|
|
319
|
+
_path_params = {
|
|
320
|
+
"file_path": file_path,
|
|
321
|
+
"organisation_id": organisation_id,
|
|
322
|
+
"workspace_id": workspace_id,
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
# Prepare the query parameters.
|
|
326
|
+
_query_params = {}
|
|
327
|
+
if version_id is not None:
|
|
328
|
+
_query_params["version_id"] = version_id
|
|
329
|
+
if include_versions is not None:
|
|
330
|
+
_query_params["include_versions"] = include_versions
|
|
331
|
+
|
|
332
|
+
# Prepare the header parameters.
|
|
333
|
+
_header_params = {
|
|
334
|
+
"Accept": "application/json",
|
|
335
|
+
}
|
|
336
|
+
if additional_headers is not None:
|
|
337
|
+
_header_params.update(additional_headers)
|
|
338
|
+
|
|
339
|
+
# Define the collection formats.
|
|
340
|
+
_collection_formats = {}
|
|
341
|
+
|
|
342
|
+
_response_types_map = {
|
|
343
|
+
"200": DownloadFileResponse, # noqa: F405
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return await self.connector.call_api(
|
|
347
|
+
method=RequestMethod.GET,
|
|
348
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/path/{file_path}",
|
|
349
|
+
path_params=_path_params,
|
|
350
|
+
query_params=_query_params,
|
|
351
|
+
header_params=_header_params,
|
|
352
|
+
collection_formats=_collection_formats,
|
|
353
|
+
response_types_map=_response_types_map,
|
|
354
|
+
request_timeout=request_timeout,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
async def list_files(
|
|
358
|
+
self,
|
|
359
|
+
organisation_id: str,
|
|
360
|
+
workspace_id: str,
|
|
361
|
+
limit: int | None = None,
|
|
362
|
+
offset: int | None = None,
|
|
363
|
+
deleted: bool | None = None,
|
|
364
|
+
author: str | None = None,
|
|
365
|
+
file_name: str | None = None,
|
|
366
|
+
created_at: list[str] | None = None,
|
|
367
|
+
modified_by: str | None = None,
|
|
368
|
+
modified_at: list[str] | None = None,
|
|
369
|
+
deleted_by: str | None = None,
|
|
370
|
+
deleted_at: list[str] | None = None,
|
|
371
|
+
order_by: str | None = None,
|
|
372
|
+
additional_headers: dict[str, str] | None = None,
|
|
373
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
374
|
+
) -> ListFilesResponse: # noqa: F405
|
|
375
|
+
"""List folder contents
|
|
376
|
+
|
|
377
|
+
Request to list files. The maximum number of results returned is limited to 5000.
|
|
378
|
+
|
|
379
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
380
|
+
Format: `uuid`
|
|
381
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
382
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
383
|
+
Format: `uuid`
|
|
384
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
385
|
+
:param limit: (optional) The number of results to return.
|
|
386
|
+
Example: `5000`
|
|
387
|
+
:param offset: (optional) The number of results to skip.
|
|
388
|
+
Example: `0`
|
|
389
|
+
:param deleted: (optional) When true, only files that have been deleted will be returned
|
|
390
|
+
Example: `False`
|
|
391
|
+
:param author: (optional) The ID of the author to filter on.
|
|
392
|
+
Format: `uuid`
|
|
393
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
394
|
+
:param file_name: (optional) The name of the file to filter on. Will perform a case insensitive partial match, so the query `file_name=gold` will match a file with the name `allgoldcolumns.csv`.
|
|
395
|
+
Example: `'drilling_data'`
|
|
396
|
+
:param created_at: (optional) A date or dates (max 2) to filter files by. Dates may contain operator prefixes, in the form `<operator>:<datetime>`. The following operators are available (`lt`=less than, `lte`=less than or equal to, `gt`=greater than, `gte`=greater than or equal to).If you omit the operator, then it is assumed the operator is 'equal to'. In this case you may only supply one date. The dates must also be in a valid ISO 8601 format.Dates may include a UTC offset. If the offset is omitted, the timezone is assumed to be UTC.
|
|
397
|
+
Example: `['gte:2023-03-10T22:56:53Z']`
|
|
398
|
+
:param modified_by: (optional) The ID of the last person to modify the file to filter on.
|
|
399
|
+
Format: `uuid`
|
|
400
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
401
|
+
:param modified_at: (optional) A date or dates (max 2) to filter files by. Dates may contain operator prefixes, in the form `<operator>:<datetime>`. The following operators are available (`lt`=less than, `lte`=less than or equal to, `gt`=greater than, `gte`=greater than or equal to).If you omit the operator, then it is assumed the operator is 'equal to'. In this case you may only supply one date. The dates must also be in a valid ISO 8601 format.Dates may include a UTC offset. If the offset is omitted, the timezone is assumed to be UTC.
|
|
402
|
+
Example: `['gte:2023-03-10T22:56:53Z']`
|
|
403
|
+
:param deleted_by: (optional) The UUID of the user that deleted a file
|
|
404
|
+
Format: `uuid`
|
|
405
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
406
|
+
:param deleted_at: (optional) A date or dates (max 2) to filter files by. Dates may contain operator prefixes, in the form `<operator>:<datetime>`. The following operators are available (`lt`=less than, `lte`=less than or equal to, `gt`=greater than, `gte`=greater than or equal to).If you omit the operator, then it is assumed the operator is 'equal to'. In this case you may only supply one date. The dates must also be in a valid ISO 8601 format.Dates may include a UTC offset. If the offset is omitted, the timezone is assumed to be UTC.
|
|
407
|
+
Example: `['gte:2023-03-10T22:56:53Z']`
|
|
408
|
+
:param order_by: (optional) A comma separated list of fields to order by, where the default sort order is ascending. To specify the sort order, prefix the field name with either `asc:` or `desc:` for ascending or descending respectively. Field names can be one of the following known sort fields: `created_at`, `modified_at`, `deleted_at`
|
|
409
|
+
Example: `'order_by=modified_at,desc:created_at'`
|
|
410
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
411
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
412
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
413
|
+
|
|
414
|
+
:return: Returns the result object.
|
|
415
|
+
|
|
416
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
417
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
418
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
419
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
420
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
421
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
422
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
423
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
424
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
425
|
+
type in `response_types_map`.
|
|
426
|
+
"""
|
|
427
|
+
# Prepare the path parameters.
|
|
428
|
+
_path_params = {
|
|
429
|
+
"organisation_id": organisation_id,
|
|
430
|
+
"workspace_id": workspace_id,
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
# Prepare the query parameters.
|
|
434
|
+
_query_params = {}
|
|
435
|
+
if limit is not None:
|
|
436
|
+
_query_params["limit"] = limit
|
|
437
|
+
if offset is not None:
|
|
438
|
+
_query_params["offset"] = offset
|
|
439
|
+
if deleted is not None:
|
|
440
|
+
_query_params["deleted"] = deleted
|
|
441
|
+
if author is not None:
|
|
442
|
+
_query_params["author"] = author
|
|
443
|
+
if file_name is not None:
|
|
444
|
+
_query_params["file_name"] = file_name
|
|
445
|
+
if created_at is not None:
|
|
446
|
+
_query_params["created_at"] = created_at
|
|
447
|
+
if modified_by is not None:
|
|
448
|
+
_query_params["modified_by"] = modified_by
|
|
449
|
+
if modified_at is not None:
|
|
450
|
+
_query_params["modified_at"] = modified_at
|
|
451
|
+
if deleted_by is not None:
|
|
452
|
+
_query_params["deleted_by"] = deleted_by
|
|
453
|
+
if deleted_at is not None:
|
|
454
|
+
_query_params["deleted_at"] = deleted_at
|
|
455
|
+
if order_by is not None:
|
|
456
|
+
_query_params["order_by"] = order_by
|
|
457
|
+
|
|
458
|
+
# Prepare the header parameters.
|
|
459
|
+
_header_params = {
|
|
460
|
+
"Accept": "application/json",
|
|
461
|
+
}
|
|
462
|
+
if additional_headers is not None:
|
|
463
|
+
_header_params.update(additional_headers)
|
|
464
|
+
|
|
465
|
+
# Define the collection formats.
|
|
466
|
+
_collection_formats = {
|
|
467
|
+
"created_at": "multi",
|
|
468
|
+
"modified_at": "multi",
|
|
469
|
+
"deleted_at": "multi",
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
_response_types_map = {
|
|
473
|
+
"200": ListFilesResponse, # noqa: F405
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return await self.connector.call_api(
|
|
477
|
+
method=RequestMethod.GET,
|
|
478
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files",
|
|
479
|
+
path_params=_path_params,
|
|
480
|
+
query_params=_query_params,
|
|
481
|
+
header_params=_header_params,
|
|
482
|
+
collection_formats=_collection_formats,
|
|
483
|
+
response_types_map=_response_types_map,
|
|
484
|
+
request_timeout=request_timeout,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
async def update_file_by_id(
|
|
488
|
+
self,
|
|
489
|
+
file_id: str,
|
|
490
|
+
organisation_id: str,
|
|
491
|
+
workspace_id: str,
|
|
492
|
+
version_id: str | None = None,
|
|
493
|
+
deleted: bool | None = None,
|
|
494
|
+
additional_headers: dict[str, str] | None = None,
|
|
495
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
496
|
+
) -> UploadFileResponse: # noqa: F405
|
|
497
|
+
"""Update a file
|
|
498
|
+
|
|
499
|
+
Request an upload link for a new version of the specified file. If the file does not exist an error will be returned. Follow up a successful request with a call to the returned pre-signed upload link. Specify a binary body containing the file to upload, with the addition of header key-value pair `x-ms-blob-type: BlockBlob`. The upload link is pre-signed and will expire after 30 minutes. Including a `version_id` parameter allows creating a link to a blob with uncommitted blocks, i.e. the upload has not been completed properly, or the original pre-signed link has expired. Uncommitted blocks are valid for up to one week, after which they are automatically deleted. Including a `deleted` parameter with a value of `false` will restore a deleted file.
|
|
500
|
+
|
|
501
|
+
:param file_id:
|
|
502
|
+
Format: `uuid`
|
|
503
|
+
Example: `'file_id_example'`
|
|
504
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
505
|
+
Format: `uuid`
|
|
506
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
507
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
508
|
+
Format: `uuid`
|
|
509
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
510
|
+
:param version_id: (optional) (Optional) version ID to fetch a link for.
|
|
511
|
+
Format: `int64`
|
|
512
|
+
Example: `'1223372036854775807'`
|
|
513
|
+
:param deleted: (optional) When set to false, the operation will attempt to restore a deleted file.
|
|
514
|
+
Example: `True`
|
|
515
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
516
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
517
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
518
|
+
|
|
519
|
+
:return: Returns the result object.
|
|
520
|
+
|
|
521
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
522
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
523
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
524
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
525
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
526
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
527
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
528
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
529
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
530
|
+
type in `response_types_map`.
|
|
531
|
+
"""
|
|
532
|
+
# Prepare the path parameters.
|
|
533
|
+
_path_params = {
|
|
534
|
+
"file_id": file_id,
|
|
535
|
+
"organisation_id": organisation_id,
|
|
536
|
+
"workspace_id": workspace_id,
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
# Prepare the query parameters.
|
|
540
|
+
_query_params = {}
|
|
541
|
+
if version_id is not None:
|
|
542
|
+
_query_params["version_id"] = version_id
|
|
543
|
+
if deleted is not None:
|
|
544
|
+
_query_params["deleted"] = deleted
|
|
545
|
+
|
|
546
|
+
# Prepare the header parameters.
|
|
547
|
+
_header_params = {
|
|
548
|
+
"Accept": "application/json",
|
|
549
|
+
}
|
|
550
|
+
if additional_headers is not None:
|
|
551
|
+
_header_params.update(additional_headers)
|
|
552
|
+
|
|
553
|
+
# Define the collection formats.
|
|
554
|
+
_collection_formats = {}
|
|
555
|
+
|
|
556
|
+
_response_types_map = {
|
|
557
|
+
"200": UploadFileResponse, # noqa: F405
|
|
558
|
+
"204": EmptyResponse,
|
|
559
|
+
"303": DownloadFileResponse, # noqa: F405
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
return await self.connector.call_api(
|
|
563
|
+
method=RequestMethod.PUT,
|
|
564
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/{file_id}",
|
|
565
|
+
path_params=_path_params,
|
|
566
|
+
query_params=_query_params,
|
|
567
|
+
header_params=_header_params,
|
|
568
|
+
collection_formats=_collection_formats,
|
|
569
|
+
response_types_map=_response_types_map,
|
|
570
|
+
request_timeout=request_timeout,
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
async def upsert_file_by_path(
|
|
574
|
+
self,
|
|
575
|
+
file_path: str,
|
|
576
|
+
organisation_id: str,
|
|
577
|
+
workspace_id: str,
|
|
578
|
+
version_id: str | None = None,
|
|
579
|
+
additional_headers: dict[str, str] | None = None,
|
|
580
|
+
request_timeout: int | float | tuple[int | float, int | float] | None = None,
|
|
581
|
+
) -> UploadFileResponse: # noqa: F405
|
|
582
|
+
"""Upload a file
|
|
583
|
+
|
|
584
|
+
Request an upload link for a new version of the specified file. If the folders in the file path do not exist, they will be created. If the file already exists, a new version will be created with the updated file content. Follow up a successful request with a call to the returned pre-signed upload link. Specify a binary body containing the file to upload, with the addition of header key-value pair `x-ms-blob-type: BlockBlob`. The upload link is pre-signed and will expire after 30 minutes. Including a `version_id` parameter allows creating a link to data with uncommitted blocks, i.e. the upload has not been completed properly, or the original pre-signed link has expired. Uncommitted blocks are valid for up to one week, after which they are automatically deleted.
|
|
585
|
+
|
|
586
|
+
:param file_path: Path to the file.
|
|
587
|
+
Example: `'a/b/file.txt'`
|
|
588
|
+
:param organisation_id: The customer's organisation organisation ID.
|
|
589
|
+
Format: `uuid`
|
|
590
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
591
|
+
:param workspace_id: The ID of the workspace in the organization.
|
|
592
|
+
Format: `uuid`
|
|
593
|
+
Example: `'00000000-0000-0000-0000-000000000000'`
|
|
594
|
+
:param version_id: (optional) (Optional) version ID to fetch a link for.
|
|
595
|
+
Format: `int64`
|
|
596
|
+
Example: `'1223372036854775807'`
|
|
597
|
+
:param additional_headers: (optional) Additional headers to send with the request.
|
|
598
|
+
:param request_timeout: (optional) Timeout setting for this request. If one number is provided, it will be the
|
|
599
|
+
total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
|
|
600
|
+
|
|
601
|
+
:return: Returns the result object.
|
|
602
|
+
|
|
603
|
+
:raise evo.common.exceptions.BadRequestException: If the server responds with HTTP status 400.
|
|
604
|
+
:raise evo.common.exceptions.UnauthorizedException: If the server responds with HTTP status 401.
|
|
605
|
+
:raise evo.common.exceptions.ForbiddenException: If the server responds with HTTP status 403.
|
|
606
|
+
:raise evo.common.exceptions.NotFoundException: If the server responds with HTTP status 404.
|
|
607
|
+
:raise evo.common.exceptions.BaseTypedError: If the server responds with any other HTTP status between
|
|
608
|
+
400 and 599, and the body of the response contains a descriptive `type` parameter.
|
|
609
|
+
:raise evo.common.exceptions.EvoAPIException: If the server responds with any other HTTP status between 400
|
|
610
|
+
and 599, and the body of the response does not contain a `type` parameter.
|
|
611
|
+
:raise evo.common.exceptions.UnknownResponseError: For other HTTP status codes with no corresponding response
|
|
612
|
+
type in `response_types_map`.
|
|
613
|
+
"""
|
|
614
|
+
# Prepare the path parameters.
|
|
615
|
+
_path_params = {
|
|
616
|
+
"file_path": file_path,
|
|
617
|
+
"organisation_id": organisation_id,
|
|
618
|
+
"workspace_id": workspace_id,
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
# Prepare the query parameters.
|
|
622
|
+
_query_params = {}
|
|
623
|
+
if version_id is not None:
|
|
624
|
+
_query_params["version_id"] = version_id
|
|
625
|
+
|
|
626
|
+
# Prepare the header parameters.
|
|
627
|
+
_header_params = {
|
|
628
|
+
"Accept": "application/json",
|
|
629
|
+
}
|
|
630
|
+
if additional_headers is not None:
|
|
631
|
+
_header_params.update(additional_headers)
|
|
632
|
+
|
|
633
|
+
# Define the collection formats.
|
|
634
|
+
_collection_formats = {}
|
|
635
|
+
|
|
636
|
+
_response_types_map = {
|
|
637
|
+
"200": UploadFileResponse, # noqa: F405
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return await self.connector.call_api(
|
|
641
|
+
method=RequestMethod.PUT,
|
|
642
|
+
resource_path="/file/v2/orgs/{organisation_id}/workspaces/{workspace_id}/files/path/{file_path}",
|
|
643
|
+
path_params=_path_params,
|
|
644
|
+
query_params=_query_params,
|
|
645
|
+
header_params=_header_params,
|
|
646
|
+
collection_formats=_collection_formats,
|
|
647
|
+
response_types_map=_response_types_map,
|
|
648
|
+
request_timeout=request_timeout,
|
|
649
|
+
)
|