Skip to content

Commit c331a8b

Browse files
committed
Support multiple bodies
1 parent d81d854 commit c331a8b

File tree

51 files changed

+598
-833
lines changed

Some content is hidden

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

51 files changed

+598
-833
lines changed

end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ def _get_kwargs(
1717

1818
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
1919

20-
return {
20+
_kwargs = {
2121
"method": "get",
2222
"url": "/common_parameters",
2323
"params": params,
2424
}
2525

26+
return _kwargs
27+
2628

2729
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
2830
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ def _get_kwargs(
1717

1818
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
1919

20-
return {
20+
_kwargs = {
2121
"method": "post",
2222
"url": "/common_parameters",
2323
"params": params,
2424
}
2525

26+
return _kwargs
27+
2628

2729
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
2830
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/default/reserved_parameters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ def _get_kwargs(
2020

2121
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2222

23-
return {
23+
_kwargs = {
2424
"method": "get",
2525
"url": "/naming/reserved-parameters",
2626
"params": params,
2727
}
2828

29+
return _kwargs
30+
2931

3032
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
3133
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ def _get_kwargs(
3838
if not isinstance(string_enum_header, Unset):
3939
headers["String-Enum-Header"] = str(string_enum_header)
4040

41-
return {
41+
_kwargs = {
4242
"method": "get",
4343
"url": "/location/header/types",
44-
"headers": headers,
4544
}
4645

46+
_kwargs["headers"] = headers
47+
return _kwargs
48+
4749

4850
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
4951
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ def _get_kwargs(
4141

4242
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
4343

44-
return {
44+
_kwargs = {
4545
"method": "get",
4646
"url": "/location/query/optionality",
4747
"params": params,
4848
}
4949

50+
return _kwargs
51+
5052

5153
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
5254
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from ... import errors
77
from ...client import AuthenticatedClient, Client
8-
from ...models.post_naming_property_conflict_with_import_json_body import PostNamingPropertyConflictWithImportJsonBody
8+
from ...models.post_naming_property_conflict_with_import_body import PostNamingPropertyConflictWithImportBody
99
from ...models.post_naming_property_conflict_with_import_response_200 import (
1010
PostNamingPropertyConflictWithImportResponse200,
1111
)
@@ -14,16 +14,23 @@
1414

1515
def _get_kwargs(
1616
*,
17-
json_body: PostNamingPropertyConflictWithImportJsonBody,
17+
body: PostNamingPropertyConflictWithImportBody,
1818
) -> Dict[str, Any]:
19-
json_json_body = json_body.to_dict()
19+
headers = {}
2020

21-
return {
21+
_kwargs = {
2222
"method": "post",
2323
"url": "/naming/property-conflict-with-import",
24-
"json": json_json_body,
2524
}
2625

26+
_body = body.to_dict()
27+
28+
_kwargs["json"] = _body
29+
headers["Content-Type"] = "application/json"
30+
31+
_kwargs["headers"] = headers
32+
return _kwargs
33+
2734

2835
def _parse_response(
2936
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
@@ -52,11 +59,11 @@ def _build_response(
5259
def sync_detailed(
5360
*,
5461
client: Union[AuthenticatedClient, Client],
55-
json_body: PostNamingPropertyConflictWithImportJsonBody,
62+
body: PostNamingPropertyConflictWithImportBody,
5663
) -> Response[PostNamingPropertyConflictWithImportResponse200]:
5764
"""
5865
Args:
59-
json_body (PostNamingPropertyConflictWithImportJsonBody):
66+
body (PostNamingPropertyConflictWithImportBody):
6067
6168
Raises:
6269
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -67,7 +74,7 @@ def sync_detailed(
6774
"""
6875

6976
kwargs = _get_kwargs(
70-
json_body=json_body,
77+
body=body,
7178
)
7279

7380
response = client.get_httpx_client().request(
@@ -80,11 +87,11 @@ def sync_detailed(
8087
def sync(
8188
*,
8289
client: Union[AuthenticatedClient, Client],
83-
json_body: PostNamingPropertyConflictWithImportJsonBody,
90+
body: PostNamingPropertyConflictWithImportBody,
8491
) -> Optional[PostNamingPropertyConflictWithImportResponse200]:
8592
"""
8693
Args:
87-
json_body (PostNamingPropertyConflictWithImportJsonBody):
94+
body (PostNamingPropertyConflictWithImportBody):
8895
8996
Raises:
9097
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -96,18 +103,18 @@ def sync(
96103

97104
return sync_detailed(
98105
client=client,
99-
json_body=json_body,
106+
body=body,
100107
).parsed
101108

102109

103110
async def asyncio_detailed(
104111
*,
105112
client: Union[AuthenticatedClient, Client],
106-
json_body: PostNamingPropertyConflictWithImportJsonBody,
113+
body: PostNamingPropertyConflictWithImportBody,
107114
) -> Response[PostNamingPropertyConflictWithImportResponse200]:
108115
"""
109116
Args:
110-
json_body (PostNamingPropertyConflictWithImportJsonBody):
117+
body (PostNamingPropertyConflictWithImportBody):
111118
112119
Raises:
113120
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -118,7 +125,7 @@ async def asyncio_detailed(
118125
"""
119126

120127
kwargs = _get_kwargs(
121-
json_body=json_body,
128+
body=body,
122129
)
123130

124131
response = await client.get_async_httpx_client().request(**kwargs)
@@ -129,11 +136,11 @@ async def asyncio_detailed(
129136
async def asyncio(
130137
*,
131138
client: Union[AuthenticatedClient, Client],
132-
json_body: PostNamingPropertyConflictWithImportJsonBody,
139+
body: PostNamingPropertyConflictWithImportBody,
133140
) -> Optional[PostNamingPropertyConflictWithImportResponse200]:
134141
"""
135142
Args:
136-
json_body (PostNamingPropertyConflictWithImportJsonBody):
143+
body (PostNamingPropertyConflictWithImportBody):
137144
138145
Raises:
139146
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -146,6 +153,6 @@ async def asyncio(
146153
return (
147154
await asyncio_detailed(
148155
client=client,
149-
json_body=json_body,
156+
body=body,
150157
)
151158
).parsed

end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,18 @@ def _get_kwargs(
3131

3232
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
3333

34-
return {
34+
_kwargs = {
3535
"method": "get",
3636
"url": "/parameter-references/{path_param}".format(
3737
path_param=path_param,
3838
),
3939
"params": params,
40-
"headers": headers,
4140
"cookies": cookies,
4241
}
4342

43+
_kwargs["headers"] = headers
44+
return _kwargs
45+
4446

4547
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
4648
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ def _get_kwargs(
1818

1919
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2020

21-
return {
21+
_kwargs = {
2222
"method": "delete",
2323
"url": "/common_parameters_overriding/{param}".format(
2424
param=param_path,
2525
),
2626
"params": params,
2727
}
2828

29+
return _kwargs
30+
2931

3032
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
3133
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ def _get_kwargs(
1818

1919
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
2020

21-
return {
21+
_kwargs = {
2222
"method": "get",
2323
"url": "/common_parameters_overriding/{param}".format(
2424
param=param_path,
2525
),
2626
"params": params,
2727
}
2828

29+
return _kwargs
30+
2931

3032
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
3133
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ def _get_kwargs(
2828

2929
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
3030

31-
return {
31+
_kwargs = {
3232
"method": "get",
3333
"url": "/same-name-multiple-locations/{param}".format(
3434
param=param_path,
3535
),
3636
"params": params,
37-
"headers": headers,
3837
"cookies": cookies,
3938
}
4039

40+
_kwargs["headers"] = headers
41+
return _kwargs
42+
4143

4244
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
4345
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def _get_kwargs(
1414
param1: str,
1515
param3: int,
1616
) -> Dict[str, Any]:
17-
return {
17+
_kwargs = {
1818
"method": "get",
1919
"url": "/multiple-path-parameters/{param4}/something/{param2}/{param1}/{param3}".format(
2020
param4=param4,
@@ -24,6 +24,8 @@ def _get_kwargs(
2424
),
2525
}
2626

27+
return _kwargs
28+
2729

2830
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
2931
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313

1414
def _get_kwargs() -> Dict[str, Any]:
15-
return {
15+
_kwargs = {
1616
"method": "post",
1717
"url": "/responses/unions/simple_before_complex",
1818
}
1919

20+
return _kwargs
21+
2022

2123
def _parse_response(
2224
*, client: Union[AuthenticatedClient, Client], response: httpx.Response

end_to_end_tests/golden-record/my_test_api_client/api/responses/text_response.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010

1111
def _get_kwargs() -> Dict[str, Any]:
12-
return {
12+
_kwargs = {
1313
"method": "post",
1414
"url": "/responses/text",
1515
}
1616

17+
return _kwargs
18+
1719

1820
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[str]:
1921
if response.status_code == HTTPStatus.OK:

end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010

1111
def _get_kwargs() -> Dict[str, Any]:
12-
return {
12+
_kwargs = {
1313
"method": "get",
1414
"url": "/tag_with_number",
1515
}
1616

17+
return _kwargs
18+
1719

1820
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
1921
if response.status_code == HTTPStatus.OK:

0 commit comments

Comments
 (0)