Skip to content

Commit e57ecc4

Browse files
committed
SDK-3110: Deprecate FriendInfo and replace with UserInfo
1 parent 0a20629 commit e57ecc4

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/galaxy/api/plugin.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from galaxy.api.errors import ImportInProgress, UnknownError
1212
from galaxy.api.jsonrpc import ApplicationError, NotificationClient, Server
1313
from galaxy.api.types import (
14-
Achievement, Authentication, FriendInfo, Game, GameLibrarySettings, GameTime, LocalGame, NextStep, UserPresence
14+
Achievement, Authentication, Game, GameLibrarySettings, GameTime, LocalGame, NextStep, UserInfo, UserPresence
1515
)
1616
from galaxy.task_manager import TaskManager
1717

@@ -383,10 +383,10 @@ def tick(self):
383383
params = {"local_game": local_game}
384384
self._notification_client.notify("local_game_status_changed", params)
385385

386-
def add_friend(self, user: FriendInfo) -> None:
386+
def add_friend(self, user: UserInfo) -> None:
387387
"""Notify the client to add a user to friends list of the currently authenticated user.
388388
389-
:param user: FriendInfo of a user that the client will add to friends list
389+
:param user: UserInfo of a user that the client will add to friends list
390390
"""
391391
params = {"friend_info": user}
392392
self._notification_client.notify("friend_added", params)
@@ -747,7 +747,7 @@ async def launch_platform_client(self) -> None:
747747
This method is called by the GOG Galaxy Client."""
748748
raise NotImplementedError()
749749

750-
async def get_friends(self) -> List[FriendInfo]:
750+
async def get_friends(self) -> List[UserInfo]:
751751
"""Override this method to return the friends list
752752
of the currently authenticated user.
753753
This method is called by the GOG Galaxy Client.

src/galaxy/api/types.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ class LocalGame:
140140

141141
@dataclass
142142
class FriendInfo:
143-
"""Information about a friend of the currently authenticated user.
143+
"""
144+
.. deprecated:: 0.56
145+
Use: :class:`UserInfo`.
146+
Information about a friend of the currently authenticated user.
144147
145148
:param user_id: id of the user
146149
:param user_name: username of the user
@@ -149,6 +152,16 @@ class FriendInfo:
149152
user_name: str
150153

151154

155+
@dataclass
156+
class UserInfo:
157+
"""Information about a user of related user.
158+
159+
:param user_id: id of the user
160+
:param user_name: username of the user
161+
"""
162+
user_id: str
163+
user_name: str
164+
152165
@dataclass
153166
class GameTime:
154167
"""Game time of a game, defines the total time spent in the game

tests/test_friends.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from galaxy.api.types import FriendInfo
1+
from galaxy.api.types import UserInfo
22
from galaxy.api.errors import UnknownError
33
from galaxy.unittest.mock import async_return_value, skip_loop
44

@@ -17,8 +17,8 @@ async def test_get_friends_success(plugin, read, write):
1717

1818
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"", 10)]
1919
plugin.get_friends.return_value = async_return_value([
20-
FriendInfo("3", "Jan"),
21-
FriendInfo("5", "Ola")
20+
UserInfo("3", "Jan"),
21+
UserInfo("5", "Ola")
2222
])
2323
await plugin.run()
2424
plugin.get_friends.assert_called_with()
@@ -64,7 +64,7 @@ async def test_get_friends_failure(plugin, read, write):
6464

6565
@pytest.mark.asyncio
6666
async def test_add_friend(plugin, write):
67-
friend = FriendInfo("7", "Kuba")
67+
friend = UserInfo("7", "Kuba")
6868

6969
plugin.add_friend(friend)
7070
await skip_loop()

0 commit comments

Comments
 (0)