latitudesh-python-sdk 1.0.0__py3-none-any.whl → 2.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.
Potentially problematic release.
This version of latitudesh-python-sdk might be problematic. Click here for more details.
- latitudesh_python_sdk/_hooks/types.py +7 -0
- latitudesh_python_sdk/_version.py +6 -4
- latitudesh_python_sdk/apikeys.py +22 -18
- latitudesh_python_sdk/basesdk.py +12 -20
- latitudesh_python_sdk/billing.py +2 -0
- latitudesh_python_sdk/events_sdk.py +86 -5
- latitudesh_python_sdk/firewalls_sdk.py +146 -9
- latitudesh_python_sdk/httpclient.py +6 -16
- latitudesh_python_sdk/ipaddresses_sdk.py +82 -5
- latitudesh_python_sdk/models/__init__.py +2597 -1071
- latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
- latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
- latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
- latitudesh_python_sdk/models/billing_usage.py +3 -0
- latitudesh_python_sdk/models/custom_tag.py +15 -0
- latitudesh_python_sdk/models/custom_tag_data.py +54 -0
- latitudesh_python_sdk/models/custom_tags.py +26 -0
- latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
- latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
- latitudesh_python_sdk/models/event_data.py +98 -0
- latitudesh_python_sdk/models/events.py +16 -1
- latitudesh_python_sdk/models/filesystem_data.py +4 -0
- latitudesh_python_sdk/models/firewall.py +15 -0
- latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
- latitudesh_python_sdk/models/firewall_assignments.py +29 -0
- latitudesh_python_sdk/models/firewall_data.py +71 -0
- latitudesh_python_sdk/models/firewall_server.py +4 -1
- latitudesh_python_sdk/models/firewalls.py +7 -7
- latitudesh_python_sdk/models/get_bandwidth_plansop.py +30 -1
- latitudesh_python_sdk/models/get_eventsop.py +29 -1
- latitudesh_python_sdk/models/get_firewall_assignmentsop.py +37 -2
- latitudesh_python_sdk/models/get_ipsop.py +30 -1
- latitudesh_python_sdk/models/get_plans_operating_systemop.py +37 -2
- latitudesh_python_sdk/models/get_projectsop.py +30 -1
- latitudesh_python_sdk/models/get_regionsop.py +42 -0
- latitudesh_python_sdk/models/get_rolesop.py +37 -2
- latitudesh_python_sdk/models/get_serversop.py +30 -1
- latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
- latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
- latitudesh_python_sdk/models/get_team_membersop.py +42 -0
- latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
- latitudesh_python_sdk/models/get_user_dataop.py +31 -0
- latitudesh_python_sdk/models/get_users_dataop.py +35 -0
- latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +33 -1
- latitudesh_python_sdk/models/get_virtual_networksop.py +30 -1
- latitudesh_python_sdk/models/list_firewallsop.py +30 -1
- latitudesh_python_sdk/models/operating_system_data.py +65 -0
- latitudesh_python_sdk/models/operating_systems.py +15 -0
- latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
- latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
- latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
- latitudesh_python_sdk/models/post_user_dataop.py +45 -0
- latitudesh_python_sdk/models/project_include.py +3 -0
- latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
- latitudesh_python_sdk/models/role.py +11 -0
- latitudesh_python_sdk/models/server_data.py +8 -0
- latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
- latitudesh_python_sdk/models/storage_plan_data.py +47 -0
- latitudesh_python_sdk/models/storage_plans.py +14 -3
- latitudesh_python_sdk/models/update_serverop.py +60 -10
- latitudesh_python_sdk/models/user_data.py +11 -0
- latitudesh_python_sdk/models/virtual_network.py +19 -1
- latitudesh_python_sdk/models/virtual_network1.py +15 -0
- latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
- latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
- latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
- latitudesh_python_sdk/models/virtual_network_data.py +88 -0
- latitudesh_python_sdk/models/virtual_networks.py +3 -3
- latitudesh_python_sdk/operatingsystems_sdk.py +78 -9
- latitudesh_python_sdk/plans.py +109 -30
- latitudesh_python_sdk/privatenetworks.py +185 -36
- latitudesh_python_sdk/projects_sdk.py +113 -32
- latitudesh_python_sdk/regions_sdk.py +78 -7
- latitudesh_python_sdk/roles.py +78 -7
- latitudesh_python_sdk/sdk.py +110 -73
- latitudesh_python_sdk/sdkconfiguration.py +0 -7
- latitudesh_python_sdk/servers_sdk.py +195 -50
- latitudesh_python_sdk/{sshkeys.py → sshkeys_sdk.py} +1030 -5
- latitudesh_python_sdk/storage.py +8 -0
- latitudesh_python_sdk/tags.py +30 -22
- latitudesh_python_sdk/teams_sdk.py +6 -0
- latitudesh_python_sdk/teamsmembers.py +80 -7
- latitudesh_python_sdk/traffic_sdk.py +12 -8
- latitudesh_python_sdk/userdata_sdk.py +1029 -0
- latitudesh_python_sdk/userprofile.py +6 -0
- latitudesh_python_sdk/utils/__init__.py +131 -45
- latitudesh_python_sdk/utils/datetimes.py +23 -0
- latitudesh_python_sdk/utils/forms.py +49 -28
- latitudesh_python_sdk/utils/serializers.py +32 -3
- latitudesh_python_sdk/virtualmachines.py +36 -18
- latitudesh_python_sdk/vpnsessions.py +38 -26
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/METADATA +58 -22
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/RECORD +95 -73
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/WHEEL +1 -1
- latitudesh_python_sdk/models/storage_plan.py +0 -36
- {latitudesh_python_sdk-1.0.0.dist-info → latitudesh_python_sdk-2.0.0.dist-info}/LICENSE +0 -0
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
4
|
import httpx
|
|
5
5
|
from latitudesh_python_sdk.httpclient import HttpClient
|
|
6
|
+
from latitudesh_python_sdk.sdkconfiguration import SDKConfiguration
|
|
6
7
|
from typing import Any, Callable, List, Optional, Tuple, Union
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class HookContext:
|
|
11
|
+
config: SDKConfiguration
|
|
10
12
|
base_url: str
|
|
11
13
|
operation_id: str
|
|
12
14
|
oauth2_scopes: Optional[List[str]] = None
|
|
@@ -14,11 +16,13 @@ class HookContext:
|
|
|
14
16
|
|
|
15
17
|
def __init__(
|
|
16
18
|
self,
|
|
19
|
+
config: SDKConfiguration,
|
|
17
20
|
base_url: str,
|
|
18
21
|
operation_id: str,
|
|
19
22
|
oauth2_scopes: Optional[List[str]],
|
|
20
23
|
security_source: Optional[Union[Any, Callable[[], Any]]],
|
|
21
24
|
):
|
|
25
|
+
self.config = config
|
|
22
26
|
self.base_url = base_url
|
|
23
27
|
self.operation_id = operation_id
|
|
24
28
|
self.oauth2_scopes = oauth2_scopes
|
|
@@ -28,6 +32,7 @@ class HookContext:
|
|
|
28
32
|
class BeforeRequestContext(HookContext):
|
|
29
33
|
def __init__(self, hook_ctx: HookContext):
|
|
30
34
|
super().__init__(
|
|
35
|
+
hook_ctx.config,
|
|
31
36
|
hook_ctx.base_url,
|
|
32
37
|
hook_ctx.operation_id,
|
|
33
38
|
hook_ctx.oauth2_scopes,
|
|
@@ -38,6 +43,7 @@ class BeforeRequestContext(HookContext):
|
|
|
38
43
|
class AfterSuccessContext(HookContext):
|
|
39
44
|
def __init__(self, hook_ctx: HookContext):
|
|
40
45
|
super().__init__(
|
|
46
|
+
hook_ctx.config,
|
|
41
47
|
hook_ctx.base_url,
|
|
42
48
|
hook_ctx.operation_id,
|
|
43
49
|
hook_ctx.oauth2_scopes,
|
|
@@ -48,6 +54,7 @@ class AfterSuccessContext(HookContext):
|
|
|
48
54
|
class AfterErrorContext(HookContext):
|
|
49
55
|
def __init__(self, hook_ctx: HookContext):
|
|
50
56
|
super().__init__(
|
|
57
|
+
hook_ctx.config,
|
|
51
58
|
hook_ctx.base_url,
|
|
52
59
|
hook_ctx.operation_id,
|
|
53
60
|
hook_ctx.oauth2_scopes,
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "latitudesh-python-sdk"
|
|
6
|
-
__version__: str = "
|
|
7
|
-
__openapi_doc_version__: str = "
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str =
|
|
6
|
+
__version__: str = "2.0.0"
|
|
7
|
+
__openapi_doc_version__: str = "2023-06-01"
|
|
8
|
+
__gen_version__: str = "2.640.2"
|
|
9
|
+
__user_agent__: str = (
|
|
10
|
+
"speakeasy-sdk/python 2.0.0 2.640.2 2023-06-01 latitudesh-python-sdk"
|
|
11
|
+
)
|
|
10
12
|
|
|
11
13
|
try:
|
|
12
14
|
if __package__ is not None:
|
latitudesh_python_sdk/apikeys.py
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
4
|
from latitudesh_python_sdk import models, utils
|
|
5
5
|
from latitudesh_python_sdk._hooks import HookContext
|
|
6
|
-
from latitudesh_python_sdk.types import
|
|
6
|
+
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
7
7
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
-
from typing import Any, Mapping, Optional, Union
|
|
8
|
+
from typing import Any, Mapping, Optional, Union
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class APIKeys(BaseSDK):
|
|
@@ -62,6 +62,7 @@ class APIKeys(BaseSDK):
|
|
|
62
62
|
|
|
63
63
|
http_res = self.do_request(
|
|
64
64
|
hook_ctx=HookContext(
|
|
65
|
+
config=self.sdk_configuration,
|
|
65
66
|
base_url=base_url or "",
|
|
66
67
|
operation_id="get-api-keys",
|
|
67
68
|
oauth2_scopes=[],
|
|
@@ -149,6 +150,7 @@ class APIKeys(BaseSDK):
|
|
|
149
150
|
|
|
150
151
|
http_res = await self.do_request_async(
|
|
151
152
|
hook_ctx=HookContext(
|
|
153
|
+
config=self.sdk_configuration,
|
|
152
154
|
base_url=base_url or "",
|
|
153
155
|
operation_id="get-api-keys",
|
|
154
156
|
oauth2_scopes=[],
|
|
@@ -186,9 +188,7 @@ class APIKeys(BaseSDK):
|
|
|
186
188
|
def create(
|
|
187
189
|
self,
|
|
188
190
|
*,
|
|
189
|
-
|
|
190
|
-
models.CreateAPIKey, models.CreateAPIKeyTypedDict
|
|
191
|
-
] = models.CreateAPIKey(),
|
|
191
|
+
data: Optional[Union[models.Data, models.DataTypedDict]] = None,
|
|
192
192
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
193
193
|
server_url: Optional[str] = None,
|
|
194
194
|
timeout_ms: Optional[int] = None,
|
|
@@ -199,7 +199,7 @@ class APIKeys(BaseSDK):
|
|
|
199
199
|
Create a new API Key that is tied to the current user account. The created API key is only listed ONCE upon creation. It can however be regenerated or deleted.
|
|
200
200
|
|
|
201
201
|
|
|
202
|
-
:param
|
|
202
|
+
:param data:
|
|
203
203
|
:param retries: Override the default retry configuration for this method
|
|
204
204
|
:param server_url: Override the default server URL for this method
|
|
205
205
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -215,9 +215,9 @@ class APIKeys(BaseSDK):
|
|
|
215
215
|
else:
|
|
216
216
|
base_url = self._get_url(base_url, url_variables)
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
request = models.CreateAPIKey(
|
|
219
|
+
data=utils.get_pydantic_model(data, Optional[models.Data]),
|
|
220
|
+
)
|
|
221
221
|
|
|
222
222
|
req = self._build_request(
|
|
223
223
|
method="POST",
|
|
@@ -233,7 +233,7 @@ class APIKeys(BaseSDK):
|
|
|
233
233
|
http_headers=http_headers,
|
|
234
234
|
security=self.sdk_configuration.security,
|
|
235
235
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
236
|
-
request, False,
|
|
236
|
+
request, False, False, "json", models.CreateAPIKey
|
|
237
237
|
),
|
|
238
238
|
timeout_ms=timeout_ms,
|
|
239
239
|
)
|
|
@@ -248,6 +248,7 @@ class APIKeys(BaseSDK):
|
|
|
248
248
|
|
|
249
249
|
http_res = self.do_request(
|
|
250
250
|
hook_ctx=HookContext(
|
|
251
|
+
config=self.sdk_configuration,
|
|
251
252
|
base_url=base_url or "",
|
|
252
253
|
operation_id="post-api-key",
|
|
253
254
|
oauth2_scopes=[],
|
|
@@ -289,9 +290,7 @@ class APIKeys(BaseSDK):
|
|
|
289
290
|
async def create_async(
|
|
290
291
|
self,
|
|
291
292
|
*,
|
|
292
|
-
|
|
293
|
-
models.CreateAPIKey, models.CreateAPIKeyTypedDict
|
|
294
|
-
] = models.CreateAPIKey(),
|
|
293
|
+
data: Optional[Union[models.Data, models.DataTypedDict]] = None,
|
|
295
294
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
296
295
|
server_url: Optional[str] = None,
|
|
297
296
|
timeout_ms: Optional[int] = None,
|
|
@@ -302,7 +301,7 @@ class APIKeys(BaseSDK):
|
|
|
302
301
|
Create a new API Key that is tied to the current user account. The created API key is only listed ONCE upon creation. It can however be regenerated or deleted.
|
|
303
302
|
|
|
304
303
|
|
|
305
|
-
:param
|
|
304
|
+
:param data:
|
|
306
305
|
:param retries: Override the default retry configuration for this method
|
|
307
306
|
:param server_url: Override the default server URL for this method
|
|
308
307
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -318,9 +317,9 @@ class APIKeys(BaseSDK):
|
|
|
318
317
|
else:
|
|
319
318
|
base_url = self._get_url(base_url, url_variables)
|
|
320
319
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
320
|
+
request = models.CreateAPIKey(
|
|
321
|
+
data=utils.get_pydantic_model(data, Optional[models.Data]),
|
|
322
|
+
)
|
|
324
323
|
|
|
325
324
|
req = self._build_request_async(
|
|
326
325
|
method="POST",
|
|
@@ -336,7 +335,7 @@ class APIKeys(BaseSDK):
|
|
|
336
335
|
http_headers=http_headers,
|
|
337
336
|
security=self.sdk_configuration.security,
|
|
338
337
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
339
|
-
request, False,
|
|
338
|
+
request, False, False, "json", models.CreateAPIKey
|
|
340
339
|
),
|
|
341
340
|
timeout_ms=timeout_ms,
|
|
342
341
|
)
|
|
@@ -351,6 +350,7 @@ class APIKeys(BaseSDK):
|
|
|
351
350
|
|
|
352
351
|
http_res = await self.do_request_async(
|
|
353
352
|
hook_ctx=HookContext(
|
|
353
|
+
config=self.sdk_configuration,
|
|
354
354
|
base_url=base_url or "",
|
|
355
355
|
operation_id="post-api-key",
|
|
356
356
|
oauth2_scopes=[],
|
|
@@ -459,6 +459,7 @@ class APIKeys(BaseSDK):
|
|
|
459
459
|
|
|
460
460
|
http_res = self.do_request(
|
|
461
461
|
hook_ctx=HookContext(
|
|
462
|
+
config=self.sdk_configuration,
|
|
462
463
|
base_url=base_url or "",
|
|
463
464
|
operation_id="update-api-key",
|
|
464
465
|
oauth2_scopes=[],
|
|
@@ -567,6 +568,7 @@ class APIKeys(BaseSDK):
|
|
|
567
568
|
|
|
568
569
|
http_res = await self.do_request_async(
|
|
569
570
|
hook_ctx=HookContext(
|
|
571
|
+
config=self.sdk_configuration,
|
|
570
572
|
base_url=base_url or "",
|
|
571
573
|
operation_id="update-api-key",
|
|
572
574
|
oauth2_scopes=[],
|
|
@@ -665,6 +667,7 @@ class APIKeys(BaseSDK):
|
|
|
665
667
|
|
|
666
668
|
http_res = self.do_request(
|
|
667
669
|
hook_ctx=HookContext(
|
|
670
|
+
config=self.sdk_configuration,
|
|
668
671
|
base_url=base_url or "",
|
|
669
672
|
operation_id="delete-api-key",
|
|
670
673
|
oauth2_scopes=[],
|
|
@@ -763,6 +766,7 @@ class APIKeys(BaseSDK):
|
|
|
763
766
|
|
|
764
767
|
http_res = await self.do_request_async(
|
|
765
768
|
hook_ctx=HookContext(
|
|
769
|
+
config=self.sdk_configuration,
|
|
766
770
|
base_url=base_url or "",
|
|
767
771
|
operation_id="delete-api-key",
|
|
768
772
|
oauth2_scopes=[],
|
latitudesh_python_sdk/basesdk.py
CHANGED
|
@@ -222,12 +222,12 @@ class BaseSDK:
|
|
|
222
222
|
client = self.sdk_configuration.client
|
|
223
223
|
logger = self.sdk_configuration.debug_logger
|
|
224
224
|
|
|
225
|
+
hooks = self.sdk_configuration.__dict__["_hooks"]
|
|
226
|
+
|
|
225
227
|
def do():
|
|
226
228
|
http_res = None
|
|
227
229
|
try:
|
|
228
|
-
req =
|
|
229
|
-
BeforeRequestContext(hook_ctx), request
|
|
230
|
-
)
|
|
230
|
+
req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
|
|
231
231
|
logger.debug(
|
|
232
232
|
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
233
233
|
req.method,
|
|
@@ -241,9 +241,7 @@ class BaseSDK:
|
|
|
241
241
|
|
|
242
242
|
http_res = client.send(req, stream=stream)
|
|
243
243
|
except Exception as e:
|
|
244
|
-
_, e =
|
|
245
|
-
AfterErrorContext(hook_ctx), None, e
|
|
246
|
-
)
|
|
244
|
+
_, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
|
|
247
245
|
if e is not None:
|
|
248
246
|
logger.debug("Request Exception", exc_info=True)
|
|
249
247
|
raise e
|
|
@@ -261,7 +259,7 @@ class BaseSDK:
|
|
|
261
259
|
)
|
|
262
260
|
|
|
263
261
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
264
|
-
result, err =
|
|
262
|
+
result, err = hooks.after_error(
|
|
265
263
|
AfterErrorContext(hook_ctx), http_res, None
|
|
266
264
|
)
|
|
267
265
|
if err is not None:
|
|
@@ -281,9 +279,7 @@ class BaseSDK:
|
|
|
281
279
|
http_res = do()
|
|
282
280
|
|
|
283
281
|
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
284
|
-
http_res =
|
|
285
|
-
AfterSuccessContext(hook_ctx), http_res
|
|
286
|
-
)
|
|
282
|
+
http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
|
|
287
283
|
|
|
288
284
|
return http_res
|
|
289
285
|
|
|
@@ -298,12 +294,12 @@ class BaseSDK:
|
|
|
298
294
|
client = self.sdk_configuration.async_client
|
|
299
295
|
logger = self.sdk_configuration.debug_logger
|
|
300
296
|
|
|
297
|
+
hooks = self.sdk_configuration.__dict__["_hooks"]
|
|
298
|
+
|
|
301
299
|
async def do():
|
|
302
300
|
http_res = None
|
|
303
301
|
try:
|
|
304
|
-
req =
|
|
305
|
-
BeforeRequestContext(hook_ctx), request
|
|
306
|
-
)
|
|
302
|
+
req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
|
|
307
303
|
logger.debug(
|
|
308
304
|
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
309
305
|
req.method,
|
|
@@ -317,9 +313,7 @@ class BaseSDK:
|
|
|
317
313
|
|
|
318
314
|
http_res = await client.send(req, stream=stream)
|
|
319
315
|
except Exception as e:
|
|
320
|
-
_, e =
|
|
321
|
-
AfterErrorContext(hook_ctx), None, e
|
|
322
|
-
)
|
|
316
|
+
_, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
|
|
323
317
|
if e is not None:
|
|
324
318
|
logger.debug("Request Exception", exc_info=True)
|
|
325
319
|
raise e
|
|
@@ -337,7 +331,7 @@ class BaseSDK:
|
|
|
337
331
|
)
|
|
338
332
|
|
|
339
333
|
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
340
|
-
result, err =
|
|
334
|
+
result, err = hooks.after_error(
|
|
341
335
|
AfterErrorContext(hook_ctx), http_res, None
|
|
342
336
|
)
|
|
343
337
|
if err is not None:
|
|
@@ -359,8 +353,6 @@ class BaseSDK:
|
|
|
359
353
|
http_res = await do()
|
|
360
354
|
|
|
361
355
|
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
362
|
-
http_res =
|
|
363
|
-
AfterSuccessContext(hook_ctx), http_res
|
|
364
|
-
)
|
|
356
|
+
http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
|
|
365
357
|
|
|
366
358
|
return http_res
|
latitudesh_python_sdk/billing.py
CHANGED
|
@@ -75,6 +75,7 @@ class Billing(BaseSDK):
|
|
|
75
75
|
|
|
76
76
|
http_res = self.do_request(
|
|
77
77
|
hook_ctx=HookContext(
|
|
78
|
+
config=self.sdk_configuration,
|
|
78
79
|
base_url=base_url or "",
|
|
79
80
|
operation_id="get-billing-usage",
|
|
80
81
|
oauth2_scopes=[],
|
|
@@ -175,6 +176,7 @@ class Billing(BaseSDK):
|
|
|
175
176
|
|
|
176
177
|
http_res = await self.do_request_async(
|
|
177
178
|
hook_ctx=HookContext(
|
|
179
|
+
config=self.sdk_configuration,
|
|
178
180
|
base_url=base_url or "",
|
|
179
181
|
operation_id="get-billing-usage",
|
|
180
182
|
oauth2_scopes=[],
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from .basesdk import BaseSDK
|
|
4
|
+
from jsonpath import JSONPath
|
|
4
5
|
from latitudesh_python_sdk import models, utils
|
|
5
6
|
from latitudesh_python_sdk._hooks import HookContext
|
|
6
7
|
from latitudesh_python_sdk.types import OptionalNullable, UNSET
|
|
7
8
|
from latitudesh_python_sdk.utils import get_security_from_env
|
|
8
|
-
from typing import List, Mapping, Optional
|
|
9
|
+
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class EventsSDK(BaseSDK):
|
|
@@ -20,11 +21,13 @@ class EventsSDK(BaseSDK):
|
|
|
20
21
|
filter_created_at_gte: Optional[str] = None,
|
|
21
22
|
filter_created_at_lte: Optional[str] = None,
|
|
22
23
|
filter_created_at: Optional[List[str]] = None,
|
|
24
|
+
page_size: Optional[int] = 20,
|
|
25
|
+
page_number: Optional[int] = 1,
|
|
23
26
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
24
27
|
server_url: Optional[str] = None,
|
|
25
28
|
timeout_ms: Optional[int] = None,
|
|
26
29
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
27
|
-
) -> models.
|
|
30
|
+
) -> Optional[models.GetEventsResponse]:
|
|
28
31
|
r"""List all Events
|
|
29
32
|
|
|
30
33
|
Lists all events.
|
|
@@ -38,6 +41,8 @@ class EventsSDK(BaseSDK):
|
|
|
38
41
|
:param filter_created_at_gte: The created at greater than equal date to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
39
42
|
:param filter_created_at_lte: The created at less than equal date to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
40
43
|
:param filter_created_at: The created at between date range date1, date2 (inclusive) to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
44
|
+
:param page_size: Number of items to return per page
|
|
45
|
+
:param page_number: Page number to return (starts at 1)
|
|
41
46
|
:param retries: Override the default retry configuration for this method
|
|
42
47
|
:param server_url: Override the default server URL for this method
|
|
43
48
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -62,6 +67,8 @@ class EventsSDK(BaseSDK):
|
|
|
62
67
|
filter_created_at_gte=filter_created_at_gte,
|
|
63
68
|
filter_created_at_lte=filter_created_at_lte,
|
|
64
69
|
filter_created_at=filter_created_at,
|
|
70
|
+
page_size=page_size,
|
|
71
|
+
page_number=page_number,
|
|
65
72
|
)
|
|
66
73
|
|
|
67
74
|
req = self._build_request(
|
|
@@ -90,6 +97,7 @@ class EventsSDK(BaseSDK):
|
|
|
90
97
|
|
|
91
98
|
http_res = self.do_request(
|
|
92
99
|
hook_ctx=HookContext(
|
|
100
|
+
config=self.sdk_configuration,
|
|
93
101
|
base_url=base_url or "",
|
|
94
102
|
operation_id="get-events",
|
|
95
103
|
oauth2_scopes=[],
|
|
@@ -102,8 +110,41 @@ class EventsSDK(BaseSDK):
|
|
|
102
110
|
retry_config=retry_config,
|
|
103
111
|
)
|
|
104
112
|
|
|
113
|
+
def next_func() -> Optional[models.GetEventsResponse]:
|
|
114
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
115
|
+
page = request.page_number if not request.page_number is None else 1
|
|
116
|
+
next_page = page + 1
|
|
117
|
+
|
|
118
|
+
if not http_res.text:
|
|
119
|
+
return None
|
|
120
|
+
results = JSONPath("$.data").parse(body)
|
|
121
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
122
|
+
return None
|
|
123
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
124
|
+
if len(results[0]) < limit:
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
return self.list(
|
|
128
|
+
filter_author=filter_author,
|
|
129
|
+
filter_project=filter_project,
|
|
130
|
+
filter_target_name=filter_target_name,
|
|
131
|
+
filter_target_id=filter_target_id,
|
|
132
|
+
filter_action=filter_action,
|
|
133
|
+
filter_created_at_gte=filter_created_at_gte,
|
|
134
|
+
filter_created_at_lte=filter_created_at_lte,
|
|
135
|
+
filter_created_at=filter_created_at,
|
|
136
|
+
page_size=page_size,
|
|
137
|
+
page_number=next_page,
|
|
138
|
+
retries=retries,
|
|
139
|
+
)
|
|
140
|
+
|
|
105
141
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
106
|
-
return
|
|
142
|
+
return models.GetEventsResponse(
|
|
143
|
+
result=utils.unmarshal_json(
|
|
144
|
+
http_res.text, models.GetEventsResponseBody
|
|
145
|
+
),
|
|
146
|
+
next=next_func,
|
|
147
|
+
)
|
|
107
148
|
if utils.match_response(http_res, "4XX", "*"):
|
|
108
149
|
http_res_text = utils.stream_to_text(http_res)
|
|
109
150
|
raise models.APIError(
|
|
@@ -135,11 +176,13 @@ class EventsSDK(BaseSDK):
|
|
|
135
176
|
filter_created_at_gte: Optional[str] = None,
|
|
136
177
|
filter_created_at_lte: Optional[str] = None,
|
|
137
178
|
filter_created_at: Optional[List[str]] = None,
|
|
179
|
+
page_size: Optional[int] = 20,
|
|
180
|
+
page_number: Optional[int] = 1,
|
|
138
181
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
139
182
|
server_url: Optional[str] = None,
|
|
140
183
|
timeout_ms: Optional[int] = None,
|
|
141
184
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
142
|
-
) -> models.
|
|
185
|
+
) -> Optional[models.GetEventsResponse]:
|
|
143
186
|
r"""List all Events
|
|
144
187
|
|
|
145
188
|
Lists all events.
|
|
@@ -153,6 +196,8 @@ class EventsSDK(BaseSDK):
|
|
|
153
196
|
:param filter_created_at_gte: The created at greater than equal date to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
154
197
|
:param filter_created_at_lte: The created at less than equal date to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
155
198
|
:param filter_created_at: The created at between date range date1, date2 (inclusive) to filter by, in ISO formatting (yyyy-MM-dd'T'HH:mm:ss)
|
|
199
|
+
:param page_size: Number of items to return per page
|
|
200
|
+
:param page_number: Page number to return (starts at 1)
|
|
156
201
|
:param retries: Override the default retry configuration for this method
|
|
157
202
|
:param server_url: Override the default server URL for this method
|
|
158
203
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -177,6 +222,8 @@ class EventsSDK(BaseSDK):
|
|
|
177
222
|
filter_created_at_gte=filter_created_at_gte,
|
|
178
223
|
filter_created_at_lte=filter_created_at_lte,
|
|
179
224
|
filter_created_at=filter_created_at,
|
|
225
|
+
page_size=page_size,
|
|
226
|
+
page_number=page_number,
|
|
180
227
|
)
|
|
181
228
|
|
|
182
229
|
req = self._build_request_async(
|
|
@@ -205,6 +252,7 @@ class EventsSDK(BaseSDK):
|
|
|
205
252
|
|
|
206
253
|
http_res = await self.do_request_async(
|
|
207
254
|
hook_ctx=HookContext(
|
|
255
|
+
config=self.sdk_configuration,
|
|
208
256
|
base_url=base_url or "",
|
|
209
257
|
operation_id="get-events",
|
|
210
258
|
oauth2_scopes=[],
|
|
@@ -217,8 +265,41 @@ class EventsSDK(BaseSDK):
|
|
|
217
265
|
retry_config=retry_config,
|
|
218
266
|
)
|
|
219
267
|
|
|
268
|
+
def next_func() -> Optional[models.GetEventsResponse]:
|
|
269
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
270
|
+
page = request.page_number if not request.page_number is None else 1
|
|
271
|
+
next_page = page + 1
|
|
272
|
+
|
|
273
|
+
if not http_res.text:
|
|
274
|
+
return None
|
|
275
|
+
results = JSONPath("$.data").parse(body)
|
|
276
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
277
|
+
return None
|
|
278
|
+
limit = request.page_size if not request.page_size is None else 20
|
|
279
|
+
if len(results[0]) < limit:
|
|
280
|
+
return None
|
|
281
|
+
|
|
282
|
+
return self.list(
|
|
283
|
+
filter_author=filter_author,
|
|
284
|
+
filter_project=filter_project,
|
|
285
|
+
filter_target_name=filter_target_name,
|
|
286
|
+
filter_target_id=filter_target_id,
|
|
287
|
+
filter_action=filter_action,
|
|
288
|
+
filter_created_at_gte=filter_created_at_gte,
|
|
289
|
+
filter_created_at_lte=filter_created_at_lte,
|
|
290
|
+
filter_created_at=filter_created_at,
|
|
291
|
+
page_size=page_size,
|
|
292
|
+
page_number=next_page,
|
|
293
|
+
retries=retries,
|
|
294
|
+
)
|
|
295
|
+
|
|
220
296
|
if utils.match_response(http_res, "200", "application/vnd.api+json"):
|
|
221
|
-
return
|
|
297
|
+
return models.GetEventsResponse(
|
|
298
|
+
result=utils.unmarshal_json(
|
|
299
|
+
http_res.text, models.GetEventsResponseBody
|
|
300
|
+
),
|
|
301
|
+
next=next_func,
|
|
302
|
+
)
|
|
222
303
|
if utils.match_response(http_res, "4XX", "*"):
|
|
223
304
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
224
305
|
raise models.APIError(
|