diff --git a/compLib/Api.py b/compLib/Api.py index a96332a..e59f646 100644 --- a/compLib/Api.py +++ b/compLib/Api.py @@ -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) diff --git a/docs/.gitignore b/docs/.gitignore index c795b05..1e0c211 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1 +1,2 @@ -build \ No newline at end of file +build +logs.db \ No newline at end of file