-
-
Notifications
You must be signed in to change notification settings - Fork 63
Add broadcast endpoints #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add broadcast endpoints #87
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds three new broadcast endpoints to the berserk library: get_top, get_by_user, and reset_round. These endpoints provide access to top broadcast listings, user-specific broadcasts, and broadcast round reset functionality respectively.
Key changes:
- Added three new broadcast client methods with proper type annotations
- Created comprehensive TypedDict definitions for broadcast-related data structures
- Implemented comprehensive test coverage for the new endpoints
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
berserk/clients/broadcasts.py |
Implements the three new broadcast endpoints with proper parameter validation and return types |
berserk/types/broadcast.py |
Defines comprehensive TypedDict structures for broadcast data including pagination, tour info, and round details |
berserk/types/__init__.py |
Exports the new PaginatedTopBroadcasts type for public API usage |
berserk/__init__.py |
Adds the new type to the main package exports |
tests/clients/test_broadcasts.py |
Provides comprehensive test coverage for all new endpoints including type validation and parameter passing |
README.rst |
Documents the new endpoints in the API reference |
CHANGELOG.rst |
Records the new features and contributor acknowledgments |
| from berserk import Client, PaginatedTopBroadcasts | ||
| from utils import validate, skip_if_older_3_dot_10 | ||
|
|
||
| import requests_mock |
Copilot
AI
Aug 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requests_mock import is duplicated. It's already imported on line 2, so this duplicate import should be removed.
| import requests_mock |
| :param page: page number. Defaults to 1 | ||
| :param html: Convert the "description" field from markdown to HTML | ||
| """ | ||
| path = f"https://lichess.org/api/broadcast/by/{username}" |
Copilot
AI
Aug 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path should not include the full URL with domain. It should be a relative path like f"api/broadcast/by/{username}" to be consistent with other endpoints in the same class.
| path = f"https://lichess.org/api/broadcast/by/{username}" | |
| path = f"api/broadcast/by/{username}" |
|
|
||
| class BroadcastByUserCurrentPageResult(TypedDict, total=False): | ||
| round: BroadcastRoundInfo | ||
| tour: BroadcastTourInfo |
Copilot
AI
Aug 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type should be BroadcastTour instead of BroadcastTourInfo. Looking at the structure, this should match the same tour type used in BroadcastWithLastRound.
| tour: BroadcastTourInfo | |
| tour: BroadcastTour |
Checklist when adding a new endpoint
README.mdclient.users.get_user(), Correct:client.users.get()berserk/types/, exampleCHANGELOG.mdin theTo be releasedsection (to be created if necessary)