Skip to content

Commit 1cb7ca7

Browse files
Update openapi client
1 parent 7bcd2aa commit 1cb7ca7

Some content is hidden

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

53 files changed

+795
-783
lines changed

docker-compose-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
context: .
4343
dockerfile: tests/Dockerfile
4444
args:
45-
PYTHON_VERSION: ${PYTHON_VERSION:-3.10}
45+
PYTHON_VERSION: ${PYTHON_VERSION:-3.11}
4646
command: uv run pytest
4747
environment:
4848
DOCKER_TEST: "TRUE"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
""" Contains endpoint functions for accessing the API """

fishjam/_openapi_client/api/broadcaster/verify_token.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

@@ -12,23 +12,25 @@
1212

1313
def _get_kwargs(
1414
token: str,
15-
) -> Dict[str, Any]:
16-
return {
15+
) -> dict[str, Any]:
16+
_kwargs: dict[str, Any] = {
1717
"method": "get",
1818
"url": "/broadcaster/verify/{token}".format(
1919
token=token,
2020
),
2121
}
2222

23+
return _kwargs
24+
2325

2426
def _parse_response(
2527
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
2628
) -> Optional[Union[BroadcasterVerifyTokenResponse, Error]]:
27-
if response.status_code == HTTPStatus.CREATED:
29+
if response.status_code == 201:
2830
response_201 = BroadcasterVerifyTokenResponse.from_dict(response.json())
2931

3032
return response_201
31-
if response.status_code == HTTPStatus.UNAUTHORIZED:
33+
if response.status_code == 401:
3234
response_401 = Error.from_dict(response.json())
3335

3436
return response_401
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
""" Contains endpoint functions for accessing the API """

fishjam/_openapi_client/api/default/notification.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union, cast
2+
from typing import Any, Optional, Union, cast
33

44
import httpx
55

@@ -9,24 +9,26 @@
99
from ...types import Response
1010

1111

12-
def _get_kwargs() -> Dict[str, Any]:
13-
return {
12+
def _get_kwargs() -> dict[str, Any]:
13+
_kwargs: dict[str, Any] = {
1414
"method": "post",
1515
"url": "/notifications",
1616
}
1717

18+
return _kwargs
19+
1820

1921
def _parse_response(
2022
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
2123
) -> Optional[Union[Any, Error]]:
22-
if response.status_code == HTTPStatus.NO_CONTENT:
24+
if response.status_code == 204:
2325
response_204 = cast(Any, None)
2426
return response_204
25-
if response.status_code == HTTPStatus.UNAUTHORIZED:
27+
if response.status_code == 401:
2628
response_401 = Error.from_dict(response.json())
2729

2830
return response_401
29-
if response.status_code == HTTPStatus.NOT_FOUND:
31+
if response.status_code == 404:
3032
response_404 = Error.from_dict(response.json())
3133

3234
return response_404
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
""" Contains endpoint functions for accessing the API """

fishjam/_openapi_client/api/room/add_peer.py

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Optional, Union
33

44
import httpx
55

66
from ... import errors
77
from ...client import AuthenticatedClient, Client
8-
from ...models.add_peer_json_body import AddPeerJsonBody
8+
from ...models.add_peer_body import AddPeerBody
99
from ...models.error import Error
1010
from ...models.peer_details_response import PeerDetailsResponse
1111
from ...types import Response
@@ -14,39 +14,45 @@
1414
def _get_kwargs(
1515
room_id: str,
1616
*,
17-
json_body: AddPeerJsonBody,
18-
) -> Dict[str, Any]:
19-
json_json_body = json_body.to_dict()
17+
body: AddPeerBody,
18+
) -> dict[str, Any]:
19+
headers: dict[str, Any] = {}
2020

21-
return {
21+
_kwargs: dict[str, Any] = {
2222
"method": "post",
2323
"url": "/room/{room_id}/peer".format(
2424
room_id=room_id,
2525
),
26-
"json": json_json_body,
2726
}
2827

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

3036
def _parse_response(
3137
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
3238
) -> Optional[Union[Error, PeerDetailsResponse]]:
33-
if response.status_code == HTTPStatus.CREATED:
39+
if response.status_code == 201:
3440
response_201 = PeerDetailsResponse.from_dict(response.json())
3541

3642
return response_201
37-
if response.status_code == HTTPStatus.BAD_REQUEST:
43+
if response.status_code == 400:
3844
response_400 = Error.from_dict(response.json())
3945

4046
return response_400
41-
if response.status_code == HTTPStatus.UNAUTHORIZED:
47+
if response.status_code == 401:
4248
response_401 = Error.from_dict(response.json())
4349

4450
return response_401
45-
if response.status_code == HTTPStatus.NOT_FOUND:
51+
if response.status_code == 404:
4652
response_404 = Error.from_dict(response.json())
4753

4854
return response_404
49-
if response.status_code == HTTPStatus.SERVICE_UNAVAILABLE:
55+
if response.status_code == 503:
5056
response_503 = Error.from_dict(response.json())
5157

5258
return response_503
@@ -71,13 +77,13 @@ def sync_detailed(
7177
room_id: str,
7278
*,
7379
client: AuthenticatedClient,
74-
json_body: AddPeerJsonBody,
80+
body: AddPeerBody,
7581
) -> Response[Union[Error, PeerDetailsResponse]]:
7682
"""Create peer
7783
7884
Args:
7985
room_id (str):
80-
json_body (AddPeerJsonBody):
86+
body (AddPeerBody):
8187
8288
Raises:
8389
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -89,7 +95,7 @@ def sync_detailed(
8995

9096
kwargs = _get_kwargs(
9197
room_id=room_id,
92-
json_body=json_body,
98+
body=body,
9399
)
94100

95101
response = client.get_httpx_client().request(
@@ -103,13 +109,13 @@ def sync(
103109
room_id: str,
104110
*,
105111
client: AuthenticatedClient,
106-
json_body: AddPeerJsonBody,
112+
body: AddPeerBody,
107113
) -> Optional[Union[Error, PeerDetailsResponse]]:
108114
"""Create peer
109115
110116
Args:
111117
room_id (str):
112-
json_body (AddPeerJsonBody):
118+
body (AddPeerBody):
113119
114120
Raises:
115121
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -122,21 +128,21 @@ def sync(
122128
return sync_detailed(
123129
room_id=room_id,
124130
client=client,
125-
json_body=json_body,
131+
body=body,
126132
).parsed
127133

128134

129135
async def asyncio_detailed(
130136
room_id: str,
131137
*,
132138
client: AuthenticatedClient,
133-
json_body: AddPeerJsonBody,
139+
body: AddPeerBody,
134140
) -> Response[Union[Error, PeerDetailsResponse]]:
135141
"""Create peer
136142
137143
Args:
138144
room_id (str):
139-
json_body (AddPeerJsonBody):
145+
body (AddPeerBody):
140146
141147
Raises:
142148
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -148,7 +154,7 @@ async def asyncio_detailed(
148154

149155
kwargs = _get_kwargs(
150156
room_id=room_id,
151-
json_body=json_body,
157+
body=body,
152158
)
153159

154160
response = await client.get_async_httpx_client().request(**kwargs)
@@ -160,13 +166,13 @@ async def asyncio(
160166
room_id: str,
161167
*,
162168
client: AuthenticatedClient,
163-
json_body: AddPeerJsonBody,
169+
body: AddPeerBody,
164170
) -> Optional[Union[Error, PeerDetailsResponse]]:
165171
"""Create peer
166172
167173
Args:
168174
room_id (str):
169-
json_body (AddPeerJsonBody):
175+
body (AddPeerBody):
170176
171177
Raises:
172178
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -180,6 +186,6 @@ async def asyncio(
180186
await asyncio_detailed(
181187
room_id=room_id,
182188
client=client,
183-
json_body=json_body,
189+
body=body,
184190
)
185191
).parsed

0 commit comments

Comments
 (0)