Fix client deserialization

This commit is contained in:
2025-12-14 22:01:18 +01:00
parent 79fb2aea38
commit 9ee3539eeb
11 changed files with 275 additions and 288 deletions

View File

@@ -0,0 +1,32 @@
from board_mate_client import ApiClient, DefaultApi, GameDto
class ApiController:
def __init__(self, config) -> None:
self.config = config
def create_party(self, white_name, black_name, time_value, increment) -> str | None:
try:
with ApiClient(self.config) as client:
api = DefaultApi(client)
game = GameDto(
white_name="Alice",
black_name="Bob",
time_value=300,
increment=10
)
response = api.create_party(game)
print("Raw response:", response)
return str(response.data)
except Exception as e:
print("Error during create_party:", e)
return None
def retrieve_game(self, game_id) -> GameDto:
with ApiClient(self.config) as client:
api = DefaultApi(client)
response = api.retrieve_games(game_id)
return GameDto.from_dict(response.data)