switch to pydantic

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-11-28 23:50:50 -08:00
parent d9d73522fd
commit bc3d698539
230 changed files with 4467 additions and 25280 deletions

View File

@ -33,15 +33,15 @@ def _parse_response(
*, response: httpx.Response
) -> Optional[Union[ExtendedUser, Error]]:
if response.status_code == 200:
response_200 = ExtendedUser.from_dict(response.json())
response_200 = ExtendedUser(**response.json())
return response_200
if response.status_code == 400:
response_4XX = Error.from_dict(response.json())
response_4XX = Error(**response.json())
return response_4XX
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
response_5XX = Error(**response.json())
return response_5XX
return Error.from_dict(response.json())
return Error(**response.json())
def _build_response(