geobox 1.4.2__py3-none-any.whl → 2.0.1__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.
Files changed (66) hide show
  1. geobox/__init__.py +2 -2
  2. geobox/aio/__init__.py +63 -0
  3. geobox/aio/api.py +2640 -0
  4. geobox/aio/apikey.py +263 -0
  5. geobox/aio/attachment.py +339 -0
  6. geobox/aio/base.py +262 -0
  7. geobox/aio/basemap.py +196 -0
  8. geobox/aio/dashboard.py +342 -0
  9. geobox/aio/feature.py +527 -0
  10. geobox/aio/field.py +321 -0
  11. geobox/aio/file.py +522 -0
  12. geobox/aio/layout.py +341 -0
  13. geobox/aio/log.py +145 -0
  14. geobox/aio/map.py +1034 -0
  15. geobox/aio/model3d.py +415 -0
  16. geobox/aio/mosaic.py +696 -0
  17. geobox/aio/plan.py +315 -0
  18. geobox/aio/query.py +693 -0
  19. geobox/aio/raster.py +869 -0
  20. geobox/aio/route.py +63 -0
  21. geobox/aio/scene.py +342 -0
  22. geobox/aio/settings.py +194 -0
  23. geobox/aio/task.py +402 -0
  24. geobox/aio/tile3d.py +339 -0
  25. geobox/aio/tileset.py +672 -0
  26. geobox/aio/usage.py +243 -0
  27. geobox/aio/user.py +507 -0
  28. geobox/aio/vectorlayer.py +1363 -0
  29. geobox/aio/version.py +273 -0
  30. geobox/aio/view.py +983 -0
  31. geobox/aio/workflow.py +341 -0
  32. geobox/api.py +14 -15
  33. geobox/apikey.py +28 -1
  34. geobox/attachment.py +27 -1
  35. geobox/base.py +4 -4
  36. geobox/basemap.py +30 -1
  37. geobox/dashboard.py +27 -0
  38. geobox/feature.py +33 -13
  39. geobox/field.py +33 -21
  40. geobox/file.py +40 -46
  41. geobox/layout.py +28 -1
  42. geobox/log.py +31 -7
  43. geobox/map.py +34 -2
  44. geobox/model3d.py +31 -37
  45. geobox/mosaic.py +28 -7
  46. geobox/plan.py +29 -3
  47. geobox/query.py +39 -14
  48. geobox/raster.py +26 -13
  49. geobox/scene.py +26 -0
  50. geobox/settings.py +30 -1
  51. geobox/task.py +28 -6
  52. geobox/tile3d.py +27 -1
  53. geobox/tileset.py +26 -5
  54. geobox/usage.py +32 -1
  55. geobox/user.py +62 -6
  56. geobox/utils.py +34 -0
  57. geobox/vectorlayer.py +40 -4
  58. geobox/version.py +25 -1
  59. geobox/view.py +37 -17
  60. geobox/workflow.py +27 -1
  61. {geobox-1.4.2.dist-info → geobox-2.0.1.dist-info}/METADATA +4 -1
  62. geobox-2.0.1.dist-info/RECORD +68 -0
  63. geobox-1.4.2.dist-info/RECORD +0 -38
  64. {geobox-1.4.2.dist-info → geobox-2.0.1.dist-info}/WHEEL +0 -0
  65. {geobox-1.4.2.dist-info → geobox-2.0.1.dist-info}/licenses/LICENSE +0 -0
  66. {geobox-1.4.2.dist-info → geobox-2.0.1.dist-info}/top_level.txt +0 -0
geobox/aio/file.py ADDED
@@ -0,0 +1,522 @@
1
+ from urllib.parse import urljoin
2
+ from typing import Optional, Dict, List, Union, TYPE_CHECKING
3
+ import os
4
+ import mimetypes
5
+ from geobox.exception import ValidationError
6
+ import aiohttp
7
+ import sys
8
+
9
+ from .base import AsyncBase
10
+ from .task import Task
11
+ from .feature import Feature
12
+ from ..enums import FileFormat, PublishFileType, InputGeomType, FileType
13
+ from ..utils import clean_data, get_save_path, get_unique_filename
14
+ from ..exception import ApiRequestError
15
+
16
+ if TYPE_CHECKING:
17
+ from . import AsyncGeoboxClient
18
+ from .user import User
19
+ from ..api import GeoboxClient as SyncGeoboxClient
20
+ from ..file import File as SyncFile
21
+
22
+
23
+ class File(AsyncBase):
24
+
25
+ BASE_ENDPOINT: str = 'files/'
26
+
27
+ def __init__(self,
28
+ api: 'AsyncGeoboxClient',
29
+ uuid: str,
30
+ data: Optional[Dict] = {}):
31
+ """
32
+ Constructs all the necessary attributes for the File object.
33
+
34
+ Args:
35
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance.
36
+ uuid (str): The UUID of the file.
37
+ data (Dict, optional): The data of the file.
38
+ """
39
+ super().__init__(api, uuid=uuid, data=data)
40
+
41
+
42
+ def __repr__(self) -> str:
43
+ """
44
+ Return a string representation of the File object.
45
+
46
+ Returns:
47
+ str: A string representation of the File object.
48
+ """
49
+ return f"File(uuid={self.uuid}, file_name={self.name}, file_type={self.file_type.value})"
50
+
51
+
52
+ @property
53
+ def layers(self) -> List[Dict]:
54
+ """
55
+ Get the layers of the file.
56
+
57
+ Returns:
58
+ List[Dict]: The layers of the file.
59
+
60
+ Example:
61
+ >>> from geobox import GeoboxClient
62
+ >>> client = GeoboxClient()
63
+ >>> file = File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
64
+ >>> file.layers
65
+ """
66
+ return self.data.get('layers', {}).get('layers', [])
67
+
68
+
69
+ @property
70
+ def file_type(self) -> 'FileType':
71
+ """
72
+ Get the file type
73
+
74
+ Returns:
75
+ FileType: the file type enumeration
76
+
77
+ Example:
78
+ >>> from geobox.aio import AsyncGeoboxClient
79
+ >>> async with AsyncGeoboxClient() as client:
80
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
81
+ >>> file.file_type
82
+ """
83
+ return FileType(self.data.get('file_type'))
84
+
85
+
86
+ @classmethod
87
+ async def upload_file(cls, api: 'AsyncGeoboxClient', path: str, user_id: int = None, scan_archive: bool = True) -> 'File':
88
+ """
89
+ [async] Upload a file to the GeoBox API.
90
+
91
+ Args:
92
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance.
93
+ path (str): The path to the file to upload.
94
+ user_id (int, optional): specific user. privileges required.
95
+ scan_archive (bool, optional): Whether to scan the archive for layers. default: True
96
+
97
+ Returns:
98
+ File: The uploaded file instance.
99
+
100
+ Raises:
101
+ ValueError: If the file type is invalid.
102
+ FileNotFoundError: If the file does not exist.
103
+
104
+ Example:
105
+ >>> from geobox.aio import AsyncGeoboxClient
106
+ >>> from geobox.aio.file import File
107
+ >>> async with AsyncGeoboxClient() as client:
108
+ >>> file = await File.upload_file(client, path='path/to/file.shp')
109
+ or
110
+ >>> file = await client.upload_file(path='path/to/file.shp')
111
+ """
112
+ if not os.path.exists(path):
113
+ raise FileNotFoundError(f"File not found: {path}")
114
+
115
+ FileFormat(os.path.splitext(path)[1])
116
+
117
+ endpoint = cls.BASE_ENDPOINT
118
+
119
+
120
+ with open(path, 'rb') as f:
121
+ f = open(path, "rb")
122
+ files = {'file': f}
123
+ file_data = await api.post(endpoint, files=files, is_json=False)
124
+ return cls(api, file_data['uuid'], file_data)
125
+
126
+
127
+ @classmethod
128
+ async def get_files(cls, api:'AsyncGeoboxClient', **kwargs) -> Union[List['File'], int]:
129
+ """
130
+ [async] Retrieves a list of files.
131
+
132
+ Args:
133
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
134
+
135
+ Keyword Args:
136
+ q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
137
+ search (str): search term for keyword-based searching among search_fields or all textual fields if search_fields does not have value. NOTE: if q param is defined this param will be ignored.
138
+ search_fields (str): comma separated list of fields for searching
139
+ order_by (str): comma separated list of fields for sorting results [field1 A|D, field2 A|D, …]. e.g. name A, type D.NOTE: "A" denotes ascending order and "D" denotes descending order.
140
+ return_count (bool): if true, the total number of results will be returned. default is False.
141
+ skip (int): number of results to skip. default is 0.
142
+ limit (int): number of results to return. default is 10.
143
+ user_id (int): filter by user id.
144
+ shared (bool): Whether to return shared files. default is False.
145
+
146
+ Returns:
147
+ List[File] | int: A list of File objects or the total number of results.
148
+
149
+ Example:
150
+ >>> from geobox.aio import AsyncGeoboxClient
151
+ >>> from geobox.aio.file import File
152
+ >>> async with AsyncGeoboxClient() as client:
153
+ >>> files = await File.get_files(client, search_fields='name', search='GIS', order_by='name', skip=10, limit=10)
154
+ or
155
+ >>> files = await client.get_files(search_fields='name', search='GIS', order_by='name', skip=10, limit=10)
156
+ """
157
+ params = {
158
+ 'f': 'json',
159
+ 'q': kwargs.get('q', None),
160
+ 'search': kwargs.get('search', None),
161
+ 'search_fields': kwargs.get('search_fields', None),
162
+ 'order_by': kwargs.get('order_by', None),
163
+ 'return_count': kwargs.get('return_count', False),
164
+ 'skip': kwargs.get('skip', 0),
165
+ 'limit': kwargs.get('limit', 10),
166
+ 'user_id': kwargs.get('user_id', None),
167
+ 'shared': kwargs.get('shared', False)
168
+ }
169
+ return await super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: cls(api, item['uuid'], item))
170
+
171
+
172
+ @classmethod
173
+ async def get_file(cls, api: 'AsyncGeoboxClient', uuid: str, user_id: int = None) -> 'File':
174
+ """
175
+ [async] Retrieves a file by its UUID.
176
+
177
+ Args:
178
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance.
179
+ uuid (str): The UUID of the file.
180
+ user_id (int, optional): specific user. privileges required.
181
+
182
+ Returns:
183
+ File: The retrieved file instance.
184
+
185
+ Raises:
186
+ NotFoundError: If the file with the specified UUID is not found.
187
+
188
+ Example:
189
+ >>> from geobox.aio import AsyncGeoboxClient
190
+ >>> from geobox.aio.file import File
191
+ >>> async with AsyncGeoboxClient() as client:
192
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
193
+ or
194
+ >>> file = await client.get_file(uuid="12345678-1234-5678-1234-567812345678")
195
+ """
196
+ params = {
197
+ 'f': 'json',
198
+ 'user_id': user_id
199
+ }
200
+ return await super()._get_detail(api, cls.BASE_ENDPOINT, f'{uuid}/info', params, factory_func=lambda api, item: File(api, item['uuid'], item))
201
+
202
+
203
+ @classmethod
204
+ async def get_files_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> List['File']:
205
+ """
206
+ [async] Get files by name
207
+
208
+ Args:
209
+ api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
210
+ name (str): the name of the file to get
211
+ user_id (int, optional): specific user. privileges required.
212
+
213
+ Returns:
214
+ List[File]: returns files that matches the given name
215
+
216
+ Example:
217
+ >>> from geobox.aio import AsyncGeoboxClient
218
+ >>> from geobox.aio.file import File
219
+ >>> async with AsyncGeoboxClient() as client:
220
+ >>> files = await File.get_files_by_name(client, name='test')
221
+ or
222
+ >>> files = await client.get_files_by_name(name='test')
223
+ """
224
+ return await cls.get_files(api, q=f"name = '{name}'", user_id=user_id)
225
+
226
+
227
+ def _get_file_name(self, response: aiohttp.ClientResponse) -> str:
228
+ """
229
+ Get the file name from the response.
230
+
231
+ Args:
232
+ response (aiohttp.ClientResponse): The response of the request.
233
+
234
+ Returns:
235
+ str: The file name
236
+ """
237
+ if 'Content-Disposition' in response.headers and 'filename=' in response.headers['Content-Disposition']:
238
+ file_name = response.headers['Content-Disposition'].split('filename=')[-1].strip().strip('"')
239
+ else:
240
+ content_type = response.headers.get("Content-Type", "")
241
+ file_name = f'{self.name}.{mimetypes.guess_extension(content_type.split(";")[0])}'
242
+
243
+ return file_name
244
+
245
+
246
+ def _create_progress_bar(self) -> 'tqdm':
247
+ """Creates a progress bar for the task."""
248
+ try:
249
+ from tqdm.auto import tqdm
250
+ except ImportError:
251
+ from .api import logger
252
+ logger.warning("[tqdm] extra is required to show the progress bar. install with: pip install geobox[tqdm]")
253
+ return None
254
+
255
+ return tqdm(unit="B",
256
+ total=int(self.size),
257
+ file=sys.stdout,
258
+ dynamic_ncols=True,
259
+ desc="Downloading",
260
+ unit_scale=True,
261
+ unit_divisor=1024,
262
+ ascii=True
263
+ )
264
+
265
+
266
+ async def download(self, save_path: str = None, progress_bar: bool = True, file_name: str = None, overwrite: bool = False) -> str:
267
+ """
268
+ [async] Download a file and save it to the specified path.
269
+
270
+ Args:
271
+ save_path (str, optional): Path where the file should be saved.
272
+ If not provided, it saves to the current working directory
273
+ using the original filename and appropriate extension.
274
+ progress_bar (bool, optional): Whether to show a progress bar. default: True
275
+ file_name (str, optional): the downloaded file name.
276
+ overwrite (bool, optional): whether to overwrite the downloaded file if it exists on the save path. default is False.
277
+
278
+ Returns:
279
+ str: Path where the file was saved
280
+
281
+ Raises:
282
+ ValueError: If uuid is not set
283
+ OSError: If there are issues with file operations
284
+
285
+ Example:
286
+ >>> from geobox.aio import AsyncGeoboxClient
287
+ >>> from geobox.aio.file import File
288
+ >>> async with AsyncGeoboxClient() as client:
289
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
290
+ >>> await file.download(save_path='path/to/save/')
291
+ """
292
+ if not self.uuid:
293
+ raise ValueError("File UUID is required to download the file")
294
+
295
+ save_path = get_save_path(save_path)
296
+ os.makedirs(save_path, exist_ok=True)
297
+
298
+ # Use the aiohttp session directly for streaming
299
+ endpoint = urljoin(self.api.base_url, f"{self.endpoint}download/")
300
+
301
+ async with self.api.session.session.get(endpoint) as response:
302
+ if response.status != 200:
303
+ raise ApiRequestError(f"Failed to download file: {response.status}")
304
+
305
+ file_name = self._get_file_name(response)
306
+ full_path = os.path.join(save_path, file_name)
307
+ if os.path.exists(full_path) and not overwrite:
308
+ full_path = get_unique_filename(save_path, file_name)
309
+ with open(full_path, 'wb') as f:
310
+ pbar = self._create_progress_bar() if progress_bar else None
311
+
312
+ # Use aiohttp's streaming method
313
+ async for chunk in response.content.iter_chunked(8192):
314
+ f.write(chunk)
315
+ if pbar:
316
+ pbar.update(len(chunk))
317
+ pbar.refresh()
318
+
319
+ if pbar:
320
+ pbar.close()
321
+
322
+ return os.path.abspath(full_path)
323
+
324
+
325
+ async def delete(self) -> None:
326
+ """
327
+ [async] Deletes the file.
328
+
329
+ Returns:
330
+ None
331
+
332
+ Example:
333
+ >>> from geobox.aio import AsyncGeoboxClient
334
+ >>> from geobox.aio.file import File
335
+ >>> async with AsyncGeoboxClient() as client:
336
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
337
+ >>> await file.delete()
338
+ """
339
+ return await super().delete(self.endpoint)
340
+
341
+
342
+ async def publish(self,
343
+ name: str,
344
+ publish_as: 'PublishFileType' = None,
345
+ input_geom_type: 'InputGeomType' = None,
346
+ input_layer: str = None,
347
+ input_dataset: str = None,
348
+ user_id: int = None,
349
+ input_srid: int = Feature.BASE_SRID,
350
+ file_encoding: str = "UTF-8",
351
+ replace_domain_codes_by_values: bool = False,
352
+ report_errors: bool = True,
353
+ as_terrain: bool = False) -> 'Task':
354
+ """
355
+ [async] Publishes a file as a layer.
356
+
357
+ Args:
358
+ name (str): The name of the layer.
359
+ publish_as (PublishFileType, optional): The type of layer to publish as.
360
+ input_geom_type (InputGeomType, optional): The geometry type of the layer.
361
+ input_layer (str, optional): The name of the input layer.
362
+ input_dataset (str, optional): The name of the input dataset.
363
+ user_id (int, optional): Specific user. privileges required.
364
+ input_srid (int, optional): The SRID of the layer. default is: 3857
365
+ file_encoding (str, optional): The encoding of the file. default is "utf-8".
366
+ replace_domain_codes_by_values (bool, optional): Whether to replace domain codes by values. default is False.
367
+ report_errors (bool, optional): Whether to report errors. default is True.
368
+ as_terrain (bool, optional): Whether to publish as terrain. default is False.
369
+
370
+ Returns:
371
+ Task: The task object.
372
+
373
+ Raises:
374
+ ValueError: If the publish_as is not a valid PublishFileType.
375
+ ValidationError: if the zipped file doesn't have any layers to publish.
376
+
377
+ Example:
378
+ >>> from geobox.aio import AsyncGeoboxClient
379
+ >>> from geobox.aio.file import File
380
+ >>> async with AsyncGeoboxClient() as client:
381
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
382
+ >>> await file.publish(publish_as=PublishFileType.VECTOR,
383
+ ... layer_name='my_layer',
384
+ ... input_geom_type=InputGeomType.POINT,
385
+ ... input_layer='layer1',
386
+ ... input_dataset='dataset1',
387
+ ... input_srid=4326,
388
+ ... file_encoding='UTF-8')
389
+ """
390
+ if not publish_as:
391
+ # checks the file format or file first layer format to dynamically set the publish_as
392
+ if self.file_type.value in ['GeoJSON', 'GPKG', 'DXF', 'GPX', 'Shapefile', 'KML', 'CSV', 'FileGDB'] or \
393
+ (self.file_type.value in ['Complex'] and self.layers and \
394
+ FileType(self.layers[0]['format']).value in ['GeoJSON', 'GPKG', 'DXF', 'GPX', 'Shapefile', 'KML', 'CSV', 'FileGDB']):
395
+ publish_as = PublishFileType.VECTOR
396
+
397
+ elif self.file_type.value in ['GeoTIFF'] or \
398
+ (self.file_type.value in ['Complex'] and self.layers and \
399
+ FileType(self.layers[0]['format']).value in ['GeoTIFF']):
400
+ publish_as = PublishFileType.RASTER
401
+
402
+ elif self.file_type.value in ['GLB'] or \
403
+ (self.file_type.value in ['Complex'] and self.layers and \
404
+ FileType(self.layers[0]['format']).value in ['GLB']):
405
+ publish_as = PublishFileType.MODEL3D
406
+
407
+ elif self.file_type.value in ['ThreedTiles']:
408
+ publish_as = PublishFileType.Tiles3D
409
+
410
+ else:
411
+ raise ValidationError('Unknown format')
412
+
413
+ data = clean_data({
414
+ "publish_as": publish_as.value if isinstance(publish_as, PublishFileType) else publish_as,
415
+ "layer_name": name,
416
+ "input_layer": self.layers[0]['layer'] if not input_layer and self.layers else input_layer,
417
+ "input_geom_type": input_geom_type.value if isinstance(input_geom_type, InputGeomType) else input_geom_type,
418
+ "replace_domain_codes_by_values": replace_domain_codes_by_values,
419
+ "input_dataset": self.layers[0]['dataset'] if not input_layer and self.layers else input_dataset,
420
+ "user_id": user_id,
421
+ "input_srid": input_srid,
422
+ "file_encoding": file_encoding,
423
+ "report_errors": report_errors,
424
+ "as_terrain": as_terrain
425
+ })
426
+ endpoint = urljoin(self.endpoint, 'publish/')
427
+ response = await self.api.post(endpoint, data, is_json=False)
428
+ task = await Task.get_task(self.api, response.get('task_id'))
429
+ return task
430
+
431
+
432
+ async def share(self, users: List['User']) -> None:
433
+ """
434
+ [async] Shares the file with specified users.
435
+
436
+ Args:
437
+ users (List[User]): The list of users objects to share the file with.
438
+
439
+ Returns:
440
+ None
441
+
442
+ Example:
443
+ >>> from geobox.aio import AsyncGeoboxClient
444
+ >>> from geobox.aio.file import File
445
+ >>> async with AsyncGeoboxClient() as client:
446
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
447
+ >>> users = await client.search_users(search='John')
448
+ >>> await file.share(users=users)
449
+ """
450
+ await super()._share(self.endpoint, users)
451
+
452
+
453
+ async def unshare(self, users: List['User']) -> None:
454
+ """
455
+ [async] Unshares the file with specified users.
456
+
457
+ Args:
458
+ users (List[User]): The list of users objects to unshare the file with.
459
+
460
+ Returns:
461
+ None
462
+
463
+ Example:
464
+ >>> from geobox.aio import AsyncGeoboxClient
465
+ >>> from geobox.aio.file import File
466
+ >>> async with AsyncGeoboxClient() as client:
467
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
468
+ >>> await users = client.search_users(search='John')
469
+ >>> await file.unshare(users=users)
470
+ """
471
+ await super()._unshare(self.endpoint, users)
472
+
473
+
474
+ async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['User']:
475
+ """
476
+ [async] Retrieves the list of users the file is shared with.
477
+
478
+ Args:
479
+ search (str, optional): The search query.
480
+ skip (int, optional): The number of users to skip.
481
+ limit (int, optional): The maximum number of users to retrieve.
482
+
483
+ Returns:
484
+ List[User]: The list of shared users.
485
+
486
+ Example:
487
+ >>> from geobox.aio import AsyncGeoboxClient
488
+ >>> from geobox.aio.file import File
489
+ >>> async with AsyncGeoboxClient() as client:
490
+ >>> file = await File.get_file(client, uuid="12345678-1234-5678-1234-567812345678")
491
+ >>> await file.get_shared_users(search='John', skip=0, limit=10)
492
+ """
493
+ params = {
494
+ 'search': search,
495
+ 'skip': skip,
496
+ 'limit': limit
497
+ }
498
+ return await super()._get_shared_users(self.endpoint, params)
499
+
500
+
501
+ def to_sync(self, sync_client: 'SyncGeoboxClient') -> 'SyncFile':
502
+ """
503
+ Switch to sync version of the file instance to have access to the sync methods
504
+
505
+ Args:
506
+ sync_client (SyncGeoboxClient): The sync version of the GeoboxClient instance for making requests.
507
+
508
+ Returns:
509
+ geobox.file.File: the async instance of the file.
510
+
511
+ Example:
512
+ >>> from geobox import Geoboxclient
513
+ >>> from geobox.aio import AsyncGeoboxClient
514
+ >>> from geobox.aio.file import File
515
+ >>> client = GeoboxClient()
516
+ >>> async with AsyncGeoboxClient() as async_client:
517
+ >>> file = await File.get_file(async_client, uuid="12345678-1234-5678-1234-567812345678")
518
+ >>> sync_file = file.to_sync(client)
519
+ """
520
+ from ..file import File as SyncFile
521
+
522
+ return SyncFile(api=sync_client, uuid=self.uuid, data=self.data)