Skip to content

Commit

Permalink
Add Account V2
Browse files Browse the repository at this point in the history
  • Loading branch information
NavisGames authored and raimannma committed Jan 18, 2025
1 parent 7088f08 commit cece0ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions valo_api/endpoints_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from PIL import Image

from valo_api.endpoint import Endpoint
from valo_api.responses.account_details import AccountDetailsV1
from valo_api.responses.account_details import AccountDetailsV1, AccountDetailsV2
from valo_api.responses.competitive_updates_raw import CompetitiveUpdatesRawV1
from valo_api.responses.content import ContentV1
from valo_api.responses.leaderboard import LeaderboardPlayerV1, LeaderboardV2
Expand Down Expand Up @@ -187,7 +187,8 @@ class EndpointsConfig(Enum):
ACCOUNT_BY_NAME = Endpoint(
path="/valorant/{version}/account/{name}/{tag}",
f_name="get_account_details_by_name",
return_type=AccountDetailsV1,
versions=["v1", "v2"],
return_type=Union[AccountDetailsV1, AccountDetailsV2],
kwargs=OrderedDict(
[("version", str), ("name", str), ("tag", str), ("force_update", bool)]
),
Expand All @@ -196,7 +197,8 @@ class EndpointsConfig(Enum):
ACCOUNT_BY_PUUID = Endpoint(
path="/valorant/{version}/by-puuid/account/{puuid}",
f_name="get_account_details_by_puuid",
return_type=AccountDetailsV1,
versions=["v1", "v2"],
return_type=Union[AccountDetailsV1, AccountDetailsV2],
kwargs=OrderedDict([("version", str), ("puuid", str), ("force_update", bool)]),
query_args=OrderedDict([("force", "{force_update}")]),
)
Expand Down
12 changes: 12 additions & 0 deletions valo_api/responses/account_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ class AccountDetailsV1(DictStruct):
card: Optional[AccountCardV1] = None
last_update: Optional[str] = None
last_update_raw: Optional[int] = None


class AccountDetailsV2(DictStruct):
puuid: str
region: str
account_level: int
name: str
tag: str
card: str
title: str
platforms: list[str]
updated_at: str

0 comments on commit cece0ed

Please sign in to comment.