Compare commits

..

2 Commits
0.41 ... 0.42

Author SHA1 Message Date
Romuald Juchnowicz-Bierbasz
10ecef791f Increment version 2019-07-17 15:35:38 +02:00
Romuald Bierbasz
ce193f39bc SDK-2933: Add shutdown_client notification 2019-07-17 15:27:27 +02:00
5 changed files with 29 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="galaxy.plugin.api",
version="0.41",
version="0.42",
description="GOG Galaxy Integrations Python API",
author='Galaxy team',
author_email='galaxy@gog.com',

View File

@@ -98,6 +98,7 @@ class Feature(Enum):
ImportUsers = "ImportUsers"
VerifyGame = "VerifyGame"
ImportFriends = "ImportFriends"
ShutdownPlatformClient = "ShutdownPlatformClient"
class LicenseType(Enum):

View File

@@ -107,6 +107,11 @@ class Plugin:
self.uninstall_game,
feature=Feature.UninstallGame
)
self._register_notification(
"shutdown_platform_client",
self.shutdown_platform_client,
feature=Feature.ShutdownPlatformClient
)
self._register_method(
"import_friends",
self.get_friends,
@@ -718,6 +723,11 @@ class Plugin:
"""
raise NotImplementedError()
async def shutdown_platform_client(self) -> None:
"""Override this method to gracefully terminate platform client.
This method is called by the GOG Galaxy Client."""
raise NotImplementedError()
async def get_friends(self) -> List[FriendInfo]:
"""Override this method to return the friends list
of the currently authenticated user.

View File

@@ -48,7 +48,8 @@ def plugin(reader, writer):
"get_rooms",
"get_room_history_from_message",
"get_room_history_from_timestamp",
"get_game_times"
"get_game_times",
"shutdown_platform_client"
)
methods = (

View File

@@ -0,0 +1,15 @@
import json
import pytest
@pytest.mark.asyncio
async def test_success(plugin, read):
request = {
"jsonrpc": "2.0",
"method": "shutdown_platform_client"
}
read.side_effect = [json.dumps(request).encode() + b"\n", b""]
plugin.shutdown_platform_client.return_value = None
await plugin.run()
plugin.shutdown_platform_client.assert_called_with()