Skip to content

Commit 63e9c01

Browse files
committed
Refactor API response handling and update documentation
- Modified response handling in multiple API endpoints to ensure consistent return types, particularly for error responses. - Updated documentation to reflect changes in API behavior and improved clarity on response structures. - Removed deprecated models and cleaned up unused code to streamline the codebase. No breaking changes introduced; existing functionality remains intact.
1 parent a8cd1ee commit 63e9c01

130 files changed

Lines changed: 3415 additions & 1942 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎justfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typecheck:
5050
generate-sdk url="http://localhost:8000/openapi.json":
5151
@echo "🚀 Generating Client from {{url}}..."
5252
rm -rf generated
53-
openapi-python-client generate --url {{url}} --output-path generated --config robosystems_client/sdk-config.yaml
53+
uv run openapi-python-client generate --url {{url}} --output-path generated --config robosystems_client/sdk-config.yaml
5454
@echo "📦 Copying generated code to robosystems_client..."
5555
rm -rf robosystems_client/api robosystems_client/models robosystems_client/client.py robosystems_client/errors.py robosystems_client/types.py robosystems_client/py.typed
5656
cp -r generated/robo_systems_api_client/api robosystems_client/

‎robosystems_client/api/agent/auto_select_agent.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,29 @@ def _parse_response(
5555
response_200 = AgentResponse.from_dict(response.json())
5656

5757
return response_200
58+
5859
if response.status_code == 400:
5960
response_400 = cast(Any, None)
6061
return response_400
62+
6163
if response.status_code == 402:
6264
response_402 = cast(Any, None)
6365
return response_402
66+
67+
if response.status_code == 422:
68+
response_422 = HTTPValidationError.from_dict(response.json())
69+
70+
return response_422
71+
6472
if response.status_code == 429:
6573
response_429 = cast(Any, None)
6674
return response_429
75+
6776
if response.status_code == 500:
6877
response_500 = ErrorResponse.from_dict(response.json())
6978

7079
return response_500
71-
if response.status_code == 422:
72-
response_422 = HTTPValidationError.from_dict(response.json())
7380

74-
return response_422
7581
if client.raise_on_unexpected_status:
7682
raise errors.UnexpectedStatus(response.status_code, response.content)
7783
else:

‎robosystems_client/api/agent/batch_process_queries.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,24 @@ def _parse_response(
5454
response_200 = BatchAgentResponse.from_dict(response.json())
5555

5656
return response_200
57+
5758
if response.status_code == 400:
5859
response_400 = cast(Any, None)
5960
return response_400
61+
6062
if response.status_code == 402:
6163
response_402 = cast(Any, None)
6264
return response_402
63-
if response.status_code == 500:
64-
response_500 = cast(Any, None)
65-
return response_500
65+
6666
if response.status_code == 422:
6767
response_422 = HTTPValidationError.from_dict(response.json())
6868

6969
return response_422
70+
71+
if response.status_code == 500:
72+
response_500 = cast(Any, None)
73+
return response_500
74+
7075
if client.raise_on_unexpected_status:
7176
raise errors.UnexpectedStatus(response.status_code, response.content)
7277
else:

‎robosystems_client/api/agent/execute_specific_agent.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,33 @@ def _parse_response(
5656
response_200 = AgentResponse.from_dict(response.json())
5757

5858
return response_200
59+
5960
if response.status_code == 400:
6061
response_400 = cast(Any, None)
6162
return response_400
63+
6264
if response.status_code == 402:
6365
response_402 = cast(Any, None)
6466
return response_402
67+
6568
if response.status_code == 404:
6669
response_404 = cast(Any, None)
6770
return response_404
71+
72+
if response.status_code == 422:
73+
response_422 = HTTPValidationError.from_dict(response.json())
74+
75+
return response_422
76+
6877
if response.status_code == 429:
6978
response_429 = cast(Any, None)
7079
return response_429
80+
7181
if response.status_code == 500:
7282
response_500 = ErrorResponse.from_dict(response.json())
7383

7484
return response_500
75-
if response.status_code == 422:
76-
response_422 = HTTPValidationError.from_dict(response.json())
7785

78-
return response_422
7986
if client.raise_on_unexpected_status:
8087
raise errors.UnexpectedStatus(response.status_code, response.content)
8188
else:

‎robosystems_client/api/agent/get_agent_metadata.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ def _parse_response(
4949
response_200 = AgentMetadataResponse.from_dict(response.json())
5050

5151
return response_200
52+
5253
if response.status_code == 404:
5354
response_404 = cast(Any, None)
5455
return response_404
56+
5557
if response.status_code == 422:
5658
response_422 = HTTPValidationError.from_dict(response.json())
5759

5860
return response_422
61+
5962
if client.raise_on_unexpected_status:
6063
raise errors.UnexpectedStatus(response.status_code, response.content)
6164
else:

‎robosystems_client/api/agent/list_agents.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ def _parse_response(
5656
response_200 = AgentListResponse.from_dict(response.json())
5757

5858
return response_200
59+
5960
if response.status_code == 401:
6061
response_401 = cast(Any, None)
6162
return response_401
63+
6264
if response.status_code == 422:
6365
response_422 = HTTPValidationError.from_dict(response.json())
6466

6567
return response_422
68+
6669
if client.raise_on_unexpected_status:
6770
raise errors.UnexpectedStatus(response.status_code, response.content)
6871
else:

‎robosystems_client/api/agent/recommend_agent.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ def _parse_response(
5454
response_200 = AgentRecommendationResponse.from_dict(response.json())
5555

5656
return response_200
57+
5758
if response.status_code == 400:
5859
response_400 = cast(Any, None)
5960
return response_400
61+
6062
if response.status_code == 422:
6163
response_422 = HTTPValidationError.from_dict(response.json())
6264

6365
return response_422
66+
6467
if client.raise_on_unexpected_status:
6568
raise errors.UnexpectedStatus(response.status_code, response.content)
6669
else:

‎robosystems_client/api/auth/check_password_strength.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ def _parse_response(
3737
response_200 = PasswordCheckResponse.from_dict(response.json())
3838

3939
return response_200
40+
4041
if response.status_code == 422:
4142
response_422 = HTTPValidationError.from_dict(response.json())
4243

4344
return response_422
45+
4446
if client.raise_on_unexpected_status:
4547
raise errors.UnexpectedStatus(response.status_code, response.content)
4648
else:

‎robosystems_client/api/auth/complete_sso_auth.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ def _parse_response(
3838
response_200 = AuthResponse.from_dict(response.json())
3939

4040
return response_200
41+
4142
if response.status_code == 401:
4243
response_401 = ErrorResponse.from_dict(response.json())
4344

4445
return response_401
46+
4547
if response.status_code == 422:
4648
response_422 = HTTPValidationError.from_dict(response.json())
4749

4850
return response_422
51+
4952
if client.raise_on_unexpected_status:
5053
raise errors.UnexpectedStatus(response.status_code, response.content)
5154
else:

‎robosystems_client/api/auth/forgot_password.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ def _parse_response(
4242
response_200 = ForgotPasswordResponseForgotpassword.from_dict(response.json())
4343

4444
return response_200
45-
if response.status_code == 429:
46-
response_429 = ErrorResponse.from_dict(response.json())
4745

48-
return response_429
4946
if response.status_code == 422:
5047
response_422 = HTTPValidationError.from_dict(response.json())
5148

5249
return response_422
50+
51+
if response.status_code == 429:
52+
response_429 = ErrorResponse.from_dict(response.json())
53+
54+
return response_429
55+
5356
if client.raise_on_unexpected_status:
5457
raise errors.UnexpectedStatus(response.status_code, response.content)
5558
else:

0 commit comments

Comments
 (0)