pygeobox 1.0.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.
- pygeobox/__init__.py +63 -0
- pygeobox/api.py +2518 -0
- pygeobox/apikey.py +233 -0
- pygeobox/attachment.py +298 -0
- pygeobox/base.py +364 -0
- pygeobox/basemap.py +163 -0
- pygeobox/dashboard.py +316 -0
- pygeobox/enums.py +355 -0
- pygeobox/exception.py +47 -0
- pygeobox/feature.py +508 -0
- pygeobox/field.py +309 -0
- pygeobox/file.py +494 -0
- pygeobox/log.py +101 -0
- pygeobox/map.py +858 -0
- pygeobox/model3d.py +334 -0
- pygeobox/mosaic.py +647 -0
- pygeobox/plan.py +261 -0
- pygeobox/query.py +668 -0
- pygeobox/raster.py +756 -0
- pygeobox/route.py +63 -0
- pygeobox/scene.py +317 -0
- pygeobox/settings.py +166 -0
- pygeobox/task.py +354 -0
- pygeobox/tile3d.py +295 -0
- pygeobox/tileset.py +585 -0
- pygeobox/usage.py +211 -0
- pygeobox/user.py +424 -0
- pygeobox/utils.py +44 -0
- pygeobox/vectorlayer.py +1150 -0
- pygeobox/version.py +249 -0
- pygeobox/view.py +859 -0
- pygeobox/workflow.py +315 -0
- pygeobox-1.0.0.dist-info/METADATA +106 -0
- pygeobox-1.0.0.dist-info/RECORD +37 -0
- pygeobox-1.0.0.dist-info/WHEEL +5 -0
- pygeobox-1.0.0.dist-info/licenses/LICENSE +21 -0
- pygeobox-1.0.0.dist-info/top_level.txt +1 -0
pygeobox/apikey.py
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
from typing import List, Dict, Optional, TYPE_CHECKING
|
2
|
+
from urllib.parse import urljoin
|
3
|
+
|
4
|
+
from .base import Base
|
5
|
+
from .utils import clean_data
|
6
|
+
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
from . import GeoboxClient
|
9
|
+
|
10
|
+
class ApiKey(Base):
|
11
|
+
|
12
|
+
BASE_ENDPOINT = 'apikeys/'
|
13
|
+
|
14
|
+
def __init__(self,
|
15
|
+
api: 'GeoboxClient',
|
16
|
+
key_id: int,
|
17
|
+
data: Optional[Dict] = {}):
|
18
|
+
"""
|
19
|
+
Initialize an apikey instance.
|
20
|
+
|
21
|
+
Args:
|
22
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
23
|
+
key_id (int): The unique identifier for the apikey.
|
24
|
+
data (Dict, optional): The data of the apikey.
|
25
|
+
"""
|
26
|
+
super().__init__(api, data=data)
|
27
|
+
self.key_id = key_id
|
28
|
+
self.endpoint = urljoin(self.BASE_ENDPOINT, str(self.id))
|
29
|
+
|
30
|
+
|
31
|
+
def __repr__(self) -> str:
|
32
|
+
"""
|
33
|
+
Return a string representation of the attachment.
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
str: The string representation of the attachment.
|
37
|
+
"""
|
38
|
+
return f'ApiKey(name={self.name}, revoked={self.revoked})'
|
39
|
+
|
40
|
+
|
41
|
+
@classmethod
|
42
|
+
def get_apikeys(cls, api: 'GeoboxClient', **kwargs) -> List['ApiKey']:
|
43
|
+
"""
|
44
|
+
Get a list of apikeys
|
45
|
+
|
46
|
+
Args:
|
47
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
48
|
+
|
49
|
+
Keyword Args:
|
50
|
+
search (str): search term for keyword-based searching among all textual fields.
|
51
|
+
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.
|
52
|
+
skip (int): Number of layers to skip. default is 0.
|
53
|
+
limit (int): Maximum number of layers to return. default is 10.
|
54
|
+
user_id (int): Specific user. privileges required.
|
55
|
+
|
56
|
+
Example:
|
57
|
+
>>> from geobox import GeoboxClient
|
58
|
+
>>> from geobox.apikey import ApiKey
|
59
|
+
>>> client = GeoboxClient()
|
60
|
+
>>> apikeys = ApiKey.get_apikeys(client)
|
61
|
+
or
|
62
|
+
>>> apikeys = client.get_apikeys()
|
63
|
+
"""
|
64
|
+
params = {
|
65
|
+
'search': kwargs.get('search'),
|
66
|
+
'order_by': kwargs.get('order_by'),
|
67
|
+
'skip': kwargs.get('skip'),
|
68
|
+
'limit': kwargs.get('limit'),
|
69
|
+
'user_id': kwargs.get('user_id')
|
70
|
+
}
|
71
|
+
return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: ApiKey(api, item['id'], item))
|
72
|
+
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def create_apikey(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> 'ApiKey':
|
76
|
+
"""
|
77
|
+
Create an ApiKey
|
78
|
+
|
79
|
+
Args:
|
80
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
81
|
+
name (str): name of the key.
|
82
|
+
user_id (int, optional): Specific user. privileges required.
|
83
|
+
|
84
|
+
Returns:
|
85
|
+
ApiKey: the apikey object
|
86
|
+
|
87
|
+
Example:
|
88
|
+
>>> from geobox import GeoboxClient
|
89
|
+
>>> from geobox.apikey import ApiKey
|
90
|
+
>>> client = GeoboxClient()
|
91
|
+
>>> apikey = ApiKey.create_apikey(client, name='test')
|
92
|
+
or
|
93
|
+
>>> apikey = client.create_apikey(name='test')
|
94
|
+
"""
|
95
|
+
data = clean_data({
|
96
|
+
'name': name,
|
97
|
+
'user_id': user_id
|
98
|
+
})
|
99
|
+
response = api.post(cls.BASE_ENDPOINT, payload=data, is_json=False)
|
100
|
+
return ApiKey(api, response['id'], response)
|
101
|
+
|
102
|
+
|
103
|
+
@classmethod
|
104
|
+
def get_apikey(cls, api: 'GeoboxClient', key_id: int) -> 'ApiKey':
|
105
|
+
"""
|
106
|
+
Get an ApiKey
|
107
|
+
|
108
|
+
Args:
|
109
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
110
|
+
key_id (str): the id of the apikey.
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
ApiKey: the ApiKey object
|
114
|
+
|
115
|
+
Example:
|
116
|
+
>>> from geobox import GeoboxClient
|
117
|
+
>>> from geobox.apikey import ApiKey
|
118
|
+
>>> client = GeoboxClient()
|
119
|
+
>>> apikey = ApiKey.get_apikey(client, key_id=1)
|
120
|
+
or
|
121
|
+
>>> apikey = client.get_apikey(key_id=1)
|
122
|
+
"""
|
123
|
+
params = {
|
124
|
+
'f': 'json'
|
125
|
+
}
|
126
|
+
return super()._get_detail(api=api,
|
127
|
+
endpoint=cls.BASE_ENDPOINT,
|
128
|
+
uuid=key_id,
|
129
|
+
params=params,
|
130
|
+
factory_func=lambda api, item: ApiKey(api, item['id'], item))
|
131
|
+
|
132
|
+
|
133
|
+
@classmethod
|
134
|
+
def get_apikey_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> 'ApiKey':
|
135
|
+
"""
|
136
|
+
Get an ApiKey by name
|
137
|
+
|
138
|
+
Args:
|
139
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
140
|
+
name (str): the name of the key to get
|
141
|
+
user_id (int, optional): specific user. privileges required.
|
142
|
+
|
143
|
+
Returns:
|
144
|
+
ApiKey | None: returns the key if a key matches the given name, else None
|
145
|
+
|
146
|
+
Example:
|
147
|
+
>>> from geobox import GeoboxClient
|
148
|
+
>>> from geobox.apikey import ApiKey
|
149
|
+
>>> client = GeoboxClient()
|
150
|
+
>>> apikey = ApiKey.get_apikey_by_name(client, name='test')
|
151
|
+
or
|
152
|
+
>>> apikey = client.get_apikey_by_name(name='test')
|
153
|
+
"""
|
154
|
+
apikeys = cls.get_apikeys(api, search=name, user_id=user_id)
|
155
|
+
if apikeys and apikeys[0].name == name:
|
156
|
+
return apikeys[0]
|
157
|
+
else:
|
158
|
+
return None
|
159
|
+
|
160
|
+
|
161
|
+
def update(self, name: str, user_id: int = None) -> Dict:
|
162
|
+
"""
|
163
|
+
Update an ApiKey
|
164
|
+
|
165
|
+
Args:
|
166
|
+
name (str): the name of the key
|
167
|
+
user_id (int, optional): Specific user. privileges required.
|
168
|
+
|
169
|
+
Returns:
|
170
|
+
Dict: Updated ApiKey data
|
171
|
+
|
172
|
+
Example:
|
173
|
+
>>> from geobox import GeoboxClient
|
174
|
+
>>> from geobox.apikey import ApiKey
|
175
|
+
>>> client = GeoboxClient()
|
176
|
+
>>> apikey = ApiKey.get_apikey(client, key_id=1)
|
177
|
+
>>> apikey.update(name="updated_name")
|
178
|
+
"""
|
179
|
+
data = {
|
180
|
+
"name": name,
|
181
|
+
"user_id": user_id
|
182
|
+
}
|
183
|
+
return super()._update(self.endpoint, data)
|
184
|
+
|
185
|
+
|
186
|
+
def delete(self) -> None:
|
187
|
+
"""
|
188
|
+
Delete the ApiKey.
|
189
|
+
|
190
|
+
Returns:
|
191
|
+
None
|
192
|
+
|
193
|
+
Example:
|
194
|
+
>>> from geobox import GeoboxClient
|
195
|
+
>>> from geobox.apikey import ApiKey
|
196
|
+
>>> client = GeoboxClient()
|
197
|
+
>>> apikey = ApiKey.get_apikey(client, key_id=1)
|
198
|
+
>>> apikey.delete()
|
199
|
+
"""
|
200
|
+
super().delete(self.endpoint)
|
201
|
+
self.key_id = None
|
202
|
+
|
203
|
+
|
204
|
+
def revoke(self) -> None:
|
205
|
+
"""
|
206
|
+
Revoke an ApiKey
|
207
|
+
|
208
|
+
Example:
|
209
|
+
>>> from geobox import GeoboxClient
|
210
|
+
>>> from geobox.apikey import ApiKey
|
211
|
+
>>> client = GeoboxClient()
|
212
|
+
>>> apikey = ApiKey.get_apikey(client, key_id=1)
|
213
|
+
>>> apikey.revoke()
|
214
|
+
"""
|
215
|
+
endpoint = f"{self.endpoint}/revoke"
|
216
|
+
self.api.post(endpoint)
|
217
|
+
self.data['revoked'] = True
|
218
|
+
|
219
|
+
|
220
|
+
def grant(self) -> None:
|
221
|
+
"""
|
222
|
+
Grant an ApiKey
|
223
|
+
|
224
|
+
Example:
|
225
|
+
>>> from geobox import GeoboxClient
|
226
|
+
>>> from geobox.apikey import ApiKey
|
227
|
+
>>> client = GeoboxClient()
|
228
|
+
>>> apikey = ApiKey.get_apikey(client, key_id=1)
|
229
|
+
>>> apikey.grant()
|
230
|
+
"""
|
231
|
+
endpoint = f"{self.endpoint}/grant"
|
232
|
+
self.api.post(endpoint)
|
233
|
+
self.data['revoked'] = False
|
pygeobox/attachment.py
ADDED
@@ -0,0 +1,298 @@
|
|
1
|
+
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
2
|
+
from urllib.parse import urljoin
|
3
|
+
|
4
|
+
from .base import Base
|
5
|
+
from .utils import clean_data
|
6
|
+
from .enums import AttachmentResourceType
|
7
|
+
from .map import Map
|
8
|
+
from .vectorlayer import VectorLayer
|
9
|
+
from .view import VectorLayerView
|
10
|
+
from .file import File
|
11
|
+
|
12
|
+
if TYPE_CHECKING:
|
13
|
+
from . import GeoboxClient
|
14
|
+
from .feature import Feature
|
15
|
+
|
16
|
+
class Attachment(Base):
|
17
|
+
|
18
|
+
BASE_ENDPOINT = 'attachments/'
|
19
|
+
|
20
|
+
def __init__(self,
|
21
|
+
api: 'GeoboxClient',
|
22
|
+
attachment_id: str,
|
23
|
+
data: Optional[Dict] = {}):
|
24
|
+
"""
|
25
|
+
Initialize an Attachment instance.
|
26
|
+
|
27
|
+
Args:
|
28
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
29
|
+
attachment_id (str): The id for the attachment.
|
30
|
+
data (Dict, optional): The data of the attachment.
|
31
|
+
"""
|
32
|
+
super().__init__(api, data=data)
|
33
|
+
self.attachment_id = attachment_id
|
34
|
+
self.endpoint = urljoin(self.BASE_ENDPOINT, str(self.attachment_id))
|
35
|
+
|
36
|
+
|
37
|
+
def __repr__(self) -> str:
|
38
|
+
"""
|
39
|
+
Return a string representation of the attachment.
|
40
|
+
|
41
|
+
Returns:
|
42
|
+
str: The string representation of the attachment.
|
43
|
+
"""
|
44
|
+
return f"Attachment(name={self.name}, id={self.attachment_id})"
|
45
|
+
|
46
|
+
|
47
|
+
@property
|
48
|
+
def file(self) -> 'File':
|
49
|
+
"""
|
50
|
+
Attachment file property
|
51
|
+
|
52
|
+
Returns:
|
53
|
+
File: the file object
|
54
|
+
"""
|
55
|
+
return File(self.api, self.data['file'].get('uuid'), self.data['file'])
|
56
|
+
|
57
|
+
|
58
|
+
@classmethod
|
59
|
+
def get_attachments(cls, api: 'GeoboxClient', resource_type: AttachmentResourceType, resource_uuid: str, **kwargs) -> Union[List['Attachment'], int]:
|
60
|
+
"""
|
61
|
+
Get list of attachments with optional filtering and pagination.
|
62
|
+
|
63
|
+
Args:
|
64
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
65
|
+
resource_type (AttachmentResourceType): The resource type of the attachment. options are: Map, Vector, View
|
66
|
+
resource_uuid (str): The Resoource uuid of the attachment.
|
67
|
+
|
68
|
+
Keyword Args:
|
69
|
+
element_id (str): the id of the element with attachment.
|
70
|
+
search (str): search term for keyword-based searching among all textual fields.
|
71
|
+
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.
|
72
|
+
skip (int): Number of items to skip. default is 0.
|
73
|
+
limit (int): Number of items to return. default is 10.
|
74
|
+
return_count (bool): Whether to return total count. default is False.
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
List[Attachment] | int: A list of attachments instances or the total number of attachments.
|
78
|
+
|
79
|
+
Example:
|
80
|
+
>>> from geobox import GeoboxClient
|
81
|
+
>>> from geobox.attachment import Attachment
|
82
|
+
>>> client = GeoboxClient()
|
83
|
+
>>> attachments = Attachment.get_attachments(client, q="name LIKE '%My attachment%'")
|
84
|
+
or
|
85
|
+
>>> attachments = client.get_attachments(q="name LIKE '%My attachment%'")
|
86
|
+
"""
|
87
|
+
params = {
|
88
|
+
'resource_type': resource_type.value,
|
89
|
+
'resource_uuid': resource_uuid,
|
90
|
+
'element_id': kwargs.get('element_id'),
|
91
|
+
'search': kwargs.get('search'),
|
92
|
+
'order_by': kwargs.get('order_by'),
|
93
|
+
'skip': kwargs.get('skip', 0),
|
94
|
+
'limit': kwargs.get('limit', 10),
|
95
|
+
'return_count': kwargs.get('return_count')
|
96
|
+
}
|
97
|
+
return super()._get_list(api, cls.BASE_ENDPOINT, params, factory_func=lambda api, item: Attachment(api, item['id'], item))
|
98
|
+
|
99
|
+
|
100
|
+
@classmethod
|
101
|
+
def create_attachment(cls,
|
102
|
+
api: 'GeoboxClient',
|
103
|
+
name: str,
|
104
|
+
loc_x: int,
|
105
|
+
loc_y: int,
|
106
|
+
resource: Union['Map', 'VectorLayer', 'VectorLayerView'],
|
107
|
+
file: 'File',
|
108
|
+
feature: 'Feature' = None,
|
109
|
+
display_name: str = None,
|
110
|
+
description: str = None, ) -> 'Attachment':
|
111
|
+
"""
|
112
|
+
Create a new Attachment.
|
113
|
+
|
114
|
+
Args:
|
115
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
116
|
+
name (str): The name of the scene.
|
117
|
+
loc_x (int): x parameter of the attachment location.
|
118
|
+
loc_y (int): y parameter of the attachment location.
|
119
|
+
resource (Map | VectorLayer | VectorLayerView): the resource object.
|
120
|
+
file (File): the file object.
|
121
|
+
feature (Feature, optional): the feature object.
|
122
|
+
display_name (str, optional): The display name of the scene.
|
123
|
+
description (str, optional): The description of the scene.
|
124
|
+
|
125
|
+
Returns:
|
126
|
+
Attachment: The newly created Attachment instance.
|
127
|
+
|
128
|
+
Raises:
|
129
|
+
ValidationError: If the Attachment data is invalid.
|
130
|
+
|
131
|
+
Example:
|
132
|
+
>>> from geobox import GeoboxClient
|
133
|
+
>>> from geobox.attachment import Attachment
|
134
|
+
>>> client = GeoboxClient()
|
135
|
+
>>> layer = client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
|
136
|
+
>>> feature = layer.get_feature(feature_id=1)
|
137
|
+
>>> file = client.get_file(uuid="12345678-1234-5678-1234-567812345678")
|
138
|
+
>>> attachment = Attachment.create_attachment(client,
|
139
|
+
... name="my_attachment",
|
140
|
+
... loc_x=30,
|
141
|
+
... loc_y=50,
|
142
|
+
... resource=layer,
|
143
|
+
... file=file,
|
144
|
+
... feature=feature,
|
145
|
+
... display_name="My Attachment",
|
146
|
+
... description="Attachment Description")
|
147
|
+
or
|
148
|
+
>>> attachment = client.create_attachment(name="my_attachment",
|
149
|
+
... loc_x=30,
|
150
|
+
... loc_y=50,
|
151
|
+
... resource=layer,
|
152
|
+
... file=file,
|
153
|
+
... feature=feature,
|
154
|
+
... display_name="My Attachment",
|
155
|
+
... description="Attachment Description")
|
156
|
+
"""
|
157
|
+
if isinstance(resource, VectorLayer):
|
158
|
+
resource_type = AttachmentResourceType.Vector.value
|
159
|
+
|
160
|
+
if isinstance(resource, VectorLayerView):
|
161
|
+
resource_type = AttachmentResourceType.View.value
|
162
|
+
|
163
|
+
if isinstance(resource, Map):
|
164
|
+
resource_type = AttachmentResourceType.Map.value
|
165
|
+
|
166
|
+
data = {
|
167
|
+
"name": name,
|
168
|
+
"display_name": display_name,
|
169
|
+
"description": description,
|
170
|
+
"loc_x": loc_x,
|
171
|
+
"loc_y": loc_y,
|
172
|
+
"resource_type": resource_type,
|
173
|
+
"resource_uuid": resource.uuid,
|
174
|
+
"element_id": feature.id,
|
175
|
+
"file_id": file.id
|
176
|
+
}
|
177
|
+
return super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: Attachment(api, item['id'], item))
|
178
|
+
|
179
|
+
|
180
|
+
@classmethod
|
181
|
+
def update_attachment(cls, api: 'GeoboxClient', attachment_id: int, **kwargs) -> Dict:
|
182
|
+
"""
|
183
|
+
Update the attachment.
|
184
|
+
|
185
|
+
Args:
|
186
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
187
|
+
attachment_id (int): the attachment id.
|
188
|
+
|
189
|
+
Keyword Args:
|
190
|
+
name (str): The name of the attachment.
|
191
|
+
display_name (str): The display name of the attachment.
|
192
|
+
description (str): The description of the attachment.
|
193
|
+
loc_x (int): x parameter of the attachment location.
|
194
|
+
loc_y (int): y parameter of the attachment location.
|
195
|
+
|
196
|
+
Returns:
|
197
|
+
Dict: The updated attachment data.
|
198
|
+
|
199
|
+
Raises:
|
200
|
+
ValidationError: If the attachment data is invalid.
|
201
|
+
|
202
|
+
Example:
|
203
|
+
>>> from geobox import GeoboxClient
|
204
|
+
>>> from geobox.attachment import Attachment
|
205
|
+
>>> client = GeoboxClient()
|
206
|
+
>>> Attachment.update_attachment(client, attachment_id=1, display_name="New Display Name")
|
207
|
+
or
|
208
|
+
>>> client.update_attachment(attachment_id=1, display_name="New Display Name")
|
209
|
+
"""
|
210
|
+
data = clean_data({
|
211
|
+
"name": kwargs.get('name'),
|
212
|
+
"display_name": kwargs.get('display_name'),
|
213
|
+
"description": kwargs.get('description'),
|
214
|
+
"loc_x": kwargs.get('loc_x'),
|
215
|
+
"loc_y": kwargs.get('loc_y')
|
216
|
+
})
|
217
|
+
endpoint = urljoin(cls.BASE_ENDPOINT, str(attachment_id))
|
218
|
+
response = api.put(endpoint, data)
|
219
|
+
return response
|
220
|
+
|
221
|
+
|
222
|
+
def update(self, **kwargs) -> Dict:
|
223
|
+
"""
|
224
|
+
Update the attachment.
|
225
|
+
|
226
|
+
Keyword Args:
|
227
|
+
name (str): The name of the attachment.
|
228
|
+
display_name (str): The display name of the attachment.
|
229
|
+
description (str): The description of the attachment.
|
230
|
+
loc_x (int): x parameter of the attachment location.
|
231
|
+
loc_y (int): y parameter of the attachment location.
|
232
|
+
|
233
|
+
Returns:
|
234
|
+
Dict: The updated attachment data.
|
235
|
+
|
236
|
+
Raises:
|
237
|
+
ValidationError: If the attachment data is invalid.
|
238
|
+
|
239
|
+
Example:
|
240
|
+
>>> from geobox import GeoboxClient
|
241
|
+
>>> from geobox.attachment import Attachment
|
242
|
+
>>> client = GeoboxClient()
|
243
|
+
>>> attachment = Attachment.get_attachments(client)[0]
|
244
|
+
>>> attachment.update(display_name="New Display Name")
|
245
|
+
"""
|
246
|
+
data = clean_data({
|
247
|
+
"name": kwargs.get('name'),
|
248
|
+
"display_name": kwargs.get('display_name'),
|
249
|
+
"description": kwargs.get('description'),
|
250
|
+
"loc_x": kwargs.get('loc_x'),
|
251
|
+
"loc_y": kwargs.get('loc_y')
|
252
|
+
})
|
253
|
+
response = self.api.put(self.endpoint, data)
|
254
|
+
self._update_properties(response)
|
255
|
+
return response
|
256
|
+
|
257
|
+
|
258
|
+
def delete(self) -> None:
|
259
|
+
"""
|
260
|
+
Delete the scene.
|
261
|
+
|
262
|
+
Returns:
|
263
|
+
None
|
264
|
+
|
265
|
+
Raises:
|
266
|
+
ApiRequestError: If the API request fails.
|
267
|
+
ValidationError: If the scene data is invalid.
|
268
|
+
|
269
|
+
Example:
|
270
|
+
>>> from geobox import GeoboxClient
|
271
|
+
>>> from geobox.attachment import Attachment
|
272
|
+
>>> client = GeoboxClient()
|
273
|
+
>>> attachment = Attachment.get_attachments(client)[0]
|
274
|
+
>>> attachment.delete()
|
275
|
+
"""
|
276
|
+
super().delete(self.endpoint)
|
277
|
+
self.attachment_id = None
|
278
|
+
|
279
|
+
|
280
|
+
@property
|
281
|
+
def thumbnail(self) -> str:
|
282
|
+
"""
|
283
|
+
Get the thumbnail URL of the attachment.
|
284
|
+
|
285
|
+
Returns:
|
286
|
+
str: The thumbnail of the scene.
|
287
|
+
|
288
|
+
Example:
|
289
|
+
>>> from geobox import GeoboxClient
|
290
|
+
>>> from geobox.attachment import Attachment
|
291
|
+
>>> client = GeoboxClient()
|
292
|
+
>>> attachment = Attachment.get_attachment(client, uuid="12345678-1234-5678-1234-567812345678")
|
293
|
+
>>> attachment.thumbnail
|
294
|
+
'https://example.com/thumbnail.png'
|
295
|
+
"""
|
296
|
+
endpoint = f"{self.api.base_url}{self.endpoint}thumbnail"
|
297
|
+
return endpoint
|
298
|
+
|