|
5 | 5 | from .. import models |
6 | 6 | from ..formats import NDJSON |
7 | 7 | from .base import BaseClient |
8 | | -from ..types import PuzzleRace |
| 8 | +from ..types import Puzzle, PuzzleRace |
9 | 9 |
|
10 | 10 |
|
11 | 11 | class Puzzles(BaseClient): |
12 | 12 | """Client for puzzle-related endpoints.""" |
13 | 13 |
|
14 | | - def get_daily(self) -> Dict[str, Any]: |
| 14 | + def get_daily(self) -> Puzzle: |
15 | 15 | """Get the current daily Lichess puzzle. |
16 | 16 |
|
17 | 17 | :return: current daily puzzle |
18 | 18 | """ |
19 | 19 | path = "/api/puzzle/daily" |
20 | | - return self._r.get(path) |
| 20 | + return cast(Puzzle, self._r.get(path)) |
21 | 21 |
|
22 | | - def get_next(self) -> Dict[str, Any]: |
| 22 | + def get_next(self) -> Puzzle: |
23 | 23 | """Get the next puzzle for the authenticated user. |
24 | 24 |
|
25 | 25 | :return: next puzzle |
26 | 26 | """ |
27 | 27 | path = "/api/puzzle/next" |
28 | | - return self._r.get(path) |
| 28 | + return cast(Puzzle, self._r.get(path)) |
29 | 29 |
|
30 | | - def get(self, id: str) -> Dict[str, Any]: |
| 30 | + def get(self, id: str) -> Puzzle: |
31 | 31 | """Get a puzzle by its id. |
32 | 32 |
|
33 | 33 | :param id: the id of the puzzle to retrieve |
34 | 34 | :return: the puzzle |
35 | 35 | """ |
36 | 36 | path = f"/api/puzzle/{id}" |
37 | | - return self._r.get(path) |
| 37 | + return cast(Puzzle, self._r.get(path)) |
38 | 38 |
|
39 | 39 | def get_puzzle_activity( |
40 | 40 | self, max: int | None = None, before: int | None = None |
|
0 commit comments