diff --git a/src/speedruncompy/datatypes/defs.py b/src/speedruncompy/datatypes/defs.py index cba7509..5d4007b 100644 --- a/src/speedruncompy/datatypes/defs.py +++ b/src/speedruncompy/datatypes/defs.py @@ -334,7 +334,6 @@ class News(Datatype): class Player(Datatype): """Fields from `User` present in `playerLists`. May also be an unregistered player, use property `_is_registered`""" - # Actual OptFields (always present in non-anon players) marked #OPT id: str name: str url: OptField[str] @@ -348,6 +347,7 @@ class Player(Datatype): """OptField even on full `player`""" def _is_user(self): return not self.id.startswith("u-") + # NOTE: `minimal regex: u-[a-f0-9]{8}-?[a-f0-9]{4}-?5[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}` _is_registered = property(fget=_is_user) """Checks if a player has an account or is a text label""" @@ -363,7 +363,7 @@ class User(Datatype): color2Id: OptField[str] colorAnimate: OptField[int] areaId: str - isSupporter: OptField[bool] # TODO: ? + isSupporter: OptField[bool] avatarDecoration: OptField[dict[str, bool]] # {enabled: bool}, TODO add type for this later iconType: IconType onlineDate: int @@ -434,7 +434,7 @@ class GameOrdering(Datatype): defaultGroups: list[GameOrderGroup] supporterGroups: list[GameOrderGroup] -class UserProfile(Datatype): +class UserProfile(Datatype): # TODO: check where this exists (if anywhere?) userId: str bio: OptField[str] @@ -862,6 +862,10 @@ class TicketNote(Datatype): isMessage: bool isRead: bool +class UserCount(Datatype): + userId: str + count: int + class UserBlock(Datatype): blockerId: str blockeeId: str @@ -914,6 +918,30 @@ class UserSettings(Datatype): staticAssets: list[StaticAsset] staticAssetUpdates: list[StaticAssetUpdate] +class SupporterCredit(Datatype): + id: str + userId: str + providerId: int # enum + createdAt: int + updatedAt: int + creditType: int # enum + amount: int + currency: str + receivedAt: int + subscriptionId: str + periodStartsAt: int + periodEndsAt: int + providerItemId: str + +class SupporterCode(Datatype): + id: str + code: str + description: str + duration: int + userId: str + createdAt: int + updatedAt: int + class SupporterSubscription(Datatype): id: str userId: str diff --git a/src/speedruncompy/responses.py b/src/speedruncompy/responses.py index c48beea..1f17ed5 100644 --- a/src/speedruncompy/responses.py +++ b/src/speedruncompy/responses.py @@ -113,7 +113,7 @@ class r_GetGameSummary(Datatype): theme: Theme threadList: list[Thread] users: list[User] - challengeList: list[Challenge] # TODO: Check (Any) + challengeList: list[Challenge] challengeCount: int guideCount: int levelCount: int @@ -349,12 +349,12 @@ class r_GetThreadReadStatus(Datatype): class r_GetTickets(Datatype): ticketList: list[Ticket] ticketNoteList: list[TicketNote] - """May only be accessible to admins""" + """Admins can see all notes, users can see messages here.""" pagination: Pagination userList: list[User] gameList: list[Game] - userModCountList: list[Any] # TODO: document - userRunCountList: list[Any] # TODO: document + userModCountList: list[UserCount] + userRunCountList: list[UserCount] class r_GetUserBlocks(Datatype): userBlocks: list[UserBlock] @@ -368,9 +368,9 @@ class r_GetUserSettings(Datatype): gameList: list[Game] themeList: list[Theme] titleList: list[Title] - supporterCreditList: list[Any] # TODO: document - supporterCodeList: list[Any] # TODO: document - supporterSubscription: OptField[Any] + supporterCreditList: list[SupporterCredit] + supporterCodeList: list[SupporterCode] + supporterSubscription: OptField[SupporterSubscription] experimentList: Any enabledExperimentIds: Any