Skip to content

Commit 0535bb5

Browse files
Pull openapi again
1 parent 714eea9 commit 0535bb5

File tree

7 files changed

+464
-0
lines changed

7 files changed

+464
-0
lines changed

fishjam/_openapi_client/api/broadcaster/__init__.py

Whitespace-only changes.
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.broadcaster_verify_token_response import BroadcasterVerifyTokenResponse
9+
from ...models.error import Error
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
token: str,
15+
) -> Dict[str, Any]:
16+
return {
17+
"method": "get",
18+
"url": "/broadcaster/verify/{token}".format(
19+
token=token,
20+
),
21+
}
22+
23+
24+
def _parse_response(
25+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
26+
) -> Optional[Union[BroadcasterVerifyTokenResponse, Error]]:
27+
if response.status_code == HTTPStatus.CREATED:
28+
response_201 = BroadcasterVerifyTokenResponse.from_dict(response.json())
29+
30+
return response_201
31+
if response.status_code == HTTPStatus.UNAUTHORIZED:
32+
response_401 = Error.from_dict(response.json())
33+
34+
return response_401
35+
if client.raise_on_unexpected_status:
36+
raise errors.UnexpectedStatus(response.status_code, response.content)
37+
else:
38+
return None
39+
40+
41+
def _build_response(
42+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
43+
) -> Response[Union[BroadcasterVerifyTokenResponse, Error]]:
44+
return Response(
45+
status_code=HTTPStatus(response.status_code),
46+
content=response.content,
47+
headers=response.headers,
48+
parsed=_parse_response(client=client, response=response),
49+
)
50+
51+
52+
def sync_detailed(
53+
token: str,
54+
*,
55+
client: Union[AuthenticatedClient, Client],
56+
) -> Response[Union[BroadcasterVerifyTokenResponse, Error]]:
57+
"""Verify token provided by broadcaster
58+
59+
Args:
60+
token (str):
61+
62+
Raises:
63+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
64+
httpx.TimeoutException: If the request takes longer than Client.timeout.
65+
66+
Returns:
67+
Response[Union[BroadcasterVerifyTokenResponse, Error]]
68+
"""
69+
70+
kwargs = _get_kwargs(
71+
token=token,
72+
)
73+
74+
response = client.get_httpx_client().request(
75+
**kwargs,
76+
)
77+
78+
return _build_response(client=client, response=response)
79+
80+
81+
def sync(
82+
token: str,
83+
*,
84+
client: Union[AuthenticatedClient, Client],
85+
) -> Optional[Union[BroadcasterVerifyTokenResponse, Error]]:
86+
"""Verify token provided by broadcaster
87+
88+
Args:
89+
token (str):
90+
91+
Raises:
92+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
93+
httpx.TimeoutException: If the request takes longer than Client.timeout.
94+
95+
Returns:
96+
Union[BroadcasterVerifyTokenResponse, Error]
97+
"""
98+
99+
return sync_detailed(
100+
token=token,
101+
client=client,
102+
).parsed
103+
104+
105+
async def asyncio_detailed(
106+
token: str,
107+
*,
108+
client: Union[AuthenticatedClient, Client],
109+
) -> Response[Union[BroadcasterVerifyTokenResponse, Error]]:
110+
"""Verify token provided by broadcaster
111+
112+
Args:
113+
token (str):
114+
115+
Raises:
116+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117+
httpx.TimeoutException: If the request takes longer than Client.timeout.
118+
119+
Returns:
120+
Response[Union[BroadcasterVerifyTokenResponse, Error]]
121+
"""
122+
123+
kwargs = _get_kwargs(
124+
token=token,
125+
)
126+
127+
response = await client.get_async_httpx_client().request(**kwargs)
128+
129+
return _build_response(client=client, response=response)
130+
131+
132+
async def asyncio(
133+
token: str,
134+
*,
135+
client: Union[AuthenticatedClient, Client],
136+
) -> Optional[Union[BroadcasterVerifyTokenResponse, Error]]:
137+
"""Verify token provided by broadcaster
138+
139+
Args:
140+
token (str):
141+
142+
Raises:
143+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144+
httpx.TimeoutException: If the request takes longer than Client.timeout.
145+
146+
Returns:
147+
Union[BroadcasterVerifyTokenResponse, Error]
148+
"""
149+
150+
return (
151+
await asyncio_detailed(
152+
token=token,
153+
client=client,
154+
)
155+
).parsed

fishjam/_openapi_client/api/viewer/__init__.py

Whitespace-only changes.
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional, Union, cast
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.error import Error
9+
from ...types import Response
10+
11+
12+
def _get_kwargs(
13+
room_id: str,
14+
) -> Dict[str, Any]:
15+
return {
16+
"method": "post",
17+
"url": "/room/{room_id}/viewer".format(
18+
room_id=room_id,
19+
),
20+
}
21+
22+
23+
def _parse_response(
24+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
25+
) -> Optional[Union[Error, str]]:
26+
if response.status_code == HTTPStatus.CREATED:
27+
response_201 = cast(str, response.json())
28+
return response_201
29+
if response.status_code == HTTPStatus.BAD_REQUEST:
30+
response_400 = Error.from_dict(response.json())
31+
32+
return response_400
33+
if response.status_code == HTTPStatus.UNAUTHORIZED:
34+
response_401 = Error.from_dict(response.json())
35+
36+
return response_401
37+
if response.status_code == HTTPStatus.NOT_FOUND:
38+
response_404 = Error.from_dict(response.json())
39+
40+
return response_404
41+
if response.status_code == HTTPStatus.SERVICE_UNAVAILABLE:
42+
response_503 = Error.from_dict(response.json())
43+
44+
return response_503
45+
if client.raise_on_unexpected_status:
46+
raise errors.UnexpectedStatus(response.status_code, response.content)
47+
else:
48+
return None
49+
50+
51+
def _build_response(
52+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
53+
) -> Response[Union[Error, str]]:
54+
return Response(
55+
status_code=HTTPStatus(response.status_code),
56+
content=response.content,
57+
headers=response.headers,
58+
parsed=_parse_response(client=client, response=response),
59+
)
60+
61+
62+
def sync_detailed(
63+
room_id: str,
64+
*,
65+
client: Union[AuthenticatedClient, Client],
66+
) -> Response[Union[Error, str]]:
67+
"""Generate token for single viewer
68+
69+
Args:
70+
room_id (str):
71+
72+
Raises:
73+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74+
httpx.TimeoutException: If the request takes longer than Client.timeout.
75+
76+
Returns:
77+
Response[Union[Error, str]]
78+
"""
79+
80+
kwargs = _get_kwargs(
81+
room_id=room_id,
82+
)
83+
84+
response = client.get_httpx_client().request(
85+
**kwargs,
86+
)
87+
88+
return _build_response(client=client, response=response)
89+
90+
91+
def sync(
92+
room_id: str,
93+
*,
94+
client: Union[AuthenticatedClient, Client],
95+
) -> Optional[Union[Error, str]]:
96+
"""Generate token for single viewer
97+
98+
Args:
99+
room_id (str):
100+
101+
Raises:
102+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103+
httpx.TimeoutException: If the request takes longer than Client.timeout.
104+
105+
Returns:
106+
Union[Error, str]
107+
"""
108+
109+
return sync_detailed(
110+
room_id=room_id,
111+
client=client,
112+
).parsed
113+
114+
115+
async def asyncio_detailed(
116+
room_id: str,
117+
*,
118+
client: Union[AuthenticatedClient, Client],
119+
) -> Response[Union[Error, str]]:
120+
"""Generate token for single viewer
121+
122+
Args:
123+
room_id (str):
124+
125+
Raises:
126+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127+
httpx.TimeoutException: If the request takes longer than Client.timeout.
128+
129+
Returns:
130+
Response[Union[Error, str]]
131+
"""
132+
133+
kwargs = _get_kwargs(
134+
room_id=room_id,
135+
)
136+
137+
response = await client.get_async_httpx_client().request(**kwargs)
138+
139+
return _build_response(client=client, response=response)
140+
141+
142+
async def asyncio(
143+
room_id: str,
144+
*,
145+
client: Union[AuthenticatedClient, Client],
146+
) -> Optional[Union[Error, str]]:
147+
"""Generate token for single viewer
148+
149+
Args:
150+
room_id (str):
151+
152+
Raises:
153+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
154+
httpx.TimeoutException: If the request takes longer than Client.timeout.
155+
156+
Returns:
157+
Union[Error, str]
158+
"""
159+
160+
return (
161+
await asyncio_detailed(
162+
room_id=room_id,
163+
client=client,
164+
)
165+
).parsed

fishjam/_openapi_client/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from .add_component_json_body import AddComponentJsonBody
44
from .add_peer_json_body import AddPeerJsonBody
5+
from .broadcaster_verify_token_response import BroadcasterVerifyTokenResponse
6+
from .broadcaster_verify_token_response_data import BroadcasterVerifyTokenResponseData
57
from .component_details_response import ComponentDetailsResponse
68
from .component_file import ComponentFile
79
from .component_hls import ComponentHLS
@@ -68,6 +70,8 @@
6870
__all__ = (
6971
"AddComponentJsonBody",
7072
"AddPeerJsonBody",
73+
"BroadcasterVerifyTokenResponse",
74+
"BroadcasterVerifyTokenResponseData",
7175
"ComponentDetailsResponse",
7276
"ComponentFile",
7377
"ComponentHLS",

0 commit comments

Comments
 (0)