added more api documentation
new build process
This commit is contained in:
parent
73284ceab8
commit
134cd3a30e
7 changed files with 53 additions and 70 deletions
|
@ -15,14 +15,23 @@ API_URL_SIMON_SAYS = API_URL + "simonSays"
|
|||
class Seeding:
|
||||
@staticmethod
|
||||
def get_park() -> int:
|
||||
"""Get a parkingsapce from the api.
|
||||
:return: An int between 0 and 3
|
||||
"""
|
||||
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
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
return json.loads(requests.get(API_URL_SIMON_SAYS).content)["id"]
|
||||
|
||||
|
||||
|
@ -35,20 +44,32 @@ class Position:
|
|||
|
||||
class DoubleElim:
|
||||
@staticmethod
|
||||
def get_position():
|
||||
def get_position() -> Position:
|
||||
"""Get position of the robot
|
||||
:return: A Position object with robot position
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_POS).content)
|
||||
return Position(response["x"], response["y"], response["degrees"])
|
||||
|
||||
@staticmethod
|
||||
def get_opponent():
|
||||
def get_opponent() -> Position:
|
||||
"""Get position of the opponents robot
|
||||
:return: A Position object with opponents robot position
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_OP).content)
|
||||
return Position(response["x"], response["y"], response["degrees"])
|
||||
|
||||
@staticmethod
|
||||
def get_goal():
|
||||
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
|
||||
"""
|
||||
response = json.loads(requests.get(API_URL_GET_GOAL).content)
|
||||
return Position(response["x"], response["y"], -1)
|
||||
|
||||
@staticmethod
|
||||
def get_items():
|
||||
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}
|
||||
"""
|
||||
return json.loads(requests.get(API_URL_GET_ITEMS).content)
|
||||
|
|
Reference in a new issue