11from http import HTTPStatus
2- from typing import Any , Dict , Optional , Union , cast
2+ from typing import Any , Dict , Optional , Union
33
44import httpx
55
66from ... import errors
77from ...client import AuthenticatedClient , Client
88from ...models .error import Error
9+ from ...models .viewer_token import ViewerToken
910from ...types import Response
1011
1112
@@ -22,9 +23,10 @@ def _get_kwargs(
2223
2324def _parse_response (
2425 * , client : Union [AuthenticatedClient , Client ], response : httpx .Response
25- ) -> Optional [Union [Error , str ]]:
26+ ) -> Optional [Union [Error , ViewerToken ]]:
2627 if response .status_code == HTTPStatus .CREATED :
27- response_201 = cast (str , response .json ())
28+ response_201 = ViewerToken .from_dict (response .json ())
29+
2830 return response_201
2931 if response .status_code == HTTPStatus .BAD_REQUEST :
3032 response_400 = Error .from_dict (response .json ())
@@ -50,7 +52,7 @@ def _parse_response(
5052
5153def _build_response (
5254 * , client : Union [AuthenticatedClient , Client ], response : httpx .Response
53- ) -> Response [Union [Error , str ]]:
55+ ) -> Response [Union [Error , ViewerToken ]]:
5456 return Response (
5557 status_code = HTTPStatus (response .status_code ),
5658 content = response .content ,
@@ -63,8 +65,8 @@ def sync_detailed(
6365 room_id : str ,
6466 * ,
6567 client : Union [AuthenticatedClient , Client ],
66- ) -> Response [Union [Error , str ]]:
67- """Generate token for single viewer
68+ ) -> Response [Union [Error , ViewerToken ]]:
69+ """Generate single broadcaster access token
6870
6971 Args:
7072 room_id (str):
@@ -74,7 +76,7 @@ def sync_detailed(
7476 httpx.TimeoutException: If the request takes longer than Client.timeout.
7577
7678 Returns:
77- Response[Union[Error, str ]]
79+ Response[Union[Error, ViewerToken ]]
7880 """
7981
8082 kwargs = _get_kwargs (
@@ -92,8 +94,8 @@ def sync(
9294 room_id : str ,
9395 * ,
9496 client : Union [AuthenticatedClient , Client ],
95- ) -> Optional [Union [Error , str ]]:
96- """Generate token for single viewer
97+ ) -> Optional [Union [Error , ViewerToken ]]:
98+ """Generate single broadcaster access token
9799
98100 Args:
99101 room_id (str):
@@ -103,7 +105,7 @@ def sync(
103105 httpx.TimeoutException: If the request takes longer than Client.timeout.
104106
105107 Returns:
106- Union[Error, str ]
108+ Union[Error, ViewerToken ]
107109 """
108110
109111 return sync_detailed (
@@ -116,8 +118,8 @@ async def asyncio_detailed(
116118 room_id : str ,
117119 * ,
118120 client : Union [AuthenticatedClient , Client ],
119- ) -> Response [Union [Error , str ]]:
120- """Generate token for single viewer
121+ ) -> Response [Union [Error , ViewerToken ]]:
122+ """Generate single broadcaster access token
121123
122124 Args:
123125 room_id (str):
@@ -127,7 +129,7 @@ async def asyncio_detailed(
127129 httpx.TimeoutException: If the request takes longer than Client.timeout.
128130
129131 Returns:
130- Response[Union[Error, str ]]
132+ Response[Union[Error, ViewerToken ]]
131133 """
132134
133135 kwargs = _get_kwargs (
@@ -143,8 +145,8 @@ async def asyncio(
143145 room_id : str ,
144146 * ,
145147 client : Union [AuthenticatedClient , Client ],
146- ) -> Optional [Union [Error , str ]]:
147- """Generate token for single viewer
148+ ) -> Optional [Union [Error , ViewerToken ]]:
149+ """Generate single broadcaster access token
148150
149151 Args:
150152 room_id (str):
@@ -154,7 +156,7 @@ async def asyncio(
154156 httpx.TimeoutException: If the request takes longer than Client.timeout.
155157
156158 Returns:
157- Union[Error, str ]
159+ Union[Error, ViewerToken ]
158160 """
159161
160162 return (
0 commit comments