This commit is contained in:
2026-01-01 15:49:49 +01:00
parent 8c289622e1
commit 85567d87b7
8 changed files with 29 additions and 26 deletions

View File

@@ -19,6 +19,7 @@ class AuthController:
auth_api = AuthApi(client)
auth_request = AuthRequestDto(
username=StrictStr(received_data["username"]),
username=StrictStr(received_data["username"]),
key=StrictStr(received_data["key"]),
)

View File

@@ -1,5 +1,5 @@
from board_mate.client import Configuration, ApiClient, ClientApi, ClientDto, ApiException
from flask import jsonify
from flask import jsonify, request
from pydantic import StrictStr
@@ -13,21 +13,25 @@ class GameController:
app.add_url_rule("/client/create", view_func=self.create, methods=['POST'])
def create(self):
with ApiClient(self.config) as api_client:
client_api = ClientApi(api_client)
try:
with ApiClient(self.config) as api_client:
request_data = request.get_json()
new_client = ClientDto(
name=StrictStr("Alice Example"),
username=StrictStr("alice123"),
)
client_api = ClientApi(api_client)
new_client = ClientDto(
companyName=StrictStr(request_data["companyName"]),
username=StrictStr(request_data["username"]),
key=StrictStr(request_data["key"]),
)
try:
response = client_api.create(client_dto=new_client)
print("Success:", response.success)
print("Message:", response.message)
print("Data:", response.data)
return jsonify(response), 200
except ApiException as e:
print(f"Exception when calling ClientApi->create: {e}")
return jsonify(response), 500
except ApiException as e:
print(f"Exception when calling ClientApi->create: {e}")
return jsonify(response), 500