pygeobox 1.0.3__py3-none-any.whl → 1.0.4__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 -63
- pygeobox/api.py +2517 -2517
- pygeobox/apikey.py +232 -232
- pygeobox/attachment.py +297 -297
- pygeobox/base.py +364 -364
- pygeobox/basemap.py +162 -162
- pygeobox/dashboard.py +316 -316
- pygeobox/enums.py +354 -354
- pygeobox/exception.py +47 -47
- pygeobox/field.py +309 -309
- pygeobox/map.py +858 -858
- pygeobox/model3d.py +334 -334
- pygeobox/mosaic.py +647 -647
- pygeobox/plan.py +260 -260
- pygeobox/query.py +668 -668
- pygeobox/raster.py +756 -756
- pygeobox/route.py +63 -63
- pygeobox/scene.py +317 -317
- pygeobox/settings.py +165 -165
- pygeobox/task.py +354 -354
- pygeobox/tile3d.py +294 -294
- pygeobox/tileset.py +585 -585
- pygeobox/user.py +423 -423
- pygeobox/utils.py +43 -43
- pygeobox/vectorlayer.py +1149 -1149
- pygeobox/version.py +248 -248
- pygeobox/view.py +859 -859
- pygeobox/workflow.py +315 -315
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/METADATA +3 -5
- pygeobox-1.0.4.dist-info/RECORD +37 -0
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/licenses/LICENSE +21 -21
- pygeobox-1.0.3.dist-info/RECORD +0 -37
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/WHEEL +0 -0
- {pygeobox-1.0.3.dist-info → pygeobox-1.0.4.dist-info}/top_level.txt +0 -0
pygeobox/plan.py
CHANGED
@@ -1,261 +1,261 @@
|
|
1
|
-
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
2
|
-
from urllib.parse import urljoin
|
3
|
-
|
4
|
-
from .base import Base
|
5
|
-
|
6
|
-
if TYPE_CHECKING:
|
7
|
-
from . import GeoboxClient
|
8
|
-
|
9
|
-
class Plan(Base):
|
10
|
-
|
11
|
-
BASE_ENDPOINT = 'plans/'
|
12
|
-
|
13
|
-
def __init__(self,
|
14
|
-
api: 'GeoboxClient',
|
15
|
-
plan_id: int,
|
16
|
-
data: Optional[Dict] = {}):
|
17
|
-
"""
|
18
|
-
Initialize a plan instance.
|
19
|
-
|
20
|
-
Args:
|
21
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
22
|
-
plan_id (str): The id for the plan.
|
23
|
-
data (Dict, optional): The data of the plan.
|
24
|
-
"""
|
25
|
-
super().__init__(api, data=data)
|
26
|
-
self.plan_id = plan_id
|
27
|
-
self.endpoint = urljoin(self.BASE_ENDPOINT, str(self.id))
|
28
|
-
|
29
|
-
|
30
|
-
@classmethod
|
31
|
-
def get_plans(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Plan'], int]:
|
32
|
-
"""
|
33
|
-
Get list of plans 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 plans. default is False.
|
48
|
-
|
49
|
-
Returns:
|
50
|
-
List[Plan] | int: A list of plan instances or the total number of plans.
|
51
|
-
|
52
|
-
Example:
|
53
|
-
>>> from geobox import GeoboxClient
|
54
|
-
>>> from geobox.plan import Plan
|
55
|
-
>>> client = GeoboxClient()
|
56
|
-
>>> plans = Plan.get_plan(client, q="name LIKE '%My plan%'")
|
57
|
-
or
|
58
|
-
>>> plans = client.get_plan(q="name LIKE '%My plan%'")
|
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: Plan(api, item['id'], item))
|
73
|
-
|
74
|
-
|
75
|
-
@classmethod
|
76
|
-
def create_plan(cls,
|
77
|
-
api: 'GeoboxClient',
|
78
|
-
name: str,
|
79
|
-
plan_color: str,
|
80
|
-
storage: int,
|
81
|
-
concurrent_tasks: int,
|
82
|
-
daily_api_calls: int,
|
83
|
-
monthly_api_calls: int,
|
84
|
-
daily_traffic: int,
|
85
|
-
monthly_traffic: int,
|
86
|
-
daily_process: int,
|
87
|
-
monthly_process: int,
|
88
|
-
number_of_days: int = None,
|
89
|
-
display_name: str = None,
|
90
|
-
description: str = None) -> 'Plan':
|
91
|
-
"""
|
92
|
-
Create a new plan.
|
93
|
-
|
94
|
-
Args:
|
95
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
96
|
-
name (str): The name of the plan.
|
97
|
-
plan_color (str): hex value of the color. e.g. #000000.
|
98
|
-
storage (int): storage value in bytes. must be greater that 1.
|
99
|
-
concurrent_tasks (int): number of concurrent tasks. must be greater that 1.
|
100
|
-
daily_api_calls (int): number of daily api calls. must be greater that 1.
|
101
|
-
monthly_api_calls (int): number of monthly api calls. must be greater that 1.
|
102
|
-
daily_traffic (int): number of daily traffic. must be greater that 1.
|
103
|
-
monthly_traffic (int): number of monthly traffic. must be greater that 1.
|
104
|
-
daily_process (int): number of daily processes. must be greater that 1.
|
105
|
-
monthly_process (int): number of monthly processes. must be greater that 1.
|
106
|
-
number_of_days (int, optional): number of days. must be greater that 1.
|
107
|
-
display_name (str, optional): display name of the plan.
|
108
|
-
description (str, optional): description of the plan.
|
109
|
-
|
110
|
-
Returns:
|
111
|
-
Plan: The newly created plan instance.
|
112
|
-
|
113
|
-
Raises:
|
114
|
-
ValidationError: If the plan data is invalid.
|
115
|
-
|
116
|
-
Example:
|
117
|
-
>>> from geobox import GeoboxClient
|
118
|
-
>>> from geobox.plan import Plan
|
119
|
-
>>> client = GeoboxClient()
|
120
|
-
>>> plan = Plan.create_plan(client,
|
121
|
-
... name="new_plan",
|
122
|
-
... display_name=" New Plan",
|
123
|
-
... description="new plan description",
|
124
|
-
... plan_color="#000000",
|
125
|
-
... storage=10,
|
126
|
-
... concurrent_tasks=10,
|
127
|
-
... daily_api_calls=10,
|
128
|
-
... monthly_api_calls=10,
|
129
|
-
... daily_traffic=10,
|
130
|
-
... monthly_traffic=10,
|
131
|
-
... daily_process=10,
|
132
|
-
... monthly_process=10,
|
133
|
-
... number_of_days=10)
|
134
|
-
or
|
135
|
-
>>> plan = client.create_plan(name="new_plan",
|
136
|
-
... display_name=" New Plan",
|
137
|
-
... description="new plan description",
|
138
|
-
... plan_color="#000000",
|
139
|
-
... storage=10,
|
140
|
-
... concurrent_tasks=10,
|
141
|
-
... daily_api_calls=10,
|
142
|
-
... monthly_api_calls=10,
|
143
|
-
... daily_traffic=10,
|
144
|
-
... monthly_traffic=10,
|
145
|
-
... daily_process=10,
|
146
|
-
... monthly_process=10,
|
147
|
-
... number_of_days=10)
|
148
|
-
"""
|
149
|
-
data = {
|
150
|
-
"name": name,
|
151
|
-
"display_name": display_name,
|
152
|
-
"description": description,
|
153
|
-
"plan_color": plan_color,
|
154
|
-
"storage": storage,
|
155
|
-
"concurrent_tasks": concurrent_tasks,
|
156
|
-
"daily_api_calls": daily_api_calls,
|
157
|
-
"monthly_api_calls": monthly_api_calls,
|
158
|
-
"daily_traffic": daily_traffic,
|
159
|
-
"monthly_traffic": monthly_traffic,
|
160
|
-
"daily_process": daily_process,
|
161
|
-
"monthly_process": monthly_process,
|
162
|
-
"number_of_days": number_of_days
|
163
|
-
}
|
164
|
-
return super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: Plan(api, item['id'], item))
|
165
|
-
|
166
|
-
|
167
|
-
@classmethod
|
168
|
-
def get_plan(cls, api: 'GeoboxClient', plan_id: int) -> 'Plan':
|
169
|
-
"""
|
170
|
-
Get a plan by its id.
|
171
|
-
|
172
|
-
Args:
|
173
|
-
api (GeoboxClient): The GeoboxClient instance for making requests.
|
174
|
-
plan_id (int): The id of the plan to get.
|
175
|
-
|
176
|
-
Returns:
|
177
|
-
Plan: The plan object
|
178
|
-
|
179
|
-
Raises:
|
180
|
-
NotFoundError: If the plan with the specified id is not found.
|
181
|
-
|
182
|
-
Example:
|
183
|
-
>>> from geobox import GeoboxClient
|
184
|
-
>>> from geobox.plan import Plan
|
185
|
-
>>> client = GeoboxClient()
|
186
|
-
>>> plan = Plan.get_plan(client, plan_id=1)
|
187
|
-
or
|
188
|
-
>>> plan = client.get_plan(plan_id=1)
|
189
|
-
"""
|
190
|
-
params = {
|
191
|
-
'f': 'json'
|
192
|
-
}
|
193
|
-
return super()._get_detail(api, cls.BASE_ENDPOINT, plan_id, params, factory_func=lambda api, item: Plan(api, item['id'], item))
|
194
|
-
|
195
|
-
|
196
|
-
def update(self, **kwargs) -> Dict:
|
197
|
-
"""
|
198
|
-
Update the plan
|
199
|
-
|
200
|
-
Keyword Args:
|
201
|
-
name (str): The name of the plan.
|
202
|
-
plan_color (str): hex value of the color. e.g. #000000.
|
203
|
-
storage (int): storage value in bytes. must be greater that 1.
|
204
|
-
concurrent_tasks (int): number of concurrent tasks. must be greater that 1.
|
205
|
-
daily_api_calls (int): number of daily api calls. must be greater that 1.
|
206
|
-
monthly_api_calls (int): number of monthly api calls. must be greater that 1.
|
207
|
-
daily_traffic (int): number of daily traffic. must be greater that 1.
|
208
|
-
monthly_traffic (int): number of monthly traffic. must be greater that 1.
|
209
|
-
daily_processes (int): number of daily processes. must be greater that 1.
|
210
|
-
monthly_processes (int): number of monthly processes. must be greater that 1.
|
211
|
-
number_of_days (int): number of days. must be greater that 1.
|
212
|
-
display_name (str): display name of the plan.
|
213
|
-
description (str): description of the plan.
|
214
|
-
|
215
|
-
Returns:
|
216
|
-
Dict: The updated plan data.
|
217
|
-
|
218
|
-
Raises:
|
219
|
-
ValidationError: If the plan data is invalid.
|
220
|
-
|
221
|
-
Example:
|
222
|
-
>>> from geobox import GeoboxClient
|
223
|
-
>>> from geobox.plan import Plan
|
224
|
-
>>> client = GeoboxClient()
|
225
|
-
>>> plan = Plan.get_plan(client, plan_id=1)
|
226
|
-
>>> plan.update_plan(display_name="New Display Name")
|
227
|
-
"""
|
228
|
-
data = {
|
229
|
-
"name": kwargs.get('name'),
|
230
|
-
"display_name": kwargs.get('display_name'),
|
231
|
-
"description": kwargs.get('description'),
|
232
|
-
"plan_color": kwargs.get('plan_color'),
|
233
|
-
"storage": kwargs.get('storage'),
|
234
|
-
"concurrent_tasks": kwargs.get('concurrent_tasks'),
|
235
|
-
"daily_api_calls": kwargs.get('daily_api_calls'),
|
236
|
-
"monthly_api_calls": kwargs.get('monthly_api_calls'),
|
237
|
-
"daily_traffic": kwargs.get('daily_traffic'),
|
238
|
-
"monthly_traffic": kwargs.get('monthly_traffic'),
|
239
|
-
"daily_process": kwargs.get('daily_process'),
|
240
|
-
"monthly_process": kwargs.get('monthly_process'),
|
241
|
-
"number_of_days": kwargs.get('number_of_days')
|
242
|
-
}
|
243
|
-
return super()._update(self.endpoint, data)
|
244
|
-
|
245
|
-
|
246
|
-
def delete(self) -> None:
|
247
|
-
"""
|
248
|
-
Delete the plan.
|
249
|
-
|
250
|
-
Returns:
|
251
|
-
None
|
252
|
-
|
253
|
-
Example:
|
254
|
-
>>> from geobox import GeoboxClient
|
255
|
-
>>> from geobox.plan import Plan
|
256
|
-
>>> client = GeoboxClient()
|
257
|
-
>>> plan = Plan.get_plan(client, plan_id=1)
|
258
|
-
>>> plan.delete()
|
259
|
-
"""
|
260
|
-
super().delete(self.endpoint)
|
1
|
+
from typing import List, Dict, Optional, TYPE_CHECKING, Union
|
2
|
+
from urllib.parse import urljoin
|
3
|
+
|
4
|
+
from .base import Base
|
5
|
+
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from . import GeoboxClient
|
8
|
+
|
9
|
+
class Plan(Base):
|
10
|
+
|
11
|
+
BASE_ENDPOINT = 'plans/'
|
12
|
+
|
13
|
+
def __init__(self,
|
14
|
+
api: 'GeoboxClient',
|
15
|
+
plan_id: int,
|
16
|
+
data: Optional[Dict] = {}):
|
17
|
+
"""
|
18
|
+
Initialize a plan instance.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
22
|
+
plan_id (str): The id for the plan.
|
23
|
+
data (Dict, optional): The data of the plan.
|
24
|
+
"""
|
25
|
+
super().__init__(api, data=data)
|
26
|
+
self.plan_id = plan_id
|
27
|
+
self.endpoint = urljoin(self.BASE_ENDPOINT, str(self.id))
|
28
|
+
|
29
|
+
|
30
|
+
@classmethod
|
31
|
+
def get_plans(cls, api: 'GeoboxClient', **kwargs) -> Union[List['Plan'], int]:
|
32
|
+
"""
|
33
|
+
Get list of plans 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 plans. default is False.
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
List[Plan] | int: A list of plan instances or the total number of plans.
|
51
|
+
|
52
|
+
Example:
|
53
|
+
>>> from geobox import GeoboxClient
|
54
|
+
>>> from geobox.plan import Plan
|
55
|
+
>>> client = GeoboxClient()
|
56
|
+
>>> plans = Plan.get_plan(client, q="name LIKE '%My plan%'")
|
57
|
+
or
|
58
|
+
>>> plans = client.get_plan(q="name LIKE '%My plan%'")
|
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: Plan(api, item['id'], item))
|
73
|
+
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def create_plan(cls,
|
77
|
+
api: 'GeoboxClient',
|
78
|
+
name: str,
|
79
|
+
plan_color: str,
|
80
|
+
storage: int,
|
81
|
+
concurrent_tasks: int,
|
82
|
+
daily_api_calls: int,
|
83
|
+
monthly_api_calls: int,
|
84
|
+
daily_traffic: int,
|
85
|
+
monthly_traffic: int,
|
86
|
+
daily_process: int,
|
87
|
+
monthly_process: int,
|
88
|
+
number_of_days: int = None,
|
89
|
+
display_name: str = None,
|
90
|
+
description: str = None) -> 'Plan':
|
91
|
+
"""
|
92
|
+
Create a new plan.
|
93
|
+
|
94
|
+
Args:
|
95
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
96
|
+
name (str): The name of the plan.
|
97
|
+
plan_color (str): hex value of the color. e.g. #000000.
|
98
|
+
storage (int): storage value in bytes. must be greater that 1.
|
99
|
+
concurrent_tasks (int): number of concurrent tasks. must be greater that 1.
|
100
|
+
daily_api_calls (int): number of daily api calls. must be greater that 1.
|
101
|
+
monthly_api_calls (int): number of monthly api calls. must be greater that 1.
|
102
|
+
daily_traffic (int): number of daily traffic. must be greater that 1.
|
103
|
+
monthly_traffic (int): number of monthly traffic. must be greater that 1.
|
104
|
+
daily_process (int): number of daily processes. must be greater that 1.
|
105
|
+
monthly_process (int): number of monthly processes. must be greater that 1.
|
106
|
+
number_of_days (int, optional): number of days. must be greater that 1.
|
107
|
+
display_name (str, optional): display name of the plan.
|
108
|
+
description (str, optional): description of the plan.
|
109
|
+
|
110
|
+
Returns:
|
111
|
+
Plan: The newly created plan instance.
|
112
|
+
|
113
|
+
Raises:
|
114
|
+
ValidationError: If the plan data is invalid.
|
115
|
+
|
116
|
+
Example:
|
117
|
+
>>> from geobox import GeoboxClient
|
118
|
+
>>> from geobox.plan import Plan
|
119
|
+
>>> client = GeoboxClient()
|
120
|
+
>>> plan = Plan.create_plan(client,
|
121
|
+
... name="new_plan",
|
122
|
+
... display_name=" New Plan",
|
123
|
+
... description="new plan description",
|
124
|
+
... plan_color="#000000",
|
125
|
+
... storage=10,
|
126
|
+
... concurrent_tasks=10,
|
127
|
+
... daily_api_calls=10,
|
128
|
+
... monthly_api_calls=10,
|
129
|
+
... daily_traffic=10,
|
130
|
+
... monthly_traffic=10,
|
131
|
+
... daily_process=10,
|
132
|
+
... monthly_process=10,
|
133
|
+
... number_of_days=10)
|
134
|
+
or
|
135
|
+
>>> plan = client.create_plan(name="new_plan",
|
136
|
+
... display_name=" New Plan",
|
137
|
+
... description="new plan description",
|
138
|
+
... plan_color="#000000",
|
139
|
+
... storage=10,
|
140
|
+
... concurrent_tasks=10,
|
141
|
+
... daily_api_calls=10,
|
142
|
+
... monthly_api_calls=10,
|
143
|
+
... daily_traffic=10,
|
144
|
+
... monthly_traffic=10,
|
145
|
+
... daily_process=10,
|
146
|
+
... monthly_process=10,
|
147
|
+
... number_of_days=10)
|
148
|
+
"""
|
149
|
+
data = {
|
150
|
+
"name": name,
|
151
|
+
"display_name": display_name,
|
152
|
+
"description": description,
|
153
|
+
"plan_color": plan_color,
|
154
|
+
"storage": storage,
|
155
|
+
"concurrent_tasks": concurrent_tasks,
|
156
|
+
"daily_api_calls": daily_api_calls,
|
157
|
+
"monthly_api_calls": monthly_api_calls,
|
158
|
+
"daily_traffic": daily_traffic,
|
159
|
+
"monthly_traffic": monthly_traffic,
|
160
|
+
"daily_process": daily_process,
|
161
|
+
"monthly_process": monthly_process,
|
162
|
+
"number_of_days": number_of_days
|
163
|
+
}
|
164
|
+
return super()._create(api, cls.BASE_ENDPOINT, data, factory_func=lambda api, item: Plan(api, item['id'], item))
|
165
|
+
|
166
|
+
|
167
|
+
@classmethod
|
168
|
+
def get_plan(cls, api: 'GeoboxClient', plan_id: int) -> 'Plan':
|
169
|
+
"""
|
170
|
+
Get a plan by its id.
|
171
|
+
|
172
|
+
Args:
|
173
|
+
api (GeoboxClient): The GeoboxClient instance for making requests.
|
174
|
+
plan_id (int): The id of the plan to get.
|
175
|
+
|
176
|
+
Returns:
|
177
|
+
Plan: The plan object
|
178
|
+
|
179
|
+
Raises:
|
180
|
+
NotFoundError: If the plan with the specified id is not found.
|
181
|
+
|
182
|
+
Example:
|
183
|
+
>>> from geobox import GeoboxClient
|
184
|
+
>>> from geobox.plan import Plan
|
185
|
+
>>> client = GeoboxClient()
|
186
|
+
>>> plan = Plan.get_plan(client, plan_id=1)
|
187
|
+
or
|
188
|
+
>>> plan = client.get_plan(plan_id=1)
|
189
|
+
"""
|
190
|
+
params = {
|
191
|
+
'f': 'json'
|
192
|
+
}
|
193
|
+
return super()._get_detail(api, cls.BASE_ENDPOINT, plan_id, params, factory_func=lambda api, item: Plan(api, item['id'], item))
|
194
|
+
|
195
|
+
|
196
|
+
def update(self, **kwargs) -> Dict:
|
197
|
+
"""
|
198
|
+
Update the plan
|
199
|
+
|
200
|
+
Keyword Args:
|
201
|
+
name (str): The name of the plan.
|
202
|
+
plan_color (str): hex value of the color. e.g. #000000.
|
203
|
+
storage (int): storage value in bytes. must be greater that 1.
|
204
|
+
concurrent_tasks (int): number of concurrent tasks. must be greater that 1.
|
205
|
+
daily_api_calls (int): number of daily api calls. must be greater that 1.
|
206
|
+
monthly_api_calls (int): number of monthly api calls. must be greater that 1.
|
207
|
+
daily_traffic (int): number of daily traffic. must be greater that 1.
|
208
|
+
monthly_traffic (int): number of monthly traffic. must be greater that 1.
|
209
|
+
daily_processes (int): number of daily processes. must be greater that 1.
|
210
|
+
monthly_processes (int): number of monthly processes. must be greater that 1.
|
211
|
+
number_of_days (int): number of days. must be greater that 1.
|
212
|
+
display_name (str): display name of the plan.
|
213
|
+
description (str): description of the plan.
|
214
|
+
|
215
|
+
Returns:
|
216
|
+
Dict: The updated plan data.
|
217
|
+
|
218
|
+
Raises:
|
219
|
+
ValidationError: If the plan data is invalid.
|
220
|
+
|
221
|
+
Example:
|
222
|
+
>>> from geobox import GeoboxClient
|
223
|
+
>>> from geobox.plan import Plan
|
224
|
+
>>> client = GeoboxClient()
|
225
|
+
>>> plan = Plan.get_plan(client, plan_id=1)
|
226
|
+
>>> plan.update_plan(display_name="New Display Name")
|
227
|
+
"""
|
228
|
+
data = {
|
229
|
+
"name": kwargs.get('name'),
|
230
|
+
"display_name": kwargs.get('display_name'),
|
231
|
+
"description": kwargs.get('description'),
|
232
|
+
"plan_color": kwargs.get('plan_color'),
|
233
|
+
"storage": kwargs.get('storage'),
|
234
|
+
"concurrent_tasks": kwargs.get('concurrent_tasks'),
|
235
|
+
"daily_api_calls": kwargs.get('daily_api_calls'),
|
236
|
+
"monthly_api_calls": kwargs.get('monthly_api_calls'),
|
237
|
+
"daily_traffic": kwargs.get('daily_traffic'),
|
238
|
+
"monthly_traffic": kwargs.get('monthly_traffic'),
|
239
|
+
"daily_process": kwargs.get('daily_process'),
|
240
|
+
"monthly_process": kwargs.get('monthly_process'),
|
241
|
+
"number_of_days": kwargs.get('number_of_days')
|
242
|
+
}
|
243
|
+
return super()._update(self.endpoint, data)
|
244
|
+
|
245
|
+
|
246
|
+
def delete(self) -> None:
|
247
|
+
"""
|
248
|
+
Delete the plan.
|
249
|
+
|
250
|
+
Returns:
|
251
|
+
None
|
252
|
+
|
253
|
+
Example:
|
254
|
+
>>> from geobox import GeoboxClient
|
255
|
+
>>> from geobox.plan import Plan
|
256
|
+
>>> client = GeoboxClient()
|
257
|
+
>>> plan = Plan.get_plan(client, plan_id=1)
|
258
|
+
>>> plan.delete()
|
259
|
+
"""
|
260
|
+
super().delete(self.endpoint)
|
261
261
|
self.plan_id = None
|