1
0
mirror of synced 2024-11-15 02:17:36 +01:00
bemaniutils/bemani/api/objects/base.py

29 lines
951 B
Python

from typing import List, Any, Dict
from bemani.api.exceptions import APIException
from bemani.common import APIConstants, GameConstants
from bemani.data import Data
class BaseObject:
"""
A base class which represents a fetchable API object. Every fetchable object
will subclass from this and implement one or more version fetches. These
are dynamically looked up by the version number provided by the client, so
objects can control which versions they reply to by subclassing or ignoring
various fetch versions.
"""
def __init__(
self, data: Data, game: GameConstants, version: int, omnimix: bool
) -> None:
self.data = data
self.game = game
self.version = version
self.omnimix = omnimix
def fetch_v1(
self, idtype: APIConstants, ids: List[str], params: Dict[str, Any]
) -> Any:
raise APIException("Object fetch not supported for this version!")