Fix api documentation
This commit is contained in:
parent
7de2d921d8
commit
210d377e9b
2 changed files with 16 additions and 1 deletions
|
@ -19,21 +19,27 @@ class Seeding:
|
|||
@staticmethod
|
||||
def get_park() -> int:
|
||||
"""Get a parkingsapce from the api.
|
||||
|
||||
:return: An int between 0 and 3
|
||||
:rtype: int
|
||||
"""
|
||||
return json.loads(requests.get(API_URL_GET_PARK).content)["id"]
|
||||
|
||||
@staticmethod
|
||||
def pay_park() -> bool:
|
||||
"""Pay for parking.
|
||||
|
||||
:return: True if successful, False if not successful
|
||||
:rtype: bool
|
||||
"""
|
||||
return requests.get(API_URL_PAY_PARK).status_code == 200
|
||||
|
||||
@staticmethod
|
||||
def simon_says() -> int:
|
||||
"""Get next simon says zone from the api.
|
||||
|
||||
:return: An int between 0 and 3 or -1 after making this request 5 times.
|
||||
:rtype: int
|
||||
"""
|
||||
return json.loads(requests.get(API_URL_SIMON_SAYS).content)["id"]
|
||||
|
||||
|
@ -53,7 +59,9 @@ class DoubleElim:
|
|||
@staticmethod
|
||||
def get_position() -> Position:
|
||||
"""Get position of the robot
|
||||
|
||||
:return: A Position object with robot position
|
||||
:rtype: Position
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_POS).content)
|
||||
return Position(response["x"], response["y"], response["degrees"])
|
||||
|
@ -61,7 +69,9 @@ class DoubleElim:
|
|||
@staticmethod
|
||||
def get_opponent() -> Position:
|
||||
"""Get position of the opponents robot
|
||||
|
||||
:return: A Position object with opponents robot position
|
||||
:rtype: Position
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_OP).content)
|
||||
return Position(response["x"], response["y"], response["degrees"])
|
||||
|
@ -69,7 +79,9 @@ class DoubleElim:
|
|||
@staticmethod
|
||||
def get_goal() -> Position:
|
||||
"""Get position of the goal
|
||||
|
||||
:return: A Position object with x and y coordinates of the goal, rotation is always -1
|
||||
:rtype: Position
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_GOAL).content)
|
||||
return Position(response["x"], response["y"], -1)
|
||||
|
@ -77,6 +89,8 @@ class DoubleElim:
|
|||
@staticmethod
|
||||
def get_items() -> list:
|
||||
"""Get a list with all current items
|
||||
|
||||
:return: A list will all items currently on the game field. Items are dictionaries that look like: {"id": 0}
|
||||
:rtype: list
|
||||
"""
|
||||
return json.loads(requests.get(API_URL_GET_ITEMS).content)
|
||||
|
|
3
docs/.gitignore
vendored
3
docs/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
build
|
||||
build
|
||||
logs.db
|
Reference in a new issue