Chat
D-Bus interfaces that defines and powers our commands.
- class ChatInterface(implementation)[source]
The DBus interface of a query.
Constructor of the class
- Parameters:
implementation (DaemonContext) – The implementation context to be used in an interface.
- AskQuestion(user_id, message_input)[source]
This method is mainly called by the client to retrieve it’s answer.
- CreateChat(user_id, name, description)[source]
Create a new chat session for a given conversation.
- Return type:
- Parameters:
user_id (Str) – The identifier of the user.
name (Str) – The name of the chat. If not specified, a random name will be given.
description (Str) – A description for the chat to identify the context of it.
- Returns:
The identifier of the chat session.
- Return type:
Str
- DeleteAllChatForUser(user_id)[source]
Delete all chats from the user.
- Return type:
- Parameters:
user_id (Str) – The identifier of the user.
- Raises:
ChatNotFoundError – In case no chat was found for the current user.
- DeleteChatForUser(user_id, name)[source]
Delete a specific chat for a user.
- Return type:
- Parameters:
user_id (Str) – The identifier of the user.
name (Str) – The name of the chat.
- Raises:
ChatNotFoundError – In case no chat was found with the given name for the current user.
- GetAllChatFromUser(user_id)[source]
Get all the chat session for a given user.
- GetChatId(user_id, name)[source]
Get the chat id for a given user and chat name.
- Return type:
- Parameters:
user_id (Str) – The identifier of the user.
name (Str) – The name of the chat.
- Raises:
ChatNotFound – If the chat is not found.
- Returns:
The identifier of the chat session.
- Return type:
Str
- GetLatestChatFromUser(user_id)[source]
Get the latest chat session for a given user.
- Return type:
- Parameters:
user_id (Str) – The identifier of the user.
- Returns:
The identifier of the chat session.
- Return type:
Str
- IsChatAvailable(user_id, name)[source]
Check if a chat session is available for a given user.
- _abc_impl = <_abc._abc_data object>
- _verify_caller_authorization(sender, requested_user_id)[source]
Verify that the caller is authorized to access the requested user’s data.
- Return type:
- Parameters:
sender – The D-Bus sender.
requested_user_id (str) – The user ID being requested in the method call.
- Raises:
PermissionError – If the caller’s user ID doesn’t match the requested user ID.