diff --git a/src/speedruncompy/datatypes/defs.py b/src/speedruncompy/datatypes/defs.py index d890558..bde146a 100644 --- a/src/speedruncompy/datatypes/defs.py +++ b/src/speedruncompy/datatypes/defs.py @@ -331,7 +331,7 @@ class Player(Datatype): id: str name: str url: OptField[str] - powerLevel: OptField[int] + powerLevel: OptField[SitePowerLevel] color1Id: OptField[str] color2Id: OptField[str] """OptField even on full `player`""" @@ -512,9 +512,9 @@ class Run(Datatype): playerIds: list[str] valueIds: list[str] orphaned: OptField[bool] - estimated: OptField[bool] # TODO: Figure out what this means + estimated: OptField[bool] """Only shown in GetModerationRuns""" - issues: OptField[Optional[list[str]]] # TODO: fails when present + issues: OptField[Optional[list[str]]] class ChallengeStanding(Datatype): challengeId: str @@ -809,7 +809,7 @@ class Session(Datatype): boostNextTokenDate: int boostNextTokenAmount: int userFollowerList: list[UserFollower] - enabledExperimentIds: list[str] # May not be this idk + enabledExperimentIds: list[str] # TODO: check challengeModeratorList: Any # undocumented list class ThemeSettings(Datatype): diff --git a/src/speedruncompy/endpoints.py b/src/speedruncompy/endpoints.py index 433cda0..a84551d 100644 --- a/src/speedruncompy/endpoints.py +++ b/src/speedruncompy/endpoints.py @@ -825,6 +825,36 @@ class GetThemeSettings(PostRequest[r_GetThemeSettings]): def __init__(self, **params) -> None: super().__init__("GetThemeSettings", r_GetThemeSettings, **params) +# Supporter +class GetUserSupporterData(PostRequest[r_GetUserSupporterData]): + """Gets supporter data for a user. # TODO: check auth + + ### Mandatory: + - @userUrl + """ + def __init__(self, userUrl: str, **params) -> None: + super().__init__("GetUserSupporterData", r_GetUserSupporterData, userUrl=userUrl, **params) + +class PutUserSupporterNewSubscription(PostRequest[r_PutUserSupporterNewSubscription]): + """Get data used to construct a payment form. + + ## Mandatory: + - @planKey: strEnum ("monthly" or "yearly") + - @userUrl + """ + def __init__(self, planKey: SupportPlanPeriod, userUrl: str, **params) -> None: + super().__init__("PutUserSuppoprterNewSubscription", r_PutUserSupporterNewSubscription, planKey=planKey, userUrl=userUrl, **params) + +class PutGameBoostGrant(PostRequest[r_PutGameBoostGrant]): + """Adds a boost to a game. + + ### Mandatory: + - @gameId + - @anonymous + """ + def __init__(self, gameId: str, anonymous: bool, **params) -> None: + super().__init__("PutGameBoostGrant", r_PutGameBoostGrant, gameId=gameId, anonymous=anonymous, **params) + # To Be Sorted class PutAdvertiseContact(PostRequest[r_Empty]): """Sends a request for contact to SRC for collaboration. @@ -874,15 +904,6 @@ class PutUserBlock(PostRequest[r_Empty]): def __init__(self, block: bool, blockeeId: str, **params) -> None: super().__init__("PutUserBlock", r_Empty, block=block, blockeeId=blockeeId, **params) -class GetUserSupporterData(PostRequest[r_GetUserSupporterData]): - """Gets supporter data for a user. # TODO: check auth - - ### Mandatory: - - @userUrl - """ - def __init__(self, userUrl: str, **params) -> None: - super().__init__("GetUserSupporterData", r_GetUserSupporterData, userUrl=userUrl, **params) - class PutGame(PostRequest[r_PutGame]): # TODO: needs param testing """Add a new game. @@ -896,16 +917,6 @@ class PutGame(PostRequest[r_PutGame]): # TODO: needs param testing def __init__(self, name: str, releaseDate: int, gameTypeIds: list[GameType], seriesId: str, **params) -> None: super().__init__("PutGame", r_PutGame, name=name, releaseDate=releaseDate, gameTypeIds=gameTypeIds, seriesId=seriesId, **params) -class PutGameBoostGrant(PostRequest[r_PutGameBoostGrant]): - """Adds a boost to a game. - - ### Mandatory: - - @gameId - - @anonymous - """ - def __init__(self, gameId: str, anonymous: bool, **params) -> None: - super().__init__("PutGameBoostGrant", r_PutGameBoostGrant, gameId=gameId, anonymous=anonymous, **params) - class PutGameModerator(PostRequest[r_PutGameModerator]): """Add a moderator to a game. diff --git a/src/speedruncompy/enums.py b/src/speedruncompy/enums.py index 604ec74..9c32987 100644 --- a/src/speedruncompy/enums.py +++ b/src/speedruncompy/enums.py @@ -341,3 +341,10 @@ class FitType(IntEnum): FIT = 1 #endregion Theme + +#region Supporter +class SupportPlanPeriod(StrEnum): + MONTHLY = "monthly" + YEARLY = "yearly" + +#endregion Supporter diff --git a/src/speedruncompy/responses.py b/src/speedruncompy/responses.py index c6346c0..6bca7c1 100644 --- a/src/speedruncompy/responses.py +++ b/src/speedruncompy/responses.py @@ -369,6 +369,10 @@ class r_GetUserSupporterData(Datatype): supporterEndDate: int boostEndDate: int +class r_PutUserSupporterNewSubscription(Datatype): + subscription: SupporterSubscription + paymentIntentClientSecret: str + class r_PutAuthLogin(Datatype): loggedIn: bool tokenChallengeSent: OptField[bool]