Skip to content

Commit 82a9fdc

Browse files
authored
Merge pull request #130 from JAMoreno-Larios/jaml_export_imports
2 parents fa24e10 + c507895 commit 82a9fdc

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ Changelog
44
To be released
55
--------------
66

7+
78
* Deprecate Python 3.9 support - minimum required version is now Python 3.10+. This does not mean the library will not work with Python 3.9, but it will not be tested against it anymore.
89

910
* Added ``pgn_in_json`` parameter to ``client.games.export``.
1011
* Implement `broadcasts.get_top()` endpoint; typing fixes and validation.
1112
* Added ``client.relations.block`` and ``client.relations.unblock`` for blocking/unblocking users.
13+
* Implemented ``/api/games/export/imports`` under
14+
``client.games.export_imported``.
1215

1316
Thanks to all the contributors who helped to this release:
1417
- @hsheth2
1518
- @DoraFgr
1619
- @MrElyazid
1720
- @gameroman
21+
- @JAMoreno-Larios
1822

1923
v0.14.0 (2025-08-26)
2024
--------------------

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Most of the API is available:
151151
client.games.export_ongoing_by_player
152152
client.games.export_by_player
153153
client.games.export_multi
154+
client.games.export_imported
154155
client.games.get_among_players
155156
client.games.stream_games_by_ids
156157
client.games.add_game_ids_to_stream

berserk/clients/games.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,14 @@ def import_game(self, pgn: str) -> Dict[str, Any]:
317317
"pgn": pgn,
318318
}
319319
return self._r.post(path, data=payload)
320+
321+
def export_imported(self) -> str:
322+
"""
323+
Export all the imported games by the currently logged in user
324+
as a PGN.
325+
Requires OAuth2 authorization.
326+
327+
:return: the exported games in a single string
328+
"""
329+
path = "/api/games/export/imports"
330+
return self._r.get(path, fmt=PGN, stream=False)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import berserk
2+
import pytest
3+
4+
BASE_URL = "http://bdit_lila:8080"
5+
6+
7+
@pytest.fixture(scope="module")
8+
def client():
9+
session = berserk.TokenSession("lip_bobby")
10+
client = berserk.Client(session, base_url=BASE_URL)
11+
yield client
12+
13+
14+
def test_export_imported_games(client):
15+
res = client.games.export_imported()
16+
assert isinstance(res, str)

0 commit comments

Comments
 (0)