dataflow.api.general_games_api¶
General API system for all haive games.
This module provides a general-purpose API that automatically discovers all available games and creates endpoints for each one, with OpenAPI documentation and game selection capabilities.
Attributes¶
Classes¶
Information about an available game. |
|
Request for creating a new game. |
|
General API system that discovers and manages all games. |
Functions¶
|
Create a general game API that discovers all games. |
Module Contents¶
- class dataflow.api.general_games_api.GameInfo(/, **data: Any)¶
Bases:
pydantic.BaseModelInformation about an available game.
- class dataflow.api.general_games_api.GameSelectionRequest(/, **data: Any)¶
Bases:
pydantic.BaseModelRequest for creating a new game.
- class dataflow.api.general_games_api.GeneralGameAPI(app: fastapi.FastAPI, games_package: str = 'haive.games', route_prefix: str = '/api/games', ws_route_prefix: str = '/ws/games', exclude_games: list[str] | None = None)¶
General API system that discovers and manages all games.
- app¶
- exclude_games = ['go', 'among_us']¶
- games_package = 'haive.games'¶
- route_prefix = '/api/games'¶
- ws_route_prefix = '/ws/games'¶
- dataflow.api.general_games_api.create_general_game_api(app: fastapi.FastAPI | None = None, **kwargs) tuple[fastapi.FastAPI, GeneralGameAPI]¶
Create a general game API that discovers all games.
- Parameters:
app – Optional FastAPI app (creates one if not provided)
**kwargs – Additional arguments for GeneralGameAPI
- Returns:
Tuple of (FastAPI app, GeneralGameAPI instance)
Examples
>>> app, game_api = create_general_game_api() >>> # Now you have endpoints for all games!
- dataflow.api.general_games_api.Agent = None¶
- dataflow.api.general_games_api.BaseGameConfig = None¶
- dataflow.api.general_games_api.GameAPI = None¶
- dataflow.api.general_games_api.logger¶