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