aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/integration/base_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'diplomacy/integration/base_api.py')
-rw-r--r--diplomacy/integration/base_api.py33
1 files changed, 11 insertions, 22 deletions
diff --git a/diplomacy/integration/base_api.py b/diplomacy/integration/base_api.py
index c0dca4e..584310b 100644
--- a/diplomacy/integration/base_api.py
+++ b/diplomacy/integration/base_api.py
@@ -28,9 +28,13 @@ class BaseAPI(metaclass=ABCMeta):
def __init__(self, api_key, connect_timeout=30, request_timeout=60):
""" Constructor
+
:param api_key: The API key to use for sending API requests
:param connect_timeout: The maximum amount of time to wait for the connection to be established
:param request_timeout: The maximum amount of time to wait for the request to be processed
+ :type api_key: str
+ :type connect_timeout: int, optional
+ :type request_timeout: int, optional
"""
self.api_key = api_key
self.http_client = AsyncHTTPClient()
@@ -39,30 +43,14 @@ class BaseAPI(metaclass=ABCMeta):
@gen.coroutine
@abstractmethod
- def list_games_with_players_in_cd(self):
- """ Lists the game on the standard map where a player is in CD and the bots needs to submit orders
- :return: List of GameIdCountryId tuples [(game_id, country_id), (game_id, country_id)]
- """
- raise NotImplementedError()
-
- @gen.coroutine
- @abstractmethod
- def list_games_with_missing_orders(self):
- """ Lists of the game on the standard where the user has not submitted orders yet.
- :return: List of GameIdCountryId tuples [(game_id, country_id), (game_id, country_id)]
- """
- raise NotImplementedError()
-
- @gen.coroutine
- @abstractmethod
- def get_game_and_power(self, game_id, country_id, max_phases=None):
+ def get_game_and_power(self, *args, **kwargs):
""" Returns the game and the power we are playing
- :param game_id: The id of the game object (integer)
- :param country_id: The id of the country for which we want the game state (integer)
- :param max_phases: Optional. If set, improve speed by generating game only using the last 'x' phases.
+ *Arguments are specific to each implementation.*
+
:return: A tuple consisting of
- 1) The diplomacy.Game object from the game state or None if an error occurred
- 2) The power name (e.g. 'FRANCE') referred to by country_id
+
+ #. The diplomacy.Game object or None if an error occurred
+ #. The power name (e.g. 'FRANCE')
"""
raise NotImplementedError()
@@ -70,6 +58,7 @@ class BaseAPI(metaclass=ABCMeta):
@abstractmethod
def set_orders(self, game, power_name, orders, wait=None):
""" Submits orders back to the server
+
:param game: A diplomacy.Game object representing the current state of the game
:param power_name: The name of the power submitting the orders (e.g. 'FRANCE')
:param orders: A list of strings representing the orders (e.g. ['A PAR H', 'F BRE - MAO'])