Skip to content

Commit 2cf8339

Browse files
committed
fix parse sphinx parse error
+ other small imporvements in docs
1 parent 4aa76b6 commit 2cf8339

3 files changed

Lines changed: 48 additions & 17 deletions

File tree

src/galaxy/api/plugin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,11 @@ async def authenticate(self, stored_credentials=None):
578578

579579
async def pass_login_credentials(self, step: str, credentials: Dict[str, str], cookies: List[Dict[str, str]]) \
580580
-> Union[NextStep, Authentication]:
581-
"""This method is called if we return galaxy.api.types.NextStep from authenticate or from pass_login_credentials.
581+
"""This method is called if we return :class:`~galaxy.api.types.NextStep` from :meth:`.authenticate`
582+
or :meth:`.pass_login_credentials`.
582583
This method's parameters provide the data extracted from the web page navigation that previous NextStep finished on.
583-
This method should either return galaxy.api.types.Authentication if the authentication is finished
584-
or galaxy.api.types.NextStep if it requires going to another cef url.
584+
This method should either return :class:`~galaxy.api.types.Authentication` if the authentication is finished
585+
or :class:`~galaxy.api.types.NextStep` if it requires going to another cef url.
585586
This method is called by the GOG Galaxy Client.
586587
587588
:param step: deprecated.

src/galaxy/api/types.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ class LocalGame:
144144
class FriendInfo:
145145
"""
146146
.. deprecated:: 0.56
147-
Use: :class:`UserInfo`.
147+
Use :class:`UserInfo`.
148+
148149
Information about a friend of the currently authenticated user.
149150
150151
:param user_id: id of the user
@@ -189,7 +190,7 @@ class GameLibrarySettings:
189190
190191
:param game_id: id of the related game
191192
:param tags: collection of tags assigned to the game
192-
:param hidden: indicates if the game should be hidden in GOG Galaxy application
193+
:param hidden: indicates if the game should be hidden in GOG Galaxy client
193194
"""
194195
game_id: str
195196
tags: Optional[List[str]]
@@ -200,12 +201,18 @@ class GameLibrarySettings:
200201
class UserPresence:
201202
"""Presence information of a user.
202203
204+
The GOG Galaxy client will prefer to generate user status basing on `game_id` (or `game_title`)
205+
and `in_game_status` fields but if plugin is not capable of delivering it then the `full_status` will be used if
206+
available
207+
203208
:param presence_state: the state of the user
204209
:param game_id: id of the game a user is currently in
205210
:param game_title: name of the game a user is currently in
206-
:param presence_status: detailed user's presence description
211+
:param in_game_status: status set by the game itself e.x. "In Main Menu"
212+
:param full_status: full user status e.x. "Playing <title_name>: <in_game_status>"
207213
"""
208214
presence_state: PresenceState
209215
game_id: Optional[str] = None
210216
game_title: Optional[str] = None
211-
presence_status: Optional[str] = None
217+
in_game_status: Optional[str] = None
218+
full_status: Optional[str] = None

tests/test_user_presence.py

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@pytest.mark.asyncio
1313
async def test_get_user_presence_success(plugin, read, write):
1414
context = "abc"
15-
user_ids = ["666", "13", "42", "69"]
15+
user_ids = ["666", "13", "42", "69", "22"]
1616
plugin.prepare_user_presence_context.return_value = async_return_value(context)
1717
request = {
1818
"jsonrpc": "2.0",
@@ -26,25 +26,36 @@ async def test_get_user_presence_success(plugin, read, write):
2626
PresenceState.Unknown,
2727
"game-id1",
2828
None,
29-
"unknown state"
29+
"unknown state",
30+
None
3031
)),
3132
async_return_value(UserPresence(
3233
PresenceState.Offline,
3334
None,
3435
None,
35-
"Going to grandma's house"
36+
"Going to grandma's house",
37+
None
3638
)),
3739
async_return_value(UserPresence(
3840
PresenceState.Online,
3941
"game-id3",
4042
"game-title3",
41-
"Pew pew"
43+
"Pew pew",
44+
None
4245
)),
4346
async_return_value(UserPresence(
4447
PresenceState.Away,
4548
None,
4649
"game-title4",
47-
"AFKKTHXBY"
50+
"AFKKTHXBY",
51+
None
52+
)),
53+
async_return_value(UserPresence(
54+
PresenceState.Away,
55+
None,
56+
"game-title5",
57+
None,
58+
"Playing game-title5: In Menu"
4859
)),
4960
]
5061
await plugin.run()
@@ -67,7 +78,7 @@ async def test_get_user_presence_success(plugin, read, write):
6778
"presence": {
6879
"presence_state": PresenceState.Unknown.value,
6980
"game_id": "game-id1",
70-
"presence_status": "unknown state"
81+
"in_game_status": "unknown state"
7182
}
7283
}
7384
},
@@ -78,7 +89,7 @@ async def test_get_user_presence_success(plugin, read, write):
7889
"user_id": "13",
7990
"presence": {
8091
"presence_state": PresenceState.Offline.value,
81-
"presence_status": "Going to grandma's house"
92+
"in_game_status": "Going to grandma's house"
8293
}
8394
}
8495
},
@@ -91,7 +102,7 @@ async def test_get_user_presence_success(plugin, read, write):
91102
"presence_state": PresenceState.Online.value,
92103
"game_id": "game-id3",
93104
"game_title": "game-title3",
94-
"presence_status": "Pew pew"
105+
"in_game_status": "Pew pew"
95106
}
96107
}
97108
},
@@ -103,7 +114,19 @@ async def test_get_user_presence_success(plugin, read, write):
103114
"presence": {
104115
"presence_state": PresenceState.Away.value,
105116
"game_title": "game-title4",
106-
"presence_status": "AFKKTHXBY"
117+
"in_game_status": "AFKKTHXBY"
118+
}
119+
}
120+
},
121+
{
122+
"jsonrpc": "2.0",
123+
"method": "user_presence_import_success",
124+
"params": {
125+
"user_id": "22",
126+
"presence": {
127+
"presence_state": PresenceState.Away.value,
128+
"game_title": "game-title5",
129+
"full_status": "Playing game-title5: In Menu"
107130
}
108131
}
109132
},
@@ -246,7 +269,7 @@ async def test_update_user_presence(plugin, write):
246269
"presence_state": PresenceState.Online.value,
247270
"game_id": "game-id",
248271
"game_title": "game-title",
249-
"presence_status": "Pew pew"
272+
"in_game_status": "Pew pew"
250273
}
251274
}
252275
}

0 commit comments

Comments
 (0)