feat(beatmap): implement get beatmap arrtibutes

This commit is contained in:
MingxuanGame
2025-07-26 17:31:23 +00:00
parent ef977d1c2d
commit 900a17f815
16 changed files with 425 additions and 171 deletions

View File

@@ -1,14 +1,19 @@
from __future__ import annotations
from app.database.beatmap import BeatmapResp
from typing import TYPE_CHECKING
from ._base import BaseFetcher
from httpx import AsyncClient
if TYPE_CHECKING:
from app.database.beatmap import BeatmapResp
class BeatmapFetcher(BaseFetcher):
async def get_beatmap(self, beatmap_id: int) -> BeatmapResp:
async def get_beatmap(self, beatmap_id: int) -> "BeatmapResp":
from app.database.beatmap import BeatmapResp
async with AsyncClient() as client:
response = await client.get(
f"https://osu.ppy.sh/api/v2/beatmaps/{beatmap_id}",