mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-28 16:41:23 -05:00
SDK-3110: Deprecate FriendInfo and replace with UserInfo
This commit is contained in:
@@ -11,7 +11,7 @@ from galaxy.api.consts import Feature, OSCompatibility
|
||||
from galaxy.api.errors import ImportInProgress, UnknownError
|
||||
from galaxy.api.jsonrpc import ApplicationError, NotificationClient, Server
|
||||
from galaxy.api.types import (
|
||||
Achievement, Authentication, FriendInfo, Game, GameLibrarySettings, GameTime, LocalGame, NextStep, UserPresence
|
||||
Achievement, Authentication, Game, GameLibrarySettings, GameTime, LocalGame, NextStep, UserInfo, UserPresence
|
||||
)
|
||||
from galaxy.task_manager import TaskManager
|
||||
|
||||
@@ -383,10 +383,10 @@ class Plugin:
|
||||
params = {"local_game": local_game}
|
||||
self._notification_client.notify("local_game_status_changed", params)
|
||||
|
||||
def add_friend(self, user: FriendInfo) -> None:
|
||||
def add_friend(self, user: UserInfo) -> None:
|
||||
"""Notify the client to add a user to friends list of the currently authenticated user.
|
||||
|
||||
:param user: FriendInfo of a user that the client will add to friends list
|
||||
:param user: UserInfo of a user that the client will add to friends list
|
||||
"""
|
||||
params = {"friend_info": user}
|
||||
self._notification_client.notify("friend_added", params)
|
||||
@@ -747,7 +747,7 @@ class Plugin:
|
||||
This method is called by the GOG Galaxy Client."""
|
||||
raise NotImplementedError()
|
||||
|
||||
async def get_friends(self) -> List[FriendInfo]:
|
||||
async def get_friends(self) -> List[UserInfo]:
|
||||
"""Override this method to return the friends list
|
||||
of the currently authenticated user.
|
||||
This method is called by the GOG Galaxy Client.
|
||||
|
||||
@@ -140,7 +140,10 @@ class LocalGame:
|
||||
|
||||
@dataclass
|
||||
class FriendInfo:
|
||||
"""Information about a friend of the currently authenticated user.
|
||||
"""
|
||||
.. deprecated:: 0.56
|
||||
Use: :class:`UserInfo`.
|
||||
Information about a friend of the currently authenticated user.
|
||||
|
||||
:param user_id: id of the user
|
||||
:param user_name: username of the user
|
||||
@@ -149,6 +152,16 @@ class FriendInfo:
|
||||
user_name: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class UserInfo:
|
||||
"""Information about a user of related user.
|
||||
|
||||
:param user_id: id of the user
|
||||
:param user_name: username of the user
|
||||
"""
|
||||
user_id: str
|
||||
user_name: str
|
||||
|
||||
@dataclass
|
||||
class GameTime:
|
||||
"""Game time of a game, defines the total time spent in the game
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from galaxy.api.types import FriendInfo
|
||||
from galaxy.api.types import UserInfo
|
||||
from galaxy.api.errors import UnknownError
|
||||
from galaxy.unittest.mock import async_return_value, skip_loop
|
||||
|
||||
@@ -17,8 +17,8 @@ async def test_get_friends_success(plugin, read, write):
|
||||
|
||||
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"", 10)]
|
||||
plugin.get_friends.return_value = async_return_value([
|
||||
FriendInfo("3", "Jan"),
|
||||
FriendInfo("5", "Ola")
|
||||
UserInfo("3", "Jan"),
|
||||
UserInfo("5", "Ola")
|
||||
])
|
||||
await plugin.run()
|
||||
plugin.get_friends.assert_called_with()
|
||||
@@ -64,7 +64,7 @@ async def test_get_friends_failure(plugin, read, write):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_add_friend(plugin, write):
|
||||
friend = FriendInfo("7", "Kuba")
|
||||
friend = UserInfo("7", "Kuba")
|
||||
|
||||
plugin.add_friend(friend)
|
||||
await skip_loop()
|
||||
|
||||
Reference in New Issue
Block a user