uuid -> id

This commit is contained in:
Eden Kirin
2023-03-31 17:19:26 +02:00
parent 10290dba54
commit edca936325
4 changed files with 35 additions and 35 deletions

View File

@ -42,7 +42,7 @@ class Destination(BaseModel):
class Player(BaseModel):
uuid: str
id: str
name: str
active: bool
position: Position
@ -95,8 +95,8 @@ class FairHopper:
r.raise_for_status()
return GameInfoResponse(**r.json())
def get_player_info(self, uuid: str) -> PlayerInfoResponse:
r = requests.get(self.format_url(f"/player/{uuid}"))
def get_player_info(self, id: str) -> PlayerInfoResponse:
r = requests.get(self.format_url(f"/player/{id}"))
if r.status_code == 403:
raise PlayerInactiveError()
@ -107,20 +107,20 @@ class FairHopper:
return PlayerInfoResponse(**r.json())
def move_left(self, uuid: str) -> PlayerInfoResponse:
return self.move(uuid, Direction.LEFT)
def move_left(self, id: str) -> PlayerInfoResponse:
return self.move(id, Direction.LEFT)
def move_right(self, uuid: str) -> PlayerInfoResponse:
return self.move(uuid, Direction.RIGHT)
def move_right(self, id: str) -> PlayerInfoResponse:
return self.move(id, Direction.RIGHT)
def move_up(self, uuid: str) -> PlayerInfoResponse:
return self.move(uuid, Direction.UP)
def move_up(self, id: str) -> PlayerInfoResponse:
return self.move(id, Direction.UP)
def move_down(self, uuid: str) -> PlayerInfoResponse:
return self.move(uuid, Direction.DOWN)
def move_down(self, id: str) -> PlayerInfoResponse:
return self.move(id, Direction.DOWN)
def move(self, uuid: str, direction: Direction) -> PlayerInfoResponse:
path = f"/player/{uuid}/move/{direction}"
def move(self, id: str, direction: Direction) -> PlayerInfoResponse:
path = f"/player/{id}/move/{direction}"
r = requests.post(self.format_url(path))
if r.status_code == 403: