mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-01 11:28:12 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a114c9721c | ||
|
|
6c0389834b | ||
|
|
bc7d1c2914 | ||
|
|
d69e1aaa08 | ||
|
|
c2a0534162 | ||
|
|
1614fd6eb2 | ||
|
|
48e54a8460 |
@@ -20,5 +20,7 @@ deploy_package:
|
|||||||
- curl -X POST --silent --show-error --fail
|
- curl -X POST --silent --show-error --fail
|
||||||
"https://gitlab.gog.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${VERSION}&ref=${CI_COMMIT_REF_NAME}&private_token=${PACKAGE_DEPLOYER_API_TOKEN}"
|
"https://gitlab.gog.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${VERSION}&ref=${CI_COMMIT_REF_NAME}&private_token=${PACKAGE_DEPLOYER_API_TOKEN}"
|
||||||
when: manual
|
when: manual
|
||||||
|
only:
|
||||||
|
- master
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
0
galaxy/__init__.py
Normal file
0
galaxy/__init__.py
Normal file
@@ -12,6 +12,7 @@ class Platform(Enum):
|
|||||||
Battlenet = "battlenet"
|
Battlenet = "battlenet"
|
||||||
|
|
||||||
class Feature(Enum):
|
class Feature(Enum):
|
||||||
|
Unknown = "Unknown"
|
||||||
ImportInstalledGames = "ImportInstalledGames"
|
ImportInstalledGames = "ImportInstalledGames"
|
||||||
ImportOwnedGames = "ImportOwnedGames"
|
ImportOwnedGames = "ImportOwnedGames"
|
||||||
LaunchGame = "LaunchGame"
|
LaunchGame = "LaunchGame"
|
||||||
@@ -23,11 +24,19 @@ class Feature(Enum):
|
|||||||
ImportUsers = "ImportUsers"
|
ImportUsers = "ImportUsers"
|
||||||
VerifyGame = "VerifyGame"
|
VerifyGame = "VerifyGame"
|
||||||
|
|
||||||
|
class LicenseType(Enum):
|
||||||
|
Unknown = "Unknown"
|
||||||
|
SinglePurchase = "SinglePurchase"
|
||||||
|
FreeToPlay = "FreeToPlay"
|
||||||
|
OtherUserLicense = "OtherUserLicense"
|
||||||
|
|
||||||
class LocalGameState(Enum):
|
class LocalGameState(Enum):
|
||||||
|
Unknown = "Unknown"
|
||||||
Installed = "Installed"
|
Installed = "Installed"
|
||||||
Running = "Running"
|
Running = "Running"
|
||||||
|
|
||||||
class PresenceState(Enum):
|
class PresenceState(Enum):
|
||||||
|
Unknown = "Unknown"
|
||||||
Online = "online"
|
Online = "online"
|
||||||
Offline = "offline"
|
Offline = "offline"
|
||||||
Away = "away"
|
Away = "away"
|
||||||
|
|||||||
@@ -64,10 +64,12 @@ class Server():
|
|||||||
|
|
||||||
async def run(self):
|
async def run(self):
|
||||||
while self._active:
|
while self._active:
|
||||||
data = await self._reader.readline()
|
try:
|
||||||
if not data:
|
data = await self._reader.readline()
|
||||||
# on windows rederecting a pipe to stdin result on continues
|
if not data:
|
||||||
# not-blocking return of empty line on EOF
|
self._eof()
|
||||||
|
continue
|
||||||
|
except:
|
||||||
self._eof()
|
self._eof()
|
||||||
continue
|
continue
|
||||||
data = data.strip()
|
data = data.strip()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import List
|
from typing import List, Optional
|
||||||
|
|
||||||
from galaxy.api.consts import LocalGameState, PresenceState
|
from galaxy.api.consts import LicenseType, LocalGameState, PresenceState
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Authentication():
|
class Authentication():
|
||||||
@@ -10,8 +10,8 @@ class Authentication():
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LicenseInfo():
|
class LicenseInfo():
|
||||||
license_type: str
|
license_type: LicenseType
|
||||||
owner: str = None
|
owner: Optional[str] = None
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Dlc():
|
class Dlc():
|
||||||
@@ -39,8 +39,8 @@ class LocalGame():
|
|||||||
@dataclass
|
@dataclass
|
||||||
class Presence():
|
class Presence():
|
||||||
presence_state: PresenceState
|
presence_state: PresenceState
|
||||||
game_id: str = None
|
game_id: Optional[str] = None
|
||||||
presence_status: str = None
|
presence_status: Optional[str] = None
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UserInfo():
|
class UserInfo():
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="galaxy.plugin.api",
|
name="galaxy.plugin.api",
|
||||||
version="0.4",
|
version="0.8",
|
||||||
description="Galaxy python plugin API",
|
description="Galaxy python plugin API",
|
||||||
author='Galaxy team',
|
author='Galaxy team',
|
||||||
author_email='galaxy@gog.com',
|
author_email='galaxy@gog.com',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from galaxy.api.types import Game, Dlc, LicenseInfo
|
from galaxy.api.types import Game, Dlc, LicenseInfo
|
||||||
|
from galaxy.api.consts import LicenseType
|
||||||
from galaxy.api.errors import UnknownError
|
from galaxy.api.errors import UnknownError
|
||||||
|
|
||||||
def test_success(plugin, readline, write):
|
def test_success(plugin, readline, write):
|
||||||
@@ -13,15 +14,15 @@ def test_success(plugin, readline, write):
|
|||||||
|
|
||||||
readline.side_effect = [json.dumps(request), ""]
|
readline.side_effect = [json.dumps(request), ""]
|
||||||
plugin.get_owned_games.return_value = [
|
plugin.get_owned_games.return_value = [
|
||||||
Game("3", "Doom", None, LicenseInfo("SinglePurchase", None)),
|
Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None)),
|
||||||
Game(
|
Game(
|
||||||
"5",
|
"5",
|
||||||
"Witcher 3",
|
"Witcher 3",
|
||||||
[
|
[
|
||||||
Dlc("7", "Hearts of Stone", LicenseInfo("SinglePurchase", None)),
|
Dlc("7", "Hearts of Stone", LicenseInfo(LicenseType.SinglePurchase, None)),
|
||||||
Dlc("8", "Temerian Armor Set", LicenseInfo("FreeToPlay", None)),
|
Dlc("8", "Temerian Armor Set", LicenseInfo(LicenseType.FreeToPlay, None)),
|
||||||
],
|
],
|
||||||
LicenseInfo("SinglePurchase", None))
|
LicenseInfo(LicenseType.SinglePurchase, None))
|
||||||
]
|
]
|
||||||
asyncio.run(plugin.run())
|
asyncio.run(plugin.run())
|
||||||
plugin.get_owned_games.assert_called_with()
|
plugin.get_owned_games.assert_called_with()
|
||||||
@@ -89,7 +90,7 @@ def test_failure(plugin, readline, write):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def test_add_game(plugin, write):
|
def test_add_game(plugin, write):
|
||||||
game = Game("3", "Doom", None, LicenseInfo("SinglePurchase", None))
|
game = Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None))
|
||||||
|
|
||||||
async def couritine():
|
async def couritine():
|
||||||
plugin.add_game(game)
|
plugin.add_game(game)
|
||||||
@@ -127,7 +128,7 @@ def test_remove_game(plugin, write):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def test_update_game(plugin, write):
|
def test_update_game(plugin, write):
|
||||||
game = Game("3", "Doom", None, LicenseInfo("SinglePurchase", None))
|
game = Game("3", "Doom", None, LicenseInfo(LicenseType.SinglePurchase, None))
|
||||||
|
|
||||||
async def couritine():
|
async def couritine():
|
||||||
plugin.update_game(game)
|
plugin.update_game(game)
|
||||||
|
|||||||
Reference in New Issue
Block a user