Skip to content

Commit d27cce7

Browse files
committed
Enhance response handling for available graph tiers and service offerings
This commit updates the response parsing in the `get_available_graph_tiers.py` and `get_service_offerings.py` files to utilize new response models, `AvailableGraphTiersResponse` and `ServiceOfferingsResponse`, respectively. The changes improve type safety and clarity in response handling across both endpoints. Key Changes: - Updated `_parse_response` and `_build_response` functions to return the new response models. - Adjusted function signatures to reflect the new response types for better type checking and documentation. These enhancements aim to streamline the API's response handling and improve overall maintainability.
1 parent 928058c commit d27cce7

24 files changed

Lines changed: 2036 additions & 22 deletions

‎robosystems_client/api/graphs/get_available_graph_tiers.py‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from ... import errors
77
from ...client import AuthenticatedClient, Client
8+
from ...models.available_graph_tiers_response import AvailableGraphTiersResponse
89
from ...models.http_validation_error import HTTPValidationError
910
from ...types import UNSET, Response, Unset
1011

@@ -30,9 +31,10 @@ def _get_kwargs(
3031

3132
def _parse_response(
3233
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
33-
) -> Optional[Union[Any, HTTPValidationError]]:
34+
) -> Optional[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
3435
if response.status_code == 200:
35-
response_200 = response.json()
36+
response_200 = AvailableGraphTiersResponse.from_dict(response.json())
37+
3638
return response_200
3739

3840
if response.status_code == 422:
@@ -52,7 +54,7 @@ def _parse_response(
5254

5355
def _build_response(
5456
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
55-
) -> Response[Union[Any, HTTPValidationError]]:
57+
) -> Response[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
5658
return Response(
5759
status_code=HTTPStatus(response.status_code),
5860
content=response.content,
@@ -65,7 +67,7 @@ def sync_detailed(
6567
*,
6668
client: AuthenticatedClient,
6769
include_disabled: Union[Unset, bool] = False,
68-
) -> Response[Union[Any, HTTPValidationError]]:
70+
) -> Response[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
6971
"""Get Available Graph Tiers
7072
7173
List all available graph database tier configurations.
@@ -104,7 +106,7 @@ def sync_detailed(
104106
httpx.TimeoutException: If the request takes longer than Client.timeout.
105107
106108
Returns:
107-
Response[Union[Any, HTTPValidationError]]
109+
Response[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]
108110
"""
109111

110112
kwargs = _get_kwargs(
@@ -122,7 +124,7 @@ def sync(
122124
*,
123125
client: AuthenticatedClient,
124126
include_disabled: Union[Unset, bool] = False,
125-
) -> Optional[Union[Any, HTTPValidationError]]:
127+
) -> Optional[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
126128
"""Get Available Graph Tiers
127129
128130
List all available graph database tier configurations.
@@ -161,7 +163,7 @@ def sync(
161163
httpx.TimeoutException: If the request takes longer than Client.timeout.
162164
163165
Returns:
164-
Union[Any, HTTPValidationError]
166+
Union[Any, AvailableGraphTiersResponse, HTTPValidationError]
165167
"""
166168

167169
return sync_detailed(
@@ -174,7 +176,7 @@ async def asyncio_detailed(
174176
*,
175177
client: AuthenticatedClient,
176178
include_disabled: Union[Unset, bool] = False,
177-
) -> Response[Union[Any, HTTPValidationError]]:
179+
) -> Response[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
178180
"""Get Available Graph Tiers
179181
180182
List all available graph database tier configurations.
@@ -213,7 +215,7 @@ async def asyncio_detailed(
213215
httpx.TimeoutException: If the request takes longer than Client.timeout.
214216
215217
Returns:
216-
Response[Union[Any, HTTPValidationError]]
218+
Response[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]
217219
"""
218220

219221
kwargs = _get_kwargs(
@@ -229,7 +231,7 @@ async def asyncio(
229231
*,
230232
client: AuthenticatedClient,
231233
include_disabled: Union[Unset, bool] = False,
232-
) -> Optional[Union[Any, HTTPValidationError]]:
234+
) -> Optional[Union[Any, AvailableGraphTiersResponse, HTTPValidationError]]:
233235
"""Get Available Graph Tiers
234236
235237
List all available graph database tier configurations.
@@ -268,7 +270,7 @@ async def asyncio(
268270
httpx.TimeoutException: If the request takes longer than Client.timeout.
269271
270272
Returns:
271-
Union[Any, HTTPValidationError]
273+
Union[Any, AvailableGraphTiersResponse, HTTPValidationError]
272274
"""
273275

274276
return (

‎robosystems_client/api/service_offerings/get_service_offerings.py‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ... import errors
77
from ...client import AuthenticatedClient, Client
88
from ...models.error_response import ErrorResponse
9+
from ...models.service_offerings_response import ServiceOfferingsResponse
910
from ...types import Response
1011

1112

@@ -20,9 +21,10 @@ def _get_kwargs() -> dict[str, Any]:
2021

2122
def _parse_response(
2223
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
23-
) -> Optional[Union[Any, ErrorResponse]]:
24+
) -> Optional[Union[ErrorResponse, ServiceOfferingsResponse]]:
2425
if response.status_code == 200:
25-
response_200 = response.json()
26+
response_200 = ServiceOfferingsResponse.from_dict(response.json())
27+
2628
return response_200
2729

2830
if response.status_code == 500:
@@ -38,7 +40,7 @@ def _parse_response(
3840

3941
def _build_response(
4042
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
41-
) -> Response[Union[Any, ErrorResponse]]:
43+
) -> Response[Union[ErrorResponse, ServiceOfferingsResponse]]:
4244
return Response(
4345
status_code=HTTPStatus(response.status_code),
4446
content=response.content,
@@ -50,7 +52,7 @@ def _build_response(
5052
def sync_detailed(
5153
*,
5254
client: Union[AuthenticatedClient, Client],
53-
) -> Response[Union[Any, ErrorResponse]]:
55+
) -> Response[Union[ErrorResponse, ServiceOfferingsResponse]]:
5456
"""Get Service Offerings
5557
5658
Get comprehensive information about all subscription offerings.
@@ -75,7 +77,7 @@ def sync_detailed(
7577
httpx.TimeoutException: If the request takes longer than Client.timeout.
7678
7779
Returns:
78-
Response[Union[Any, ErrorResponse]]
80+
Response[Union[ErrorResponse, ServiceOfferingsResponse]]
7981
"""
8082

8183
kwargs = _get_kwargs()
@@ -90,7 +92,7 @@ def sync_detailed(
9092
def sync(
9193
*,
9294
client: Union[AuthenticatedClient, Client],
93-
) -> Optional[Union[Any, ErrorResponse]]:
95+
) -> Optional[Union[ErrorResponse, ServiceOfferingsResponse]]:
9496
"""Get Service Offerings
9597
9698
Get comprehensive information about all subscription offerings.
@@ -115,7 +117,7 @@ def sync(
115117
httpx.TimeoutException: If the request takes longer than Client.timeout.
116118
117119
Returns:
118-
Union[Any, ErrorResponse]
120+
Union[ErrorResponse, ServiceOfferingsResponse]
119121
"""
120122

121123
return sync_detailed(
@@ -126,7 +128,7 @@ def sync(
126128
async def asyncio_detailed(
127129
*,
128130
client: Union[AuthenticatedClient, Client],
129-
) -> Response[Union[Any, ErrorResponse]]:
131+
) -> Response[Union[ErrorResponse, ServiceOfferingsResponse]]:
130132
"""Get Service Offerings
131133
132134
Get comprehensive information about all subscription offerings.
@@ -151,7 +153,7 @@ async def asyncio_detailed(
151153
httpx.TimeoutException: If the request takes longer than Client.timeout.
152154
153155
Returns:
154-
Response[Union[Any, ErrorResponse]]
156+
Response[Union[ErrorResponse, ServiceOfferingsResponse]]
155157
"""
156158

157159
kwargs = _get_kwargs()
@@ -164,7 +166,7 @@ async def asyncio_detailed(
164166
async def asyncio(
165167
*,
166168
client: Union[AuthenticatedClient, Client],
167-
) -> Optional[Union[Any, ErrorResponse]]:
169+
) -> Optional[Union[ErrorResponse, ServiceOfferingsResponse]]:
168170
"""Get Service Offerings
169171
170172
Get comprehensive information about all subscription offerings.
@@ -189,7 +191,7 @@ async def asyncio(
189191
httpx.TimeoutException: If the request takes longer than Client.timeout.
190192
191193
Returns:
192-
Union[Any, ErrorResponse]
194+
Union[ErrorResponse, ServiceOfferingsResponse]
193195
"""
194196

195197
return (

‎robosystems_client/models/__init__.py‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from .auth_response_user import AuthResponseUser
2929
from .available_extension import AvailableExtension
3030
from .available_extensions_response import AvailableExtensionsResponse
31+
from .available_graph_tiers_response import AvailableGraphTiersResponse
3132
from .backup_create_request import BackupCreateRequest
3233
from .backup_download_url_response import BackupDownloadUrlResponse
3334
from .backup_limits import BackupLimits
@@ -148,6 +149,13 @@
148149
from .graph_metrics_response_relationship_counts import (
149150
GraphMetricsResponseRelationshipCounts,
150151
)
152+
from .graph_subscription_tier import GraphSubscriptionTier
153+
from .graph_subscriptions import GraphSubscriptions
154+
from .graph_tier_backup import GraphTierBackup
155+
from .graph_tier_copy_operations import GraphTierCopyOperations
156+
from .graph_tier_info import GraphTierInfo
157+
from .graph_tier_instance import GraphTierInstance
158+
from .graph_tier_limits import GraphTierLimits
151159
from .graph_usage_response import GraphUsageResponse
152160
from .graph_usage_response_query_statistics import GraphUsageResponseQueryStatistics
153161
from .graph_usage_response_recent_activity import GraphUsageResponseRecentActivity
@@ -174,6 +182,13 @@
174182
OAuthInitRequestAdditionalParamsType0,
175183
)
176184
from .o_auth_init_response import OAuthInitResponse
185+
from .offering_repository_plan import OfferingRepositoryPlan
186+
from .offering_repository_plan_rate_limits_type_0 import (
187+
OfferingRepositoryPlanRateLimitsType0,
188+
)
189+
from .operation_costs import OperationCosts
190+
from .operation_costs_ai_operations import OperationCostsAiOperations
191+
from .operation_costs_token_pricing import OperationCostsTokenPricing
177192
from .password_check_request import PasswordCheckRequest
178193
from .password_check_response import PasswordCheckResponse
179194
from .password_check_response_character_types import PasswordCheckResponseCharacterTypes
@@ -191,7 +206,9 @@
191206
from .rate_limits import RateLimits
192207
from .register_request import RegisterRequest
193208
from .repository_credits_response import RepositoryCreditsResponse
209+
from .repository_info import RepositoryInfo
194210
from .repository_plan import RepositoryPlan
211+
from .repository_subscriptions import RepositorySubscriptions
195212
from .repository_type import RepositoryType
196213
from .resend_verification_email_response_resendverificationemail import (
197214
ResendVerificationEmailResponseResendverificationemail,
@@ -217,10 +234,15 @@
217234
from .schema_validation_response_stats_type_0 import SchemaValidationResponseStatsType0
218235
from .sec_connection_config import SECConnectionConfig
219236
from .selection_criteria import SelectionCriteria
237+
from .service_offering_summary import ServiceOfferingSummary
238+
from .service_offerings_response import ServiceOfferingsResponse
220239
from .sso_complete_request import SSOCompleteRequest
221240
from .sso_exchange_request import SSOExchangeRequest
222241
from .sso_exchange_response import SSOExchangeResponse
223242
from .sso_token_response import SSOTokenResponse
243+
from .storage_info import StorageInfo
244+
from .storage_info_included_per_tier import StorageInfoIncludedPerTier
245+
from .storage_info_overage_pricing import StorageInfoOveragePricing
224246
from .storage_limit_response import StorageLimitResponse
225247
from .storage_limits import StorageLimits
226248
from .subgraph_quota_response import SubgraphQuotaResponse
@@ -247,6 +269,7 @@
247269
from .table_query_request import TableQueryRequest
248270
from .table_query_response import TableQueryResponse
249271
from .tier_upgrade_request import TierUpgradeRequest
272+
from .token_pricing import TokenPricing
250273
from .transaction_summary_response import TransactionSummaryResponse
251274
from .update_api_key_request import UpdateAPIKeyRequest
252275
from .update_file_status_response_updatefilestatus import (
@@ -300,6 +323,7 @@
300323
"AuthResponseUser",
301324
"AvailableExtension",
302325
"AvailableExtensionsResponse",
326+
"AvailableGraphTiersResponse",
303327
"BackupCreateRequest",
304328
"BackupDownloadUrlResponse",
305329
"BackupLimits",
@@ -382,6 +406,13 @@
382406
"GraphMetricsResponseHealthStatus",
383407
"GraphMetricsResponseNodeCounts",
384408
"GraphMetricsResponseRelationshipCounts",
409+
"GraphSubscriptions",
410+
"GraphSubscriptionTier",
411+
"GraphTierBackup",
412+
"GraphTierCopyOperations",
413+
"GraphTierInfo",
414+
"GraphTierInstance",
415+
"GraphTierLimits",
385416
"GraphUsageResponse",
386417
"GraphUsageResponseQueryStatistics",
387418
"GraphUsageResponseRecentActivity",
@@ -406,6 +437,11 @@
406437
"OAuthInitRequest",
407438
"OAuthInitRequestAdditionalParamsType0",
408439
"OAuthInitResponse",
440+
"OfferingRepositoryPlan",
441+
"OfferingRepositoryPlanRateLimitsType0",
442+
"OperationCosts",
443+
"OperationCostsAiOperations",
444+
"OperationCostsTokenPricing",
409445
"PasswordCheckRequest",
410446
"PasswordCheckResponse",
411447
"PasswordCheckResponseCharacterTypes",
@@ -419,7 +455,9 @@
419455
"RateLimits",
420456
"RegisterRequest",
421457
"RepositoryCreditsResponse",
458+
"RepositoryInfo",
422459
"RepositoryPlan",
460+
"RepositorySubscriptions",
423461
"RepositoryType",
424462
"ResendVerificationEmailResponseResendverificationemail",
425463
"ResetPasswordRequest",
@@ -437,10 +475,15 @@
437475
"SchemaValidationResponseStatsType0",
438476
"SECConnectionConfig",
439477
"SelectionCriteria",
478+
"ServiceOfferingsResponse",
479+
"ServiceOfferingSummary",
440480
"SSOCompleteRequest",
441481
"SSOExchangeRequest",
442482
"SSOExchangeResponse",
443483
"SSOTokenResponse",
484+
"StorageInfo",
485+
"StorageInfoIncludedPerTier",
486+
"StorageInfoOveragePricing",
444487
"StorageLimitResponse",
445488
"StorageLimits",
446489
"SubgraphQuotaResponse",
@@ -463,6 +506,7 @@
463506
"TableQueryRequest",
464507
"TableQueryResponse",
465508
"TierUpgradeRequest",
509+
"TokenPricing",
466510
"TransactionSummaryResponse",
467511
"UpdateAPIKeyRequest",
468512
"UpdateFileStatusResponseUpdatefilestatus",

0 commit comments

Comments
 (0)