Skip to content

Commit 2f18378

Browse files
Release 0.26.0 (#73)
* Release 0.26.0 * Fix tests * Fix localtunnel command * Add artifact * Fix arguments parsing * Move localtunnel log upload before tests * Make tests less flaky * Fail tests later * Timeout on all events, not on each * Increase timeout
1 parent 0d8cafb commit 2f18378

Some content is hidden

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

64 files changed

+770
-678
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ jobs:
5555
- name: Initialize Localtunnel
5656
id: tunnel
5757
run: |
58-
npx localtunnel --port 5000 > tunnel.log 2>&1 &
59-
58+
npm install -g localtunnel
59+
npm exec localtunnel -- --port 5000 > tunnel.log 2>&1 &
60+
6061
# Poll for the URL
61-
TIMEOUT=10
62+
TIMEOUT=15
6263
ELAPSED=0
6364
echo "Waiting for localtunnel to generate URL..."
64-
65+
6566
while ! grep -q "https://" tunnel.log; do
6667
if [ $ELAPSED -ge $TIMEOUT ]; then
6768
echo "Error: Localtunnel timed out after ${TIMEOUT}s"
@@ -71,11 +72,18 @@ jobs:
7172
sleep 1
7273
ELAPSED=$((ELAPSED + 1))
7374
done
74-
75+
7576
TUNNEL_URL=$(grep -o 'https://[^ ]*' tunnel.log | head -n 1)
7677
echo "url=$TUNNEL_URL" >> $GITHUB_OUTPUT
7778
echo "Localtunnel is live at: $TUNNEL_URL"
7879
80+
- name: Upload localtunnel log
81+
if: always()
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: localtunnel-log-py${{ matrix.python-version }}
85+
path: tunnel.log
86+
7987
- name: Run tests
8088
run: uv run pytest
8189
env:

fishjam/_openapi_client/api/room/add_peer.py

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from http import HTTPStatus
2-
from typing import Any, Optional, Union
2+
from typing import Any
3+
from urllib.parse import quote
34

45
import httpx
56

@@ -8,24 +9,25 @@
89
from ...models.error import Error
910
from ...models.peer_config import PeerConfig
1011
from ...models.peer_details_response import PeerDetailsResponse
11-
from ...types import Response
12+
from ...types import UNSET, Response, Unset
1213

1314

1415
def _get_kwargs(
1516
room_id: str,
1617
*,
17-
body: PeerConfig,
18+
body: PeerConfig | Unset = UNSET,
1819
) -> dict[str, Any]:
1920
headers: dict[str, Any] = {}
2021

2122
_kwargs: dict[str, Any] = {
2223
"method": "post",
2324
"url": "/room/{room_id}/peer".format(
24-
room_id=room_id,
25+
room_id=quote(str(room_id), safe=""),
2526
),
2627
}
2728

28-
_kwargs["json"] = body.to_dict()
29+
if not isinstance(body, Unset):
30+
_kwargs["json"] = body.to_dict()
2931

3032
headers["Content-Type"] = "application/json"
3133

@@ -34,45 +36,52 @@ def _get_kwargs(
3436

3537

3638
def _parse_response(
37-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
38-
) -> Optional[Union[Error, PeerDetailsResponse]]:
39+
*, client: AuthenticatedClient | Client, response: httpx.Response
40+
) -> Error | PeerDetailsResponse | None:
3941
if response.status_code == 201:
4042
response_201 = PeerDetailsResponse.from_dict(response.json())
4143

4244
return response_201
45+
4346
if response.status_code == 400:
4447
response_400 = Error.from_dict(response.json())
4548

4649
return response_400
50+
4751
if response.status_code == 401:
4852
response_401 = Error.from_dict(response.json())
4953

5054
return response_401
55+
5156
if response.status_code == 402:
5257
response_402 = Error.from_dict(response.json())
5358

5459
return response_402
60+
5561
if response.status_code == 404:
5662
response_404 = Error.from_dict(response.json())
5763

5864
return response_404
65+
5966
if response.status_code == 409:
6067
response_409 = Error.from_dict(response.json())
6168

6269
return response_409
70+
6371
if response.status_code == 503:
6472
response_503 = Error.from_dict(response.json())
6573

6674
return response_503
75+
6776
if client.raise_on_unexpected_status:
6877
raise errors.UnexpectedStatus(response.status_code, response.content)
6978
else:
7079
return None
7180

7281

7382
def _build_response(
74-
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
75-
) -> Response[Union[Error, PeerDetailsResponse]]:
83+
*, client: AuthenticatedClient | Client, response: httpx.Response
84+
) -> Response[Error | PeerDetailsResponse]:
7685
return Response(
7786
status_code=HTTPStatus(response.status_code),
7887
content=response.content,
@@ -85,20 +94,20 @@ def sync_detailed(
8594
room_id: str,
8695
*,
8796
client: AuthenticatedClient,
88-
body: PeerConfig,
89-
) -> Response[Union[Error, PeerDetailsResponse]]:
97+
body: PeerConfig | Unset = UNSET,
98+
) -> Response[Error | PeerDetailsResponse]:
9099
"""Create peer
91100
92101
Args:
93102
room_id (str):
94-
body (PeerConfig): Peer configuration
103+
body (PeerConfig | Unset): Peer configuration
95104
96105
Raises:
97106
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
98107
httpx.TimeoutException: If the request takes longer than Client.timeout.
99108
100109
Returns:
101-
Response[Union[Error, PeerDetailsResponse]]
110+
Response[Error | PeerDetailsResponse]
102111
"""
103112

104113
kwargs = _get_kwargs(
@@ -117,20 +126,20 @@ def sync(
117126
room_id: str,
118127
*,
119128
client: AuthenticatedClient,
120-
body: PeerConfig,
121-
) -> Optional[Union[Error, PeerDetailsResponse]]:
129+
body: PeerConfig | Unset = UNSET,
130+
) -> Error | PeerDetailsResponse | None:
122131
"""Create peer
123132
124133
Args:
125134
room_id (str):
126-
body (PeerConfig): Peer configuration
135+
body (PeerConfig | Unset): Peer configuration
127136
128137
Raises:
129138
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
130139
httpx.TimeoutException: If the request takes longer than Client.timeout.
131140
132141
Returns:
133-
Union[Error, PeerDetailsResponse]
142+
Error | PeerDetailsResponse
134143
"""
135144

136145
return sync_detailed(
@@ -144,20 +153,20 @@ async def asyncio_detailed(
144153
room_id: str,
145154
*,
146155
client: AuthenticatedClient,
147-
body: PeerConfig,
148-
) -> Response[Union[Error, PeerDetailsResponse]]:
156+
body: PeerConfig | Unset = UNSET,
157+
) -> Response[Error | PeerDetailsResponse]:
149158
"""Create peer
150159
151160
Args:
152161
room_id (str):
153-
body (PeerConfig): Peer configuration
162+
body (PeerConfig | Unset): Peer configuration
154163
155164
Raises:
156165
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157166
httpx.TimeoutException: If the request takes longer than Client.timeout.
158167
159168
Returns:
160-
Response[Union[Error, PeerDetailsResponse]]
169+
Response[Error | PeerDetailsResponse]
161170
"""
162171

163172
kwargs = _get_kwargs(
@@ -174,20 +183,20 @@ async def asyncio(
174183
room_id: str,
175184
*,
176185
client: AuthenticatedClient,
177-
body: PeerConfig,
178-
) -> Optional[Union[Error, PeerDetailsResponse]]:
186+
body: PeerConfig | Unset = UNSET,
187+
) -> Error | PeerDetailsResponse | None:
179188
"""Create peer
180189
181190
Args:
182191
room_id (str):
183-
body (PeerConfig): Peer configuration
192+
body (PeerConfig | Unset): Peer configuration
184193
185194
Raises:
186195
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
187196
httpx.TimeoutException: If the request takes longer than Client.timeout.
188197
189198
Returns:
190-
Union[Error, PeerDetailsResponse]
199+
Error | PeerDetailsResponse
191200
"""
192201

193202
return (

0 commit comments

Comments
 (0)