Skip to content

Add missing API endpoints for puzzles, broadcasts, and users#157

Open
nkc-137 wants to merge 5 commits intolichess-org:masterfrom
nkc-137:feature/missing-api-implementation
Open

Add missing API endpoints for puzzles, broadcasts, and users#157
nkc-137 wants to merge 5 commits intolichess-org:masterfrom
nkc-137:feature/missing-api-implementation

Conversation

@nkc-137
Copy link

@nkc-137 nkc-137 commented Jan 23, 2026

Summary

Adds new client methods and types for puzzle replay/race APIs, introduces a broadcast round reset endpoint, and adds the user note creation endpoint. Includes VCR cassettes/tests and updates README. This PR is to implement a few action items from #6.

Details

  • Added client.puzzles.get_puzzles_to_replay and client.puzzles.get_race with new TypedDicts for replay and race responses in berserk/types/.
  • Added VCR tests and cassettes for puzzle replay and race endpoints.
  • Added client.broadcasts.reset_round and documented it in README.
  • Added client.users.create_note and documented it in README.

Testing

  • Ran make test
configfile: pyproject.toml
plugins: recording-0.13.4, requests-mock-1.12.1
collected 53 items

tests/clients/test_analysis.py .                                                             [  1%]
tests/clients/test_broadcasts.py ...                                                         [  7%]
tests/clients/test_fide.py ..                                                                [ 11%]
tests/clients/test_opening_explorer.py ........                                              [ 26%]
tests/clients/test_puzzles.py ...                                                            [ 32%]
tests/clients/test_teams.py ....                                                             [ 39%]
tests/clients/test_tournaments.py ....                                                       [ 47%]
tests/clients/test_users.py ....                                                             [ 54%]
tests/test_config.py ..                                                                      [ 58%]
tests/test_formats.py .......                                                                [ 71%]
tests/test_models.py ..                                                                      [ 75%]
tests/test_session.py ...                                                                    [ 81%]
tests/test_utils.py ..........                                                               [100%]

======================================== 53 passed in 0.29s ========================================
Checklist when adding a new endpoint
  • Added new endpoint to the README.md
  • Ensured that my endpoint name does not repeat the name of the client. Wrong: client.users.get_user(), Correct: client.users.get()
  • Typed the returned JSON using TypedDicts in berserk/types/, example
  • Written tests for GET endpoints not requiring authentification. Documentation, example
  • Added the endpoint and your name to CHANGELOG.md in the To be released section (to be created if necessary)

Copy link

@zaderrr zaderrr left a comment

Choose a reason for hiding this comment

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

Hi, I worked on a notes endpoint implementation, I didn't check the active PRs well enough and can see you've added the create note endpoint. Just added a comment as it's missing some data for the creation and not pointing to the correct endpoint

Comment on lines +158 to +164
def create_note(self, username: str) -> None:
"""Add a private note available only to you about this account.

:param username: The username of the user to create a note for
"""
path = f"/api/user/{username}/notification"
self._r.post(path)
Copy link

Choose a reason for hiding this comment

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

This doesn't go to the note endpoint, also the note body isn't passed anywhere for the creation.

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