2019-12-08 22:43:49 +01:00
|
|
|
from typing import List, Optional
|
|
|
|
|
|
|
|
from bemani.data.api.client import APIClient
|
|
|
|
from bemani.data.interfaces import APIProviderInterface
|
|
|
|
|
|
|
|
|
|
|
|
class BaseGlobalData:
|
|
|
|
def __init__(self, api: APIProviderInterface) -> None:
|
|
|
|
self.__localapi = api
|
|
|
|
self.__apiclients: Optional[List[APIClient]] = None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def clients(self) -> List[APIClient]:
|
|
|
|
if self.__apiclients is None:
|
|
|
|
servers = self.__localapi.get_all_servers()
|
2022-10-15 20:56:30 +02:00
|
|
|
self.__apiclients = [
|
2024-01-02 03:46:24 +01:00
|
|
|
APIClient(server.uri, server.token, server.allow_stats, server.allow_scores) for server in servers
|
2022-10-15 20:56:30 +02:00
|
|
|
]
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
return self.__apiclients
|