geobox 2.0.1__py3-none-any.whl → 2.2.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.
- geobox/__init__.py +61 -63
- geobox/aio/__init__.py +61 -63
- geobox/aio/api.py +489 -473
- geobox/aio/apikey.py +263 -263
- geobox/aio/attachment.py +341 -339
- geobox/aio/base.py +261 -262
- geobox/aio/basemap.py +196 -196
- geobox/aio/dashboard.py +340 -342
- geobox/aio/feature.py +23 -33
- geobox/aio/field.py +315 -321
- geobox/aio/file.py +72 -72
- geobox/aio/layout.py +340 -341
- geobox/aio/log.py +23 -23
- geobox/aio/map.py +1033 -1034
- geobox/aio/model3d.py +415 -415
- geobox/aio/mosaic.py +696 -696
- geobox/aio/plan.py +314 -314
- geobox/aio/query.py +693 -693
- geobox/aio/raster.py +907 -869
- geobox/aio/raster_analysis.py +740 -0
- geobox/aio/route.py +4 -4
- geobox/aio/scene.py +340 -342
- geobox/aio/settings.py +18 -18
- geobox/aio/task.py +404 -402
- geobox/aio/tile3d.py +337 -339
- geobox/aio/tileset.py +102 -103
- geobox/aio/usage.py +52 -51
- geobox/aio/user.py +506 -507
- geobox/aio/vector_tool.py +1968 -0
- geobox/aio/vectorlayer.py +315 -306
- geobox/aio/version.py +272 -273
- geobox/aio/view.py +1019 -983
- geobox/aio/workflow.py +340 -341
- geobox/api.py +18 -2
- geobox/apikey.py +262 -262
- geobox/attachment.py +336 -337
- geobox/base.py +384 -384
- geobox/basemap.py +194 -194
- geobox/dashboard.py +339 -341
- geobox/enums.py +432 -348
- geobox/feature.py +5 -5
- geobox/field.py +320 -320
- geobox/file.py +4 -4
- geobox/layout.py +339 -340
- geobox/log.py +4 -4
- geobox/map.py +1031 -1032
- geobox/model3d.py +410 -410
- geobox/mosaic.py +696 -696
- geobox/plan.py +313 -313
- geobox/query.py +691 -691
- geobox/raster.py +907 -863
- geobox/raster_analysis.py +737 -0
- geobox/scene.py +341 -342
- geobox/settings.py +194 -194
- geobox/task.py +399 -400
- geobox/tile3d.py +337 -338
- geobox/tileset.py +4 -4
- geobox/usage.py +3 -3
- geobox/user.py +503 -503
- geobox/vector_tool.py +1968 -0
- geobox/vectorlayer.py +5 -5
- geobox/version.py +272 -272
- geobox/view.py +981 -981
- geobox/workflow.py +338 -339
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/METADATA +15 -1
- geobox-2.2.0.dist-info/RECORD +72 -0
- geobox-2.0.1.dist-info/RECORD +0 -68
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/WHEEL +0 -0
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/licenses/LICENSE +0 -0
- {geobox-2.0.1.dist-info → geobox-2.2.0.dist-info}/top_level.txt +0 -0
geobox/aio/scene.py
CHANGED
|
@@ -1,342 +1,340 @@
|
|
|
1
|
-
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from . import
|
|
8
|
-
from
|
|
9
|
-
from ..
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
>>> from geobox.aio import
|
|
55
|
-
>>>
|
|
56
|
-
>>>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
>>> from geobox.aio import
|
|
105
|
-
>>>
|
|
106
|
-
>>>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
>>> from geobox.aio import
|
|
140
|
-
>>>
|
|
141
|
-
>>>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
>>> from geobox.aio import
|
|
168
|
-
>>>
|
|
169
|
-
>>>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
""
|
|
174
|
-
scenes
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
>>> from geobox.aio import
|
|
201
|
-
>>>
|
|
202
|
-
>>>
|
|
203
|
-
>>>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
>>> from geobox.aio import
|
|
225
|
-
>>>
|
|
226
|
-
>>>
|
|
227
|
-
>>>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
>>> from geobox.aio import
|
|
243
|
-
>>>
|
|
244
|
-
>>>
|
|
245
|
-
>>> scene
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
>>>
|
|
264
|
-
>>>
|
|
265
|
-
>>>
|
|
266
|
-
>>>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
>>>
|
|
285
|
-
>>>
|
|
286
|
-
>>>
|
|
287
|
-
>>>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
>>>
|
|
308
|
-
>>>
|
|
309
|
-
>>>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
'
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
>>> from geobox import
|
|
333
|
-
>>>
|
|
334
|
-
>>>
|
|
335
|
-
>>>
|
|
336
|
-
>>>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return SyncScene(api=sync_client, uuid=self.uuid, data=self.data)
|
|
1
|
+
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
|
2
|
+
|
|
3
|
+
from .base import AsyncBase
|
|
4
|
+
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from . import AsyncGeoboxClient
|
|
7
|
+
from .user import AsyncUser
|
|
8
|
+
from ..api import GeoboxClient
|
|
9
|
+
from ..scene import Scene
|
|
10
|
+
|
|
11
|
+
class AsyncScene(AsyncBase):
|
|
12
|
+
|
|
13
|
+
BASE_ENDPOINT = 'scenes/'
|
|
14
|
+
|
|
15
|
+
def __init__(self,
|
|
16
|
+
api: 'AsyncGeoboxClient',
|
|
17
|
+
uuid: str,
|
|
18
|
+
data: Optional[Dict] = {}):
|
|
19
|
+
"""
|
|
20
|
+
Initialize a Scene instance.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
|
|
24
|
+
uuid (str): The unique identifier for the Scene.
|
|
25
|
+
data (Dict): The data of the Scene.
|
|
26
|
+
"""
|
|
27
|
+
super().__init__(api, uuid=uuid, data=data)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
async def get_scenes(cls, api: 'AsyncGeoboxClient', **kwargs) -> Union[List['AsyncScene'], int]:
|
|
32
|
+
"""
|
|
33
|
+
[async] Get list of scenes with optional filtering and pagination.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
|
|
37
|
+
|
|
38
|
+
Keyword Args:
|
|
39
|
+
q (str): query filter based on OGC CQL standard. e.g. "field1 LIKE '%GIS%' AND created_at > '2021-01-01'"
|
|
40
|
+
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.
|
|
41
|
+
search_fields (str): comma separated list of fields for searching.
|
|
42
|
+
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.
|
|
43
|
+
return_count (bool): Whether to return total count. default is False.
|
|
44
|
+
skip (int): Number of items to skip. default is 0.
|
|
45
|
+
limit (int): Number of items to return. default is 10.
|
|
46
|
+
user_id (int): Specific user. privileges required.
|
|
47
|
+
shared (bool): Whether to return shared scenes. default is False.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
List[AsyncScene] | int: A list of scene instances or the total number of scenes.
|
|
51
|
+
|
|
52
|
+
Example:
|
|
53
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
54
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
55
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
56
|
+
>>> scenes = await AsyncScene.get_scenes(client, q="name LIKE '%My scene%'")
|
|
57
|
+
or
|
|
58
|
+
>>> scenes = await client.get_scenes(q="name LIKE '%My scene%'")
|
|
59
|
+
"""
|
|
60
|
+
params = {
|
|
61
|
+
'f': 'json',
|
|
62
|
+
'q': kwargs.get('q'),
|
|
63
|
+
'search': kwargs.get('search'),
|
|
64
|
+
'search_fields': kwargs.get('search_fields'),
|
|
65
|
+
'order_by': kwargs.get('order_by'),
|
|
66
|
+
'return_count': kwargs.get('return_count', False),
|
|
67
|
+
'skip': kwargs.get('skip', 0),
|
|
68
|
+
'limit': kwargs.get('limit', 10),
|
|
69
|
+
'user_id': kwargs.get('user_id'),
|
|
70
|
+
'shared': kwargs.get('shared', False)
|
|
71
|
+
}
|
|
72
|
+
return await super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: AsyncScene(api, item['uuid'], item))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
async def create_scene(cls,
|
|
77
|
+
api: 'AsyncGeoboxClient',
|
|
78
|
+
name: str,
|
|
79
|
+
display_name: str = None,
|
|
80
|
+
description: str = None,
|
|
81
|
+
settings: Dict = {},
|
|
82
|
+
thumbnail: str = None,
|
|
83
|
+
user_id: int = None) -> 'AsyncScene':
|
|
84
|
+
"""
|
|
85
|
+
[async] Create a new scene.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
|
|
89
|
+
name (str): The name of the scene.
|
|
90
|
+
display_name (str, optional): The display name of the scene.
|
|
91
|
+
description (str, optional): The description of the scene.
|
|
92
|
+
settings (Dict,optional): The settings of the scene.
|
|
93
|
+
thumbnail (str, optional): The thumbnail of the scene.
|
|
94
|
+
user_id (int, optional): Specific user. privileges required.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
AsyncScene: The newly created scene instance.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
ValidationError: If the scene data is invalid.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
104
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
105
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
106
|
+
>>> scene = await AsyncScene.create_scene(client, name="my_scene")
|
|
107
|
+
or
|
|
108
|
+
>>> scene = await client.create_scene(name="my_scene")
|
|
109
|
+
"""
|
|
110
|
+
data = {
|
|
111
|
+
"name": name,
|
|
112
|
+
"display_name": display_name,
|
|
113
|
+
"description": description,
|
|
114
|
+
"settings": settings,
|
|
115
|
+
"thumbnail": thumbnail,
|
|
116
|
+
"user_id": user_id,
|
|
117
|
+
}
|
|
118
|
+
return await super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: AsyncScene(api, item['uuid'], item))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@classmethod
|
|
122
|
+
async def get_scene(cls, api: 'AsyncGeoboxClient', uuid: str, user_id: int = None) -> 'AsyncScene':
|
|
123
|
+
"""
|
|
124
|
+
[async] Get a scene by its UUID.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
|
|
128
|
+
uuid (str): The UUID of the scene to get.
|
|
129
|
+
user_id (int, optional): Specific user. privileges required.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
AsyncScene: The scene object.
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
NotFoundError: If the scene with the specified UUID is not found.
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
139
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
140
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
141
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
142
|
+
or
|
|
143
|
+
>>> scene = await client.get_scene(uuid="12345678-1234-5678-1234-567812345678")
|
|
144
|
+
"""
|
|
145
|
+
params = {
|
|
146
|
+
'f': 'json',
|
|
147
|
+
'user_id': user_id,
|
|
148
|
+
}
|
|
149
|
+
return await super()._get_detail(api, cls.BASE_ENDPOINT, uuid, params, factory_func=lambda api, item: AsyncScene(api, item['uuid'], item))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@classmethod
|
|
153
|
+
async def get_scene_by_name(cls, api: 'AsyncGeoboxClient', name: str, user_id: int = None) -> Union['AsyncScene', None]:
|
|
154
|
+
"""
|
|
155
|
+
[async] Get a scene by name
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
api (AsyncGeoboxClient): The AsyncGeoboxClient instance for making requests.
|
|
159
|
+
name (str): the name of the scene to get
|
|
160
|
+
user_id (int, optional): specific user. privileges required.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
AsyncScene | None: returns the scene if a scene matches the given name, else None
|
|
164
|
+
|
|
165
|
+
Example:
|
|
166
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
167
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
168
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
169
|
+
>>> scene = await AsyncScene.get_scene_by_name(client, name='test')
|
|
170
|
+
or
|
|
171
|
+
>>> scene = await client.get_scene_by_name(name='test')
|
|
172
|
+
"""
|
|
173
|
+
scenes = await cls.get_scenes(api, q=f"name = '{name}'", user_id=user_id)
|
|
174
|
+
if scenes and scenes[0].name == name:
|
|
175
|
+
return scenes[0]
|
|
176
|
+
else:
|
|
177
|
+
return None
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
async def update(self, **kwargs) -> Dict:
|
|
181
|
+
"""
|
|
182
|
+
[async] Update the scene.
|
|
183
|
+
|
|
184
|
+
Keyword Args:
|
|
185
|
+
name (str): The name of the scene.
|
|
186
|
+
display_name (str): The display name of the scene.
|
|
187
|
+
description (str): The description of the scene.
|
|
188
|
+
settings (Dict): The settings of the scene.
|
|
189
|
+
thumbnail (str): The thumbnail of the scene.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
Dict: The updated scene data.
|
|
193
|
+
|
|
194
|
+
Raises:
|
|
195
|
+
ApiRequestError: If the API request fails.
|
|
196
|
+
ValidationError: If the scene data is invalid.
|
|
197
|
+
|
|
198
|
+
Example:
|
|
199
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
200
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
201
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
202
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
203
|
+
>>> await scene.update(display_name="New Display Name")
|
|
204
|
+
"""
|
|
205
|
+
data = {
|
|
206
|
+
"name": kwargs.get('name'),
|
|
207
|
+
"display_name": kwargs.get('display_name'),
|
|
208
|
+
"description": kwargs.get('description'),
|
|
209
|
+
"settings": kwargs.get('settings'),
|
|
210
|
+
"thumbnail": kwargs.get('thumbnail')
|
|
211
|
+
}
|
|
212
|
+
return await super()._update(self.endpoint, data)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
async def delete(self) -> None:
|
|
216
|
+
"""
|
|
217
|
+
[async] Delete the scene.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
None
|
|
221
|
+
|
|
222
|
+
Example:
|
|
223
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
224
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
225
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
226
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
227
|
+
>>> await scene.delete()
|
|
228
|
+
"""
|
|
229
|
+
await super()._delete(self.endpoint)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@property
|
|
233
|
+
def thumbnail(self) -> str:
|
|
234
|
+
"""
|
|
235
|
+
Get the thumbnail URL of the scene.
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
str: The thumbnail of the scene.
|
|
239
|
+
|
|
240
|
+
Example:
|
|
241
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
242
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
243
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
244
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
245
|
+
>>> scene.thumbnail
|
|
246
|
+
"""
|
|
247
|
+
return super()._thumbnail()
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
async def share(self, users: List['AsyncUser']) -> None:
|
|
251
|
+
"""
|
|
252
|
+
[async] Shares the scene with specified users.
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
users (List[AsyncUser]): The list of user objects to share the scene with.
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
None
|
|
259
|
+
|
|
260
|
+
Example:
|
|
261
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
262
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
263
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
264
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
265
|
+
>>> users = await client.search_users(search='John')
|
|
266
|
+
>>> await scene.share(users=users)
|
|
267
|
+
"""
|
|
268
|
+
await super()._share(self.endpoint, users)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
async def unshare(self, users: List['AsyncUser']) -> None:
|
|
272
|
+
"""
|
|
273
|
+
[async] Unshares the scene with specified users.
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
users (List[AsyncUser]): The list of user objects to unshare the scene with.
|
|
277
|
+
|
|
278
|
+
Returns:
|
|
279
|
+
None
|
|
280
|
+
|
|
281
|
+
Example:
|
|
282
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
283
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
284
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
285
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
286
|
+
>>> users = await client.search_users(search='John')
|
|
287
|
+
>>> await scene.unshare(users=users)
|
|
288
|
+
"""
|
|
289
|
+
await super()._unshare(self.endpoint, users)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
async def get_shared_users(self, search: str = None, skip: int = 0, limit: int = 10) -> List['AsyncUser']:
|
|
293
|
+
"""
|
|
294
|
+
[async] Retrieves the list of users the scene is shared with.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
search (str, optional): The search query.
|
|
298
|
+
skip (int, optional): The number of users to skip.
|
|
299
|
+
limit (int, optional): The maximum number of users to retrieve.
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
List[AsyncUser]: The list of shared users.
|
|
303
|
+
|
|
304
|
+
Example:
|
|
305
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
306
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
307
|
+
>>> async with AsyncGeoboxClient() as client:
|
|
308
|
+
>>> scene = await AsyncScene.get_scene(client, uuid="12345678-1234-5678-1234-567812345678")
|
|
309
|
+
>>> await scene.get_shared_users(search='John', skip=0, limit=10)
|
|
310
|
+
"""
|
|
311
|
+
params = {
|
|
312
|
+
'search': search,
|
|
313
|
+
'skip': skip,
|
|
314
|
+
'limit': limit
|
|
315
|
+
}
|
|
316
|
+
return await super()._get_shared_users(self.endpoint, params)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def to_sync(self, sync_client: 'GeoboxClient') -> 'Scene':
|
|
320
|
+
"""
|
|
321
|
+
Switch to sync version of the scene instance to have access to the sync methods
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
Scene: the sync instance of the scene.
|
|
328
|
+
|
|
329
|
+
Example:
|
|
330
|
+
>>> from geobox import Geoboxclient
|
|
331
|
+
>>> from geobox.aio import AsyncGeoboxClient
|
|
332
|
+
>>> from geobox.aio.scene import AsyncScene
|
|
333
|
+
>>> client = GeoboxClient()
|
|
334
|
+
>>> async with AsyncGeoboxClient() as async_client:
|
|
335
|
+
>>> scene = await AsyncScene.get_scene(async_client, uuid="12345678-1234-5678-1234-567812345678")
|
|
336
|
+
>>> sync_scene = scene.to_sync(client)
|
|
337
|
+
"""
|
|
338
|
+
from ..scene import Scene
|
|
339
|
+
|
|
340
|
+
return Scene(api=sync_client, uuid=self.uuid, data=self.data)
|