Fix move quoting
This commit is contained in:
@@ -32,5 +32,6 @@ from board_mate_client.exceptions import ApiException
|
||||
|
||||
# import models into sdk package
|
||||
from board_mate_client.models.game_dto import GameDto
|
||||
from board_mate_client.models.move_dto import MoveDto
|
||||
from board_mate_client.models.response_body_game_dto import ResponseBodyGameDto
|
||||
from board_mate_client.models.response_body_string import ResponseBodyString
|
||||
|
||||
@@ -18,6 +18,7 @@ from typing_extensions import Annotated
|
||||
|
||||
from pydantic import StrictStr
|
||||
from board_mate_client.models.game_dto import GameDto
|
||||
from board_mate_client.models.move_dto import MoveDto
|
||||
from board_mate_client.models.response_body_game_dto import ResponseBodyGameDto
|
||||
from board_mate_client.models.response_body_string import ResponseBodyString
|
||||
|
||||
@@ -43,7 +44,7 @@ class DefaultApi:
|
||||
def add_move(
|
||||
self,
|
||||
game_id: StrictStr,
|
||||
body: StrictStr,
|
||||
move_dto: MoveDto,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
@@ -62,8 +63,8 @@ class DefaultApi:
|
||||
|
||||
:param game_id: (required)
|
||||
:type game_id: str
|
||||
:param body: (required)
|
||||
:type body: str
|
||||
:param move_dto: (required)
|
||||
:type move_dto: MoveDto
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
@@ -88,7 +89,7 @@ class DefaultApi:
|
||||
|
||||
_param = self._add_move_serialize(
|
||||
game_id=game_id,
|
||||
body=body,
|
||||
move_dto=move_dto,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
@@ -113,7 +114,7 @@ class DefaultApi:
|
||||
def add_move_with_http_info(
|
||||
self,
|
||||
game_id: StrictStr,
|
||||
body: StrictStr,
|
||||
move_dto: MoveDto,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
@@ -132,8 +133,8 @@ class DefaultApi:
|
||||
|
||||
:param game_id: (required)
|
||||
:type game_id: str
|
||||
:param body: (required)
|
||||
:type body: str
|
||||
:param move_dto: (required)
|
||||
:type move_dto: MoveDto
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
@@ -158,7 +159,7 @@ class DefaultApi:
|
||||
|
||||
_param = self._add_move_serialize(
|
||||
game_id=game_id,
|
||||
body=body,
|
||||
move_dto=move_dto,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
@@ -183,7 +184,7 @@ class DefaultApi:
|
||||
def add_move_without_preload_content(
|
||||
self,
|
||||
game_id: StrictStr,
|
||||
body: StrictStr,
|
||||
move_dto: MoveDto,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
@@ -202,8 +203,8 @@ class DefaultApi:
|
||||
|
||||
:param game_id: (required)
|
||||
:type game_id: str
|
||||
:param body: (required)
|
||||
:type body: str
|
||||
:param move_dto: (required)
|
||||
:type move_dto: MoveDto
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
@@ -228,7 +229,7 @@ class DefaultApi:
|
||||
|
||||
_param = self._add_move_serialize(
|
||||
game_id=game_id,
|
||||
body=body,
|
||||
move_dto=move_dto,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
@@ -248,7 +249,7 @@ class DefaultApi:
|
||||
def _add_move_serialize(
|
||||
self,
|
||||
game_id,
|
||||
body,
|
||||
move_dto,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
@@ -274,8 +275,8 @@ class DefaultApi:
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
if body is not None:
|
||||
_body_params = body
|
||||
if move_dto is not None:
|
||||
_body_params = move_dto
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
|
||||
# import models into model package
|
||||
from board_mate_client.models.game_dto import GameDto
|
||||
from board_mate_client.models.move_dto import MoveDto
|
||||
from board_mate_client.models.response_body_game_dto import ResponseBodyGameDto
|
||||
from board_mate_client.models.response_body_string import ResponseBodyString
|
||||
|
||||
87
rpi/board_mate_client/models/move_dto.py
Normal file
87
rpi/board_mate_client/models/move_dto.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
boardmate_api API
|
||||
|
||||
boardmate_api API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class MoveDto(BaseModel):
|
||||
"""
|
||||
MoveDto
|
||||
""" # noqa: E501
|
||||
notation: Optional[StrictStr] = None
|
||||
__properties: ClassVar[List[str]] = ["notation"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of MoveDto from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of MoveDto from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"notation": obj.get("notation")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user