Skip to content

Commit

Permalink
Remove chat and users
Browse files Browse the repository at this point in the history
  • Loading branch information
goggalaxy authored and rbierbasz-gog committed Jul 24, 2019
1 parent bfb63a4 commit 223adf6
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 625 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="galaxy.plugin.api",
version="0.42",
version="0.43",
description="GOG Galaxy Integrations Python API",
author='Galaxy team',
author_email='[email protected]',
Expand Down
8 changes: 0 additions & 8 deletions src/galaxy/api/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,3 @@ class LocalGameState(Flag):
None_ = 0
Installed = 1
Running = 2


class PresenceState(Enum):
""""Possible states that a user can be in."""
Unknown = "Unknown"
Online = "online"
Offline = "offline"
Away = "away"
109 changes: 2 additions & 107 deletions src/galaxy/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

from typing import Any, List, Dict, Optional, Union

from galaxy.api.types import Achievement, Game, LocalGame, FriendInfo, GameTime, UserInfo, Room
from galaxy.api.types import Achievement, Game, LocalGame, FriendInfo, GameTime

from galaxy.api.jsonrpc import Server, NotificationClient, ApplicationError
from galaxy.api.consts import Feature
from galaxy.api.errors import UnknownError, ImportInProgress
from galaxy.api.types import Authentication, NextStep, Message
from galaxy.api.types import Authentication, NextStep


class JSONEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -122,40 +122,6 @@ def eof_handler():
result_name="friend_info_list",
feature=Feature.ImportFriends
)
self._register_method(
"import_user_infos",
self.get_users,
result_name="user_info_list",
feature=Feature.ImportUsers
)
self._register_method(
"send_message",
self.send_message,
feature=Feature.Chat
)
self._register_method(
"mark_as_read",
self.mark_as_read,
feature=Feature.Chat
)
self._register_method(
"import_rooms",
self.get_rooms,
result_name="rooms",
feature=Feature.Chat
)
self._register_method(
"import_room_history_from_message",
self.get_room_history_from_message,
result_name="messages",
feature=Feature.Chat
)
self._register_method(
"import_room_history_from_timestamp",
self.get_room_history_from_timestamp,
result_name="messages",
feature=Feature.Chat
)
self._register_method(
"import_game_times",
self.get_game_times,
Expand Down Expand Up @@ -441,26 +407,6 @@ def remove_friend(self, user_id: str) -> None:
params = {"user_id": user_id}
self._notification_client.notify("friend_removed", params)

def update_room(
self,
room_id: str,
unread_message_count: Optional[int]=None,
new_messages: Optional[List[Message]]=None
) -> None:
"""WIP, Notify the client to update the information regarding
a chat room that the currently authenticated user is in.
:param room_id: id of the room to update
:param unread_message_count: information about the new unread message count in the room
:param new_messages: list of new messages that the user received
"""
params = {"room_id": room_id}
if unread_message_count is not None:
params["unread_message_count"] = unread_message_count
if new_messages is not None:
params["messages"] = new_messages
self._notification_client.notify("chat_room_updated", params)

def update_game_time(self, game_time: GameTime) -> None:
"""Notify the client to update game time for a game.
Expand Down Expand Up @@ -772,57 +718,6 @@ async def get_friends(self):
"""
raise NotImplementedError()

async def get_users(self, user_id_list: List[str]) -> List[UserInfo]:
"""WIP, Override this method to return the list of users matching the provided ids.
This method is called by the GOG Galaxy Client.
:param user_id_list: list of user ids
"""
raise NotImplementedError()

async def send_message(self, room_id: str, message_text: str) -> None:
"""WIP, Override this method to send message to a chat room.
This method is called by the GOG Galaxy Client.
:param room_id: id of the room to which the message should be sent
:param message_text: text which should be sent in the message
"""
raise NotImplementedError()

async def mark_as_read(self, room_id: str, last_message_id: str) -> None:
"""WIP, Override this method to mark messages in a chat room as read up to the id provided in the parameter.
This method is called by the GOG Galaxy Client.
:param room_id: id of the room
:param last_message_id: id of the last message; room is marked as read only if this id matches
the last message id known to the client
"""
raise NotImplementedError()

async def get_rooms(self) -> List[Room]:
"""WIP, Override this method to return the chat rooms in which the user is currently in.
This method is called by the GOG Galaxy Client
"""
raise NotImplementedError()

async def get_room_history_from_message(self, room_id: str, message_id: str) -> List[Message]:
"""WIP, Override this method to return the chat room history since the message provided in parameter.
This method is called by the GOG Galaxy Client.
:param room_id: id of the room
:param message_id: id of the message since which the history should be retrieved
"""
raise NotImplementedError()

async def get_room_history_from_timestamp(self, room_id: str, from_timestamp: int) -> List[Message]:
"""WIP, Override this method to return the chat room history since the timestamp provided in parameter.
This method is called by the GOG Galaxy Client.
:param room_id: id of the room
:param from_timestamp: timestamp since which the history should be retrieved
"""
raise NotImplementedError()

async def get_game_times(self) -> List[GameTime]:
"""
.. deprecated:: 0.33
Expand Down
56 changes: 1 addition & 55 deletions src/galaxy/api/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import List, Dict, Optional

from galaxy.api.consts import LicenseType, LocalGameState, PresenceState
from galaxy.api.consts import LicenseType, LocalGameState

@dataclass
class Authentication():
Expand Down Expand Up @@ -130,34 +130,6 @@ class LocalGame():
game_id: str
local_game_state: LocalGameState

@dataclass
class Presence():
"""Information about a presence of a user.
:param presence_state: the state in which the user's presence is
:param game_id: id of the game which the user is currently playing
:param presence_status: optional attached string with the detailed description of the user's presence
"""
presence_state: PresenceState
game_id: Optional[str] = None
presence_status: Optional[str] = None

@dataclass
class UserInfo():
"""Detailed information about a user.
:param user_id: of the user
:param is_friend: whether the user is a friend of the currently authenticated user
:param user_name: of the user
:param avatar_url: to the avatar of the user
:param presence: about the users presence
"""
user_id: str
is_friend: bool
user_name: str
avatar_url: str
presence: Presence

@dataclass
class FriendInfo():
"""Information about a friend of the currently authenticated user.
Expand All @@ -168,32 +140,6 @@ class FriendInfo():
user_id: str
user_name: str

@dataclass
class Room():
"""WIP, Chatroom.
:param room_id: id of the room
:param unread_message_count: number of unread messages in the room
:param last_message_id: id of the last message in the room
"""
room_id: str
unread_message_count: int
last_message_id: str

@dataclass
class Message():
"""WIP, A chatroom message.
:param message_id: id of the message
:param sender_id: id of the sender of the message
:param sent_time: time at which the message was sent
:param message_text: text attached to the message
"""
message_id: str
sender_id: str
sent_time: int
message_text: str

@dataclass
class GameTime():
"""Game time of a game, defines the total time spent in the game
Expand Down
6 changes: 0 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ def plugin(reader, writer):
"install_game",
"uninstall_game",
"get_friends",
"get_users",
"send_message",
"mark_as_read",
"get_rooms",
"get_room_history_from_message",
"get_room_history_from_timestamp",
"get_game_times",
"shutdown_platform_client"
)
Expand Down
Loading

2 comments on commit 223adf6

@Mixaill
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this temporary while these features in development or it's a feature cut?

@rbierbasz-gog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - we will restore these features while the rest of the system (client, backend) is ready.

Please sign in to comment.