diff --git a/aiosu/v2/client.py b/aiosu/v2/client.py index c8d0fa6..0b0a0b0 100644 --- a/aiosu/v2/client.py +++ b/aiosu/v2/client.py @@ -1761,19 +1761,18 @@ async def get_beatmapset_discussion_votes( @requires_scope(Scopes.PUBLIC) async def get_score( self, - score_id: int, + legacy_score_id: int, mode: Gamemode, **kwargs: Any, ) -> Union[Score, LazerScore]: r"""Gets data about a score. - :param score_id: The ID of the score - :type score_id: int + :param legacy_score_id: The ID of the score + :type legacy_score_id: int :param mode: The gamemode to search for :type mode: aiosu.models.gamemode.Gamemode :param \**kwargs: See below - :Keyword Arguments: * *new_format* (``bool``) -- Optional, whether to use the new score format, defaults to ``False`` @@ -1783,7 +1782,7 @@ async def get_score( :return: Score data object :rtype: aiosu.models.score.Score """ - url = f"{self.base_url}/api/v2/scores/{mode}/{score_id}" + url = f"{self.base_url}/api/v2/scores/{mode}/{legacy_score_id}" headers = {} new_format = kwargs.pop("new_format", False) if new_format: @@ -1794,6 +1793,29 @@ async def get_score( return LazerScore.model_validate(json) return Score.model_validate(json) + @prepare_token + @check_token + @requires_scope(Scopes.PUBLIC) + async def get_score_lazer( + self, + score_id: int, + ) -> LazerScore: + r"""Gets data about a score. + + :param score_id: The ID of the score + :type score_id: int + + :raises APIException: Contains status code and error message + :raises RefreshTokenExpiredError: If the client refresh token has expired + :return: LazerScore data object + :rtype: aiosu.models.score.LazerScore + """ + url = f"{self.base_url}/api/v2/scores/{score_id}" + headers = {"x-api-version": "20220705"} + + json = await self._request("GET", url, headers=headers) + return LazerScore.model_validate(json) + @prepare_token @check_token @requires_scope(Scopes.PUBLIC) diff --git a/tests/test_v2/test_client.py b/tests/test_v2/test_client.py index 771ce63..a8365f3 100644 --- a/tests/test_v2/test_client.py +++ b/tests/test_v2/test_client.py @@ -229,12 +229,17 @@ async def test_generated(status_code, content_type, token, mocker): generate_test( aiosu.v2.Client.get_score, STATUS_CAN_404, - func_kwargs={"score_id": 4220635589, "mode": "osu"}, + func_kwargs={"legacy_score_id": 4220635589, "mode": "osu"}, ), generate_test( aiosu.v2.Client.get_score, STATUS_CAN_404, - func_kwargs={"score_id": 4220635589, "mode": "osu", "new_format": True}, + func_kwargs={"legacy_score_id": 4220635589, "mode": "osu", "new_format": True}, + ), + generate_test( + aiosu.v2.Client.get_score_lazer, + STATUS_CAN_404, + func_kwargs={"score_id": 1581778626}, ), generate_test( aiosu.v2.Client.get_score_replay,