mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-16 12:02:17 +00:00
🎨 Organize client subdirectories and add __all__
variable
Moves all subdirectories from 'simnet/client' to 'simnet/client/components' and adds the `__all__` variable to all affected files. This change is intended to improve code organization and make it easier to manage exported symbols from these modules.
This commit is contained in:
parent
098c022a55
commit
14b107b5a1
@ -21,6 +21,8 @@ from simnet.utils.types import (
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger("SIMNet.BaseClient")
|
_LOGGER = logging.getLogger("SIMNet.BaseClient")
|
||||||
|
|
||||||
|
__all__ = ("BaseClient",)
|
||||||
|
|
||||||
|
|
||||||
class BaseClient(AsyncContextManager["BaseClient"]):
|
class BaseClient(AsyncContextManager["BaseClient"]):
|
||||||
"""
|
"""
|
||||||
|
@ -10,6 +10,8 @@ from simnet.client.routes import (
|
|||||||
)
|
)
|
||||||
from simnet.utils.enum_ import Region
|
from simnet.utils.enum_ import Region
|
||||||
|
|
||||||
|
__all__ = ("AuthClient",)
|
||||||
|
|
||||||
|
|
||||||
class AuthClient(BaseClient):
|
class AuthClient(BaseClient):
|
||||||
"""
|
"""
|
@ -4,6 +4,8 @@ from simnet.client.routes import RECORD_URL
|
|||||||
from simnet.utils.enum_ import Region, Game
|
from simnet.utils.enum_ import Region, Game
|
||||||
from simnet.utils.types import QueryParamTypes
|
from simnet.utils.types import QueryParamTypes
|
||||||
|
|
||||||
|
__all__ = ("BaseChronicleClient",)
|
||||||
|
|
||||||
|
|
||||||
class BaseChronicleClient(BaseClient):
|
class BaseChronicleClient(BaseClient):
|
||||||
"""The base class for the Chronicle API client.
|
"""The base class for the Chronicle API client.
|
@ -1,7 +1,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from typing import Optional, Any, List, Dict
|
from typing import Optional, Any, List, Dict
|
||||||
|
|
||||||
from simnet.client.chronicle.base import BaseChronicleClient
|
from simnet.client.components.chronicle.base import BaseChronicleClient
|
||||||
from simnet.errors import DataNotPublic, BadRequest
|
from simnet.errors import DataNotPublic, BadRequest
|
||||||
from simnet.models.genshin.chronicle.abyss import SpiralAbyss, SpiralAbyssPair
|
from simnet.models.genshin.chronicle.abyss import SpiralAbyss, SpiralAbyssPair
|
||||||
from simnet.models.genshin.chronicle.characters import Character
|
from simnet.models.genshin.chronicle.characters import Character
|
||||||
@ -14,8 +14,10 @@ from simnet.models.genshin.chronicle.stats import (
|
|||||||
from simnet.utils.enum_ import Game
|
from simnet.utils.enum_ import Game
|
||||||
from simnet.utils.player import recognize_genshin_server, recognize_region
|
from simnet.utils.player import recognize_genshin_server, recognize_region
|
||||||
|
|
||||||
|
__all__ = ("GenshinBattleChronicleClient",)
|
||||||
|
|
||||||
class GenshinChronicleClient(BaseChronicleClient):
|
|
||||||
|
class GenshinBattleChronicleClient(BaseChronicleClient):
|
||||||
"""A client for retrieving data from Genshin's battle chronicle component.
|
"""A client for retrieving data from Genshin's battle chronicle component.
|
||||||
|
|
||||||
This class is used to retrieve various data objects from StarRail's battle chronicle component,
|
This class is used to retrieve various data objects from StarRail's battle chronicle component,
|
@ -1,6 +1,6 @@
|
|||||||
from typing import Optional, Mapping, Dict, Any
|
from typing import Optional, Mapping, Dict, Any
|
||||||
|
|
||||||
from simnet.client.chronicle.base import BaseChronicleClient
|
from simnet.client.components.chronicle.base import BaseChronicleClient
|
||||||
from simnet.errors import BadRequest, DataNotPublic
|
from simnet.errors import BadRequest, DataNotPublic
|
||||||
from simnet.models.starrail.chronicle.characters import StarShipDetailCharacters
|
from simnet.models.starrail.chronicle.characters import StarShipDetailCharacters
|
||||||
from simnet.models.starrail.chronicle.notes import StarRailNote
|
from simnet.models.starrail.chronicle.notes import StarRailNote
|
||||||
@ -8,6 +8,8 @@ from simnet.models.starrail.chronicle.stats import StarRailUserStats
|
|||||||
from simnet.utils.enum_ import Game
|
from simnet.utils.enum_ import Game
|
||||||
from simnet.utils.player import recognize_starrail_server, recognize_region
|
from simnet.utils.player import recognize_starrail_server, recognize_region
|
||||||
|
|
||||||
|
__all__ = ("StarRailBattleChronicleClient",)
|
||||||
|
|
||||||
|
|
||||||
class StarRailBattleChronicleClient(BaseChronicleClient):
|
class StarRailBattleChronicleClient(BaseChronicleClient):
|
||||||
"""A client for retrieving data from StarRail's battle chronicle component.
|
"""A client for retrieving data from StarRail's battle chronicle component.
|
@ -6,6 +6,8 @@ from simnet.client.routes import GACHA_INFO_URL
|
|||||||
from simnet.utils.enum_ import Game
|
from simnet.utils.enum_ import Game
|
||||||
from simnet.utils.lang import create_short_lang_code
|
from simnet.utils.lang import create_short_lang_code
|
||||||
|
|
||||||
|
__all__ = ("BaseWishClient",)
|
||||||
|
|
||||||
|
|
||||||
class BaseWishClient(BaseClient):
|
class BaseWishClient(BaseClient):
|
||||||
"""The base class for the Wish API client."""
|
"""The base class for the Wish API client."""
|
@ -1,14 +1,17 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
|
|
||||||
from simnet.client.wish.base import BaseWishClient
|
from simnet.client.components.wish.base import BaseWishClient
|
||||||
from simnet.models.genshin.wish import Wish
|
from simnet.models.genshin.wish import Wish
|
||||||
from simnet.utils.enum_ import Game
|
from simnet.utils.enum_ import Game
|
||||||
from simnet.utils.paginator import WishPaginator
|
from simnet.utils.paginator import WishPaginator
|
||||||
|
|
||||||
|
|
||||||
class WishClient(BaseWishClient):
|
__all__ = ("GenshinWishClient",)
|
||||||
"""The WishClient class for making requests towards the Wish API."""
|
|
||||||
|
|
||||||
|
class GenshinWishClient(BaseWishClient):
|
||||||
|
"""The GenshinWishClient class for making requests towards the Wish API."""
|
||||||
|
|
||||||
async def wish_history(
|
async def wish_history(
|
||||||
self,
|
self,
|
@ -1,13 +1,15 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
from simnet.client.wish.base import BaseWishClient
|
from simnet.client.components.wish.base import BaseWishClient
|
||||||
from simnet.models.starrail.wish import StarRailWish
|
from simnet.models.starrail.wish import StarRailWish
|
||||||
from simnet.utils.enum_ import Game
|
from simnet.utils.enum_ import Game
|
||||||
from simnet.utils.paginator import WishPaginator
|
from simnet.utils.paginator import WishPaginator
|
||||||
|
|
||||||
|
__all__ = ("StarRailWishClient",)
|
||||||
|
|
||||||
class WishClient(BaseWishClient):
|
|
||||||
"""The WishClient class for making requests towards the Wish API."""
|
class StarRailWishClient(BaseWishClient):
|
||||||
|
"""The StarRailWishClient class for making requests towards the Wish API."""
|
||||||
|
|
||||||
async def wish_history(
|
async def wish_history(
|
||||||
self,
|
self,
|
@ -2,6 +2,8 @@ from typing import Optional
|
|||||||
|
|
||||||
from httpx import Cookies as _Cookies
|
from httpx import Cookies as _Cookies
|
||||||
|
|
||||||
|
__all__ = ("Cookies",)
|
||||||
|
|
||||||
|
|
||||||
class Cookies(_Cookies):
|
class Cookies(_Cookies):
|
||||||
"""An extension of the `httpx.Cookies` class that includes additional functionality."""
|
"""An extension of the `httpx.Cookies` class that includes additional functionality."""
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from simnet.client.account.auth import AuthClient
|
from simnet.client.components.auth import AuthClient
|
||||||
from simnet.client.chronicle.genshin import GenshinChronicleClient
|
from simnet.client.components.chronicle.genshin import GenshinBattleChronicleClient
|
||||||
from simnet.client.wish.genshin import WishClient
|
from simnet.client.components.wish.genshin import GenshinWishClient
|
||||||
|
|
||||||
__all__ = ("GenshinClient",)
|
__all__ = ("GenshinClient",)
|
||||||
|
|
||||||
|
|
||||||
class GenshinClient(GenshinChronicleClient, WishClient, AuthClient):
|
class GenshinClient(GenshinBattleChronicleClient, GenshinWishClient, AuthClient):
|
||||||
"""A simple http client for StarRail endpoints."""
|
"""A simple http client for StarRail endpoints."""
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from simnet.client.account.auth import AuthClient
|
from simnet.client.components.auth import AuthClient
|
||||||
from simnet.client.chronicle.genshin import GenshinChronicleClient
|
from simnet.client.components.chronicle.genshin import GenshinBattleChronicleClient
|
||||||
from simnet.client.wish.genshin import WishClient
|
from simnet.client.components.wish.genshin import GenshinWishClient
|
||||||
from simnet.utils.enum_ import Region
|
from simnet.utils.enum_ import Region
|
||||||
from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes
|
from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes
|
||||||
|
|
||||||
class GenshinClient(GenshinChronicleClient, WishClient, AuthClient):
|
class GenshinClient(GenshinBattleChronicleClient, GenshinWishClient, AuthClient):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cookies: Optional[CookieTypes] = None,
|
cookies: Optional[CookieTypes] = None,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
from httpx import Headers as _Headers
|
from httpx import Headers as _Headers
|
||||||
|
|
||||||
|
__all__ = ("Headers",)
|
||||||
|
|
||||||
|
|
||||||
class Headers(_Headers):
|
class Headers(_Headers):
|
||||||
"""An extension of the `httpx.Headers` class that includes additional functionality."""
|
"""An extension of the `httpx.Headers` class that includes additional functionality."""
|
||||||
|
@ -7,6 +7,21 @@ from simnet.utils.enum_ import Region, Game
|
|||||||
|
|
||||||
URLTypes = Union["URL", str]
|
URLTypes = Union["URL", str]
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"URL",
|
||||||
|
"BaseRoute",
|
||||||
|
"Route",
|
||||||
|
"InternationalRoute",
|
||||||
|
"GameRoute",
|
||||||
|
"RECORD_URL",
|
||||||
|
"GACHA_INFO_URL",
|
||||||
|
"AUTH_URL",
|
||||||
|
"GET_COOKIES_TOKEN_BY_STOKEN_URL",
|
||||||
|
"GET_LTOKEN_BY_STOKEN_URL",
|
||||||
|
"AUTH_KEY_URL",
|
||||||
|
"HK4E_LOGIN_URL",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class URL(_URL):
|
class URL(_URL):
|
||||||
"""A subclass of httpx's URL class, with additional convenience methods for URL manipulation."""
|
"""A subclass of httpx's URL class, with additional convenience methods for URL manipulation."""
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from simnet.client.account.auth import AuthClient
|
from simnet.client.components.auth import AuthClient
|
||||||
from simnet.client.chronicle.starrail import StarRailBattleChronicleClient
|
from simnet.client.components.chronicle.starrail import StarRailBattleChronicleClient
|
||||||
from simnet.client.wish.starrail import WishClient
|
from simnet.client.components.wish.starrail import StarRailWishClient
|
||||||
|
|
||||||
__all__ = ("StarRailClient",)
|
__all__ = ("StarRailClient",)
|
||||||
|
|
||||||
|
|
||||||
class StarRailClient(StarRailBattleChronicleClient, WishClient, AuthClient):
|
class StarRailClient(StarRailBattleChronicleClient, StarRailWishClient, AuthClient):
|
||||||
"""A simple http client for StarRail endpoints."""
|
"""A simple http client for StarRail endpoints."""
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from simnet.client.account.auth import AuthClient
|
from simnet.client.components.auth import AuthClient
|
||||||
from simnet.client.chronicle.starrail import StarRailBattleChronicleClient
|
from simnet.client.components.chronicle.starrail import StarRailBattleChronicleClient
|
||||||
from simnet.client.wish.starrail import WishClient
|
from simnet.client.components.wish.starrail import StarRailWishClient
|
||||||
from simnet.utils.enum_ import Region
|
from simnet.utils.enum_ import Region
|
||||||
from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes
|
from simnet.utils.types import CookieTypes, HeaderTypes, TimeoutTypes
|
||||||
|
|
||||||
class StarRailClient(StarRailBattleChronicleClient, WishClient, AuthClient):
|
class StarRailClient(StarRailBattleChronicleClient, StarRailWishClient, AuthClient):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cookies: Optional[CookieTypes] = None,
|
cookies: Optional[CookieTypes] = None,
|
||||||
|
Loading…
Reference in New Issue
Block a user