Skip to content

Commit

Permalink
Amend some type TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
ManicJamie committed May 4, 2024
1 parent 94d054c commit 0de0dad
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
34 changes: 31 additions & 3 deletions src/speedruncompy/datatypes/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"""

Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/speedruncompy/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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

Expand Down

0 comments on commit 0de0dad

Please sign in to comment.