Skip to content

modernize python stack + add type safety#5

Open
amine4567 wants to merge 22 commits intoRetroAchievements:mainfrom
amine4567:modernize-stack
Open

modernize python stack + add type safety#5
amine4567 wants to merge 22 commits intoRetroAchievements:mainfrom
amine4567:modernize-stack

Conversation

@amine4567
Copy link
Copy Markdown

@amine4567 amine4567 commented Jan 10, 2026

  • Use modern python tools
  • Adds pre-commit hooks
  • Add type safety to the outputs of the client by using TypedDict

raise ValueError(
"Invalid kind value. Must be 1 (completed), 2 (dropped) or 3 (expired)."
)
result = self.call_api("API_GetInactiveClaims.php?", {"k": kind}).json()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellectual curiosity: what does this endpoint do?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this endpoint in the official RA API documentation, not sure if it was removed at some point or I invented it ? Either way, removed in 862b849


Params:
u: Username or ULID to query
i: ULID to query
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: This signature is wrong. i is the param for ticket ID.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_users_following_me and get_users_i_follow accept a user param, but PHP ignores this param.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! fixed in 53f3529


def get_user_completion_progress(
self, user: str, count: int = 100, offset: int = 0
) -> GetUserCompletionProgressResponseEntity:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DX: Incorrect return type here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! fixed in 0a4d585


Params:
g: The game ID to query
t: Set to 0 for Latest Masters, 1 for High Scores, default = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs: This may accidentally be flipped backwards.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ULID is missing from nearly every response type that includes user data.

Released: str
IsFinal: bool
ConsoleName: str
RichPresencePatch: str
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the Web API explicitly unsets this field.

Publisher: str
Developer: str
Genre: str
Released: str
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ReleasedAtGranularity.

NumDistinctPlayersHardcore: str


class GetGameExtendedResponse(GetGameExtendedResponseWithoutClaims):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing several fields from the Web API, probably worth double checking.


def get_comments(
self,
game: int,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about other comment types (achievements, user walls, etc)

Also when target is 3, int is the wrong type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants