h-message-bus 0.0.32__tar.gz → 0.0.34__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/PKG-INFO +1 -1
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/pyproject.toml +1 -1
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/request_message_topic.py +15 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_follow_user_request_message.py +40 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_follow_user_response_message.py +43 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_home_timeline_request_message.py +56 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_home_timeline_response_message.py +74 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_post_tweet_request_message.py +40 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_post_tweet_response_message.py +47 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_reply_request_message.py +48 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_reply_response_message.py +54 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_retweet_request_message.py +40 -0
- h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_retweet_response_message.py +43 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/PKG-INFO +1 -1
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/SOURCES.txt +10 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/README.md +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/setup.cfg +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_message_adapter.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_publisher_adapter.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_subscriber_adapter.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_processor.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_publisher.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_subcriber.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/event_messages/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/event_message_topic.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/hai_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/twitter_message_metadata.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/twitter_user_metadata.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/vector_collection_metadata.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/vector_query_answer.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_clear_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_get_all_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_get_all_result_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_add_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_added_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_get_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_get_result_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_update_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_node_update_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_nodes_by_property_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_nodes_by_property_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_query_operation_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_query_operation_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_query_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/graph_relationship_added_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/init_knowledgebase_request.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/tg_message_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/tg_user_message_reply_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/tg_user_message_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_get_user_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_get_user_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_get_users_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_get_users_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_user_tweets_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/twitter_user_tweets_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/vector_query_collection_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/vector_query_collection_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/vector_read_metadata_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/vector_read_metadata_response_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/vector_save_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/web_get_docs_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/web_search_request_message.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/infrastructure/__init__.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/infrastructure/nats_client_repository.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/infrastructure/nats_config.py +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/dependency_links.txt +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/requires.txt +0 -0
- {h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/top_level.txt +0 -0
@@ -38,6 +38,21 @@ class RequestMessageTopic(str, Enum):
|
|
38
38
|
TWITTER_USER_SEND_AI_CHAT_SEND = "hai.twitter.user.chat.send"
|
39
39
|
TWITTER_USER_SEND_AI_CHAT_SEND_RESPONSE = "hai.twitter.user.chat.send.response"
|
40
40
|
|
41
|
+
TWITTER_FOLLOW_USER= "hai.twitter.follow.user"
|
42
|
+
TWITTER_FOLLOW_USER_RESPONSE = "hai.twitter.follow.user.response"
|
43
|
+
|
44
|
+
TWITTER_GET_HOME_TIMELINE= "hai.twitter.get.home.timeline"
|
45
|
+
TWITTER_GET_HOME_TIMELINE_RESPONSE = "hai.twitter.get.home.timeline.response"
|
46
|
+
|
47
|
+
TWITTER_RETWEET= "hai.twitter.retweet"
|
48
|
+
TWITTER_RETWEET_RESPONSE = "hai.twitter.retweet.response"
|
49
|
+
|
50
|
+
TWITTER_REPLY= "hai.twitter.reply"
|
51
|
+
TWITTER_REPLY_RESPONSE = "hai.twitter.reply.response"
|
52
|
+
|
53
|
+
TWITTER_POST_TWEET= "hai.twitter.post.tweet"
|
54
|
+
TWITTER_POST_TWEET_RESPONSE = "hai.twitter.post.tweet.response"
|
55
|
+
|
41
56
|
# tools
|
42
57
|
WEB_SEARCH = "hai.tools.web.search"
|
43
58
|
WEB_SEARCH_RESPONSE = "hai.tools.web.search.response"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterFollowUserRequestMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterFollowUserRequestMessage(HaiMessage):
|
11
|
+
"""Message to request following a Twitter user"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, user_id: str) -> 'TwitterFollowUserRequestMessage':
|
20
|
+
"""Create a message requesting to follow a Twitter user"""
|
21
|
+
return cls.create(
|
22
|
+
topic=RequestMessageTopic.TWITTER_FOLLOW_USER, # You'll need to add this to RequestMessageTopic
|
23
|
+
payload={
|
24
|
+
"user_id": user_id
|
25
|
+
},
|
26
|
+
)
|
27
|
+
|
28
|
+
@property
|
29
|
+
def user_id(self) -> str:
|
30
|
+
"""Get the user ID from the payload"""
|
31
|
+
return self.payload.get("user_id", "")
|
32
|
+
|
33
|
+
@classmethod
|
34
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterFollowUserRequestMessage':
|
35
|
+
"""Create a TwitterFollowUserRequestMessage from a HaiMessage"""
|
36
|
+
payload = message.payload
|
37
|
+
|
38
|
+
return cls.create_message(
|
39
|
+
user_id=payload.get("user_id", "")
|
40
|
+
)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterFollowUserResponseMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterFollowUserResponseMessage(HaiMessage):
|
11
|
+
"""Message to respond to a request to follow a Twitter user"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, user_id: str, success: bool, error_message: str = "") -> 'TwitterFollowUserResponseMessage':
|
20
|
+
"""Create a response message for a request to follow a Twitter user"""
|
21
|
+
return cls.create(
|
22
|
+
topic=RequestMessageTopic.TWITTER_FOLLOW_USER_RESPONSE, # You'll need to add this to ResponseMessageTopic
|
23
|
+
payload={
|
24
|
+
"user_id": user_id,
|
25
|
+
"success": success,
|
26
|
+
"error_message": error_message
|
27
|
+
},
|
28
|
+
)
|
29
|
+
|
30
|
+
@property
|
31
|
+
def user_id(self) -> str:
|
32
|
+
"""Get the user ID from the payload"""
|
33
|
+
return self.payload.get("user_id", "")
|
34
|
+
|
35
|
+
@property
|
36
|
+
def success(self) -> bool:
|
37
|
+
"""Get whether the follow operation was successful"""
|
38
|
+
return self.payload.get("success", False)
|
39
|
+
|
40
|
+
@property
|
41
|
+
def error_message(self) -> str:
|
42
|
+
"""Get the error message if the follow operation failed"""
|
43
|
+
return self.payload.get("error_message", "")
|
@@ -0,0 +1,56 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterHomeTimelineRequestMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterHomeTimelineRequestMessage(HaiMessage):
|
11
|
+
"""Message to request the home timeline for the authenticated Twitter user"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, max_results: int = 100,
|
20
|
+
include_replies: bool = True,
|
21
|
+
include_retweets: bool = True) -> 'TwitterHomeTimelineRequestMessage':
|
22
|
+
"""Create a message requesting the Twitter home timeline"""
|
23
|
+
return cls.create(
|
24
|
+
topic=RequestMessageTopic.TWITTER_GET_HOME_TIMELINE, # You'll need to add this to RequestMessageTopic
|
25
|
+
payload={
|
26
|
+
"max_results": max_results,
|
27
|
+
"include_replies": include_replies,
|
28
|
+
"include_retweets": include_retweets
|
29
|
+
},
|
30
|
+
)
|
31
|
+
|
32
|
+
@property
|
33
|
+
def max_results(self) -> int:
|
34
|
+
"""Get the maximum number of results from the payload"""
|
35
|
+
return self.payload.get("max_results", 100)
|
36
|
+
|
37
|
+
@property
|
38
|
+
def include_replies(self) -> bool:
|
39
|
+
"""Get whether to include replies from the payload"""
|
40
|
+
return self.payload.get("include_replies", True)
|
41
|
+
|
42
|
+
@property
|
43
|
+
def include_retweets(self) -> bool:
|
44
|
+
"""Get whether to include retweets from the payload"""
|
45
|
+
return self.payload.get("include_retweets", True)
|
46
|
+
|
47
|
+
@classmethod
|
48
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterHomeTimelineRequestMessage':
|
49
|
+
"""Create a TwitterHomeTimelineRequestMessage from a HaiMessage"""
|
50
|
+
payload = message.payload
|
51
|
+
|
52
|
+
return cls.create_message(
|
53
|
+
max_results=payload.get("max_results", 100),
|
54
|
+
include_replies=payload.get("include_replies", True),
|
55
|
+
include_retweets=payload.get("include_retweets", True)
|
56
|
+
)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar, List
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterHomeTimelineResponseMessage')
|
8
|
+
|
9
|
+
|
10
|
+
@dataclass
|
11
|
+
class TwitterMessageMetaData:
|
12
|
+
"""Metadata about a Twitter message"""
|
13
|
+
tweet_id: str
|
14
|
+
user: Dict[str, Any]
|
15
|
+
message: str
|
16
|
+
created_at: str
|
17
|
+
view_count: int
|
18
|
+
retweet_count: int
|
19
|
+
reply_count: int
|
20
|
+
|
21
|
+
|
22
|
+
@dataclass
|
23
|
+
class TwitterHomeTimelineResponseMessage(HaiMessage):
|
24
|
+
"""Message containing the home timeline for the authenticated Twitter user"""
|
25
|
+
|
26
|
+
@classmethod
|
27
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
28
|
+
"""Create a message - inherited from HaiMessage"""
|
29
|
+
return super().create(topic=topic, payload=payload)
|
30
|
+
|
31
|
+
@classmethod
|
32
|
+
def create_message(cls, tweets: List[Dict[str, Any]]) -> 'TwitterHomeTimelineResponseMessage':
|
33
|
+
"""Create a response message with the user's home timeline tweets"""
|
34
|
+
return cls.create(
|
35
|
+
topic=RequestMessageTopic.TWITTER_GET_HOME_TIMELINE_RESPONSE,
|
36
|
+
# You'll need to add this to ResponseMessageTopic
|
37
|
+
payload={
|
38
|
+
"tweets": tweets
|
39
|
+
},
|
40
|
+
)
|
41
|
+
|
42
|
+
@property
|
43
|
+
def tweets(self) -> List[Dict[str, Any]]:
|
44
|
+
"""Get the tweets from the payload"""
|
45
|
+
return self.payload.get("tweets", [])
|
46
|
+
|
47
|
+
@classmethod
|
48
|
+
def from_twitter_messages(cls,
|
49
|
+
twitter_messages: List[TwitterMessageMetaData]) -> 'TwitterHomeTimelineResponseMessage':
|
50
|
+
"""Create a TwitterHomeTimelineResponseMessage from a list of TwitterMessageMetaData"""
|
51
|
+
tweet_list = []
|
52
|
+
|
53
|
+
for message in twitter_messages:
|
54
|
+
tweet_data = {
|
55
|
+
"tweet_id": message.tweet_id,
|
56
|
+
"message": message.message,
|
57
|
+
"created_at": message.created_at,
|
58
|
+
"view_count": message.view_count,
|
59
|
+
"retweet_count": message.retweet_count,
|
60
|
+
"reply_count": message.reply_count,
|
61
|
+
"user": message.user
|
62
|
+
}
|
63
|
+
tweet_list.append(tweet_data)
|
64
|
+
|
65
|
+
return cls.create_message(tweets=tweet_list)
|
66
|
+
|
67
|
+
@classmethod
|
68
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterHomeTimelineResponseMessage':
|
69
|
+
"""Create a TwitterHomeTimelineResponseMessage from a HaiMessage"""
|
70
|
+
payload = message.payload
|
71
|
+
|
72
|
+
return cls.create_message(
|
73
|
+
tweets=payload.get("tweets", [])
|
74
|
+
)
|
h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_post_tweet_request_message.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterPostTweetRequestMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterPostTweetRequestMessage(HaiMessage):
|
11
|
+
"""Message to request posting a new tweet"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, text: str) -> 'TwitterPostTweetRequestMessage':
|
20
|
+
"""Create a message requesting to post a new tweet"""
|
21
|
+
return cls.create(
|
22
|
+
topic=RequestMessageTopic.TWITTER_POST_TWEET, # You'll need to add this to RequestMessageTopic
|
23
|
+
payload={
|
24
|
+
"text": text
|
25
|
+
},
|
26
|
+
)
|
27
|
+
|
28
|
+
@property
|
29
|
+
def text(self) -> str:
|
30
|
+
"""Get the text content of the tweet from the payload"""
|
31
|
+
return self.payload.get("text", "")
|
32
|
+
|
33
|
+
@classmethod
|
34
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterPostTweetRequestMessage':
|
35
|
+
"""Create a TwitterPostTweetRequestMessage from a HaiMessage"""
|
36
|
+
payload = message.payload
|
37
|
+
|
38
|
+
return cls.create_message(
|
39
|
+
text=payload.get("text", "")
|
40
|
+
)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar, Optional
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterPostTweetResponseMessage')
|
8
|
+
|
9
|
+
|
10
|
+
@dataclass
|
11
|
+
class TwitterPostTweetResponseMessage(HaiMessage):
|
12
|
+
"""Message to respond to a request to post a new tweet"""
|
13
|
+
|
14
|
+
@classmethod
|
15
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
16
|
+
"""Create a message - inherited from HaiMessage"""
|
17
|
+
return super().create(topic=topic, payload=payload)
|
18
|
+
|
19
|
+
@classmethod
|
20
|
+
def create_message(cls,
|
21
|
+
success: bool,
|
22
|
+
tweet: Optional[Dict[str, Any]] = None,
|
23
|
+
error_message: str = "") -> 'TwitterPostTweetResponseMessage':
|
24
|
+
"""Create a response message for a request to post a new tweet"""
|
25
|
+
return cls.create(
|
26
|
+
topic=RequestMessageTopic.TWITTER_POST_TWEET_RESPONSE, # You'll need to add this to ResponseMessageTopic
|
27
|
+
payload={
|
28
|
+
"success": success,
|
29
|
+
"tweet": tweet,
|
30
|
+
"error_message": error_message
|
31
|
+
},
|
32
|
+
)
|
33
|
+
|
34
|
+
@property
|
35
|
+
def success(self) -> bool:
|
36
|
+
"""Get whether the post tweet operation was successful"""
|
37
|
+
return self.payload.get("success", False)
|
38
|
+
|
39
|
+
@property
|
40
|
+
def tweet(self) -> Optional[Dict[str, Any]]:
|
41
|
+
"""Get the posted tweet data if the operation was successful"""
|
42
|
+
return self.payload.get("tweet", None)
|
43
|
+
|
44
|
+
@property
|
45
|
+
def error_message(self) -> str:
|
46
|
+
"""Get the error message if the post tweet operation failed"""
|
47
|
+
return self.payload.get("error_message", "")
|
h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_reply_request_message.py
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterReplyRequestMessage')
|
8
|
+
|
9
|
+
|
10
|
+
@dataclass
|
11
|
+
class TwitterReplyRequestMessage(HaiMessage):
|
12
|
+
"""Message to request replying to a tweet"""
|
13
|
+
|
14
|
+
@classmethod
|
15
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
16
|
+
"""Create a message - inherited from HaiMessage"""
|
17
|
+
return super().create(topic=topic, payload=payload)
|
18
|
+
|
19
|
+
@classmethod
|
20
|
+
def create_message(cls, tweet_id: str, text: str) -> 'TwitterReplyRequestMessage':
|
21
|
+
"""Create a message requesting to reply to a tweet"""
|
22
|
+
return cls.create(
|
23
|
+
topic=RequestMessageTopic.TWITTER_REPLY, # You'll need to add this to RequestMessageTopic
|
24
|
+
payload={
|
25
|
+
"tweet_id": tweet_id,
|
26
|
+
"text": text
|
27
|
+
},
|
28
|
+
)
|
29
|
+
|
30
|
+
@property
|
31
|
+
def tweet_id(self) -> str:
|
32
|
+
"""Get the tweet ID to reply to from the payload"""
|
33
|
+
return self.payload.get("tweet_id", "")
|
34
|
+
|
35
|
+
@property
|
36
|
+
def text(self) -> str:
|
37
|
+
"""Get the text content of the reply from the payload"""
|
38
|
+
return self.payload.get("text", "")
|
39
|
+
|
40
|
+
@classmethod
|
41
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterReplyRequestMessage':
|
42
|
+
"""Create a TwitterReplyRequestMessage from a HaiMessage"""
|
43
|
+
payload = message.payload
|
44
|
+
|
45
|
+
return cls.create_message(
|
46
|
+
tweet_id=payload.get("tweet_id", ""),
|
47
|
+
text=payload.get("text", "")
|
48
|
+
)
|
h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_reply_response_message.py
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar, Optional
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterReplyResponseMessage')
|
8
|
+
|
9
|
+
|
10
|
+
@dataclass
|
11
|
+
class TwitterReplyResponseMessage(HaiMessage):
|
12
|
+
"""Message to respond to a request to reply to a tweet"""
|
13
|
+
|
14
|
+
@classmethod
|
15
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
16
|
+
"""Create a message - inherited from HaiMessage"""
|
17
|
+
return super().create(topic=topic, payload=payload)
|
18
|
+
|
19
|
+
@classmethod
|
20
|
+
def create_message(cls,
|
21
|
+
original_tweet_id: str,
|
22
|
+
success: bool,
|
23
|
+
reply_tweet: Optional[Dict[str, Any]] = None,
|
24
|
+
error_message: str = "") -> 'TwitterReplyResponseMessage':
|
25
|
+
"""Create a response message for a request to reply to a tweet"""
|
26
|
+
return cls.create(
|
27
|
+
topic=RequestMessageTopic.TWITTER_REPLY_RESPONSE, # You'll need to add this to ResponseMessageTopic
|
28
|
+
payload={
|
29
|
+
"original_tweet_id": original_tweet_id,
|
30
|
+
"success": success,
|
31
|
+
"reply_tweet": reply_tweet,
|
32
|
+
"error_message": error_message
|
33
|
+
},
|
34
|
+
)
|
35
|
+
|
36
|
+
@property
|
37
|
+
def original_tweet_id(self) -> str:
|
38
|
+
"""Get the original tweet ID that was replied to"""
|
39
|
+
return self.payload.get("original_tweet_id", "")
|
40
|
+
|
41
|
+
@property
|
42
|
+
def success(self) -> bool:
|
43
|
+
"""Get whether the reply operation was successful"""
|
44
|
+
return self.payload.get("success", False)
|
45
|
+
|
46
|
+
@property
|
47
|
+
def reply_tweet(self) -> Optional[Dict[str, Any]]:
|
48
|
+
"""Get the reply tweet data if the operation was successful"""
|
49
|
+
return self.payload.get("reply_tweet", None)
|
50
|
+
|
51
|
+
@property
|
52
|
+
def error_message(self) -> str:
|
53
|
+
"""Get the error message if the reply operation failed"""
|
54
|
+
return self.payload.get("error_message", "")
|
h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_retweet_request_message.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterRetweetRequestMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterRetweetRequestMessage(HaiMessage):
|
11
|
+
"""Message to request retweeting a tweet"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, tweet_id: str) -> 'TwitterRetweetRequestMessage':
|
20
|
+
"""Create a message requesting to retweet a tweet"""
|
21
|
+
return cls.create(
|
22
|
+
topic=RequestMessageTopic.TWITTER_RETWEET, # You'll need to add this to RequestMessageTopic
|
23
|
+
payload={
|
24
|
+
"tweet_id": tweet_id
|
25
|
+
},
|
26
|
+
)
|
27
|
+
|
28
|
+
@property
|
29
|
+
def tweet_id(self) -> str:
|
30
|
+
"""Get the tweet ID from the payload"""
|
31
|
+
return self.payload.get("tweet_id", "")
|
32
|
+
|
33
|
+
@classmethod
|
34
|
+
def from_hai_message(cls, message: HaiMessage) -> 'TwitterRetweetRequestMessage':
|
35
|
+
"""Create a TwitterRetweetRequestMessage from a HaiMessage"""
|
36
|
+
payload = message.payload
|
37
|
+
|
38
|
+
return cls.create_message(
|
39
|
+
tweet_id=payload.get("tweet_id", "")
|
40
|
+
)
|
h_message_bus-0.0.34/src/h_message_bus/domain/request_messages/twitter_retweet_response_message.py
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from typing import Type, Dict, Any, TypeVar
|
3
|
+
|
4
|
+
from ..models.request_message_topic import RequestMessageTopic
|
5
|
+
from ...domain.models.hai_message import HaiMessage
|
6
|
+
|
7
|
+
T = TypeVar('T', bound='TwitterRetweetResponseMessage')
|
8
|
+
|
9
|
+
@dataclass
|
10
|
+
class TwitterRetweetResponseMessage(HaiMessage):
|
11
|
+
"""Message to respond to a request to retweet a tweet"""
|
12
|
+
|
13
|
+
@classmethod
|
14
|
+
def create(cls: Type[T], topic: str, payload: Dict[Any, Any]) -> T:
|
15
|
+
"""Create a message - inherited from HaiMessage"""
|
16
|
+
return super().create(topic=topic, payload=payload)
|
17
|
+
|
18
|
+
@classmethod
|
19
|
+
def create_message(cls, tweet_id: str, success: bool, error_message: str = "") -> 'TwitterRetweetResponseMessage':
|
20
|
+
"""Create a response message for a request to retweet a tweet"""
|
21
|
+
return cls.create(
|
22
|
+
topic=RequestMessageTopic.TWITTER_RETWEET_RESPONSE, # You'll need to add this to ResponseMessageTopic
|
23
|
+
payload={
|
24
|
+
"tweet_id": tweet_id,
|
25
|
+
"success": success,
|
26
|
+
"error_message": error_message
|
27
|
+
},
|
28
|
+
)
|
29
|
+
|
30
|
+
@property
|
31
|
+
def tweet_id(self) -> str:
|
32
|
+
"""Get the tweet ID from the payload"""
|
33
|
+
return self.payload.get("tweet_id", "")
|
34
|
+
|
35
|
+
@property
|
36
|
+
def success(self) -> bool:
|
37
|
+
"""Get whether the retweet operation was successful"""
|
38
|
+
return self.payload.get("success", False)
|
39
|
+
|
40
|
+
@property
|
41
|
+
def error_message(self) -> str:
|
42
|
+
"""Get the error message if the retweet operation failed"""
|
43
|
+
return self.payload.get("error_message", "")
|
@@ -45,10 +45,20 @@ src/h_message_bus/domain/request_messages/init_knowledgebase_request.py
|
|
45
45
|
src/h_message_bus/domain/request_messages/tg_message_request_message.py
|
46
46
|
src/h_message_bus/domain/request_messages/tg_user_message_reply_request_message.py
|
47
47
|
src/h_message_bus/domain/request_messages/tg_user_message_request_message.py
|
48
|
+
src/h_message_bus/domain/request_messages/twitter_follow_user_request_message.py
|
49
|
+
src/h_message_bus/domain/request_messages/twitter_follow_user_response_message.py
|
48
50
|
src/h_message_bus/domain/request_messages/twitter_get_user_request_message.py
|
49
51
|
src/h_message_bus/domain/request_messages/twitter_get_user_response_message.py
|
50
52
|
src/h_message_bus/domain/request_messages/twitter_get_users_request_message.py
|
51
53
|
src/h_message_bus/domain/request_messages/twitter_get_users_response_message.py
|
54
|
+
src/h_message_bus/domain/request_messages/twitter_home_timeline_request_message.py
|
55
|
+
src/h_message_bus/domain/request_messages/twitter_home_timeline_response_message.py
|
56
|
+
src/h_message_bus/domain/request_messages/twitter_post_tweet_request_message.py
|
57
|
+
src/h_message_bus/domain/request_messages/twitter_post_tweet_response_message.py
|
58
|
+
src/h_message_bus/domain/request_messages/twitter_reply_request_message.py
|
59
|
+
src/h_message_bus/domain/request_messages/twitter_reply_response_message.py
|
60
|
+
src/h_message_bus/domain/request_messages/twitter_retweet_request_message.py
|
61
|
+
src/h_message_bus/domain/request_messages/twitter_retweet_response_message.py
|
52
62
|
src/h_message_bus/domain/request_messages/twitter_user_tweets_request_message.py
|
53
63
|
src/h_message_bus/domain/request_messages/twitter_user_tweets_response_message.py
|
54
64
|
src/h_message_bus/domain/request_messages/vector_query_collection_request_message.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_message_adapter.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_publisher_adapter.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/adapters/nats_subscriber_adapter.py
RENAMED
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_processor.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_publisher.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/application/message_subcriber.py
RENAMED
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/event_messages/__init__.py
RENAMED
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/event_message_topic.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/hai_message.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/models/vector_query_answer.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/domain/request_messages/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus/infrastructure/nats_config.py
RENAMED
File without changes
|
{h_message_bus-0.0.32 → h_message_bus-0.0.34}/src/h_message_bus.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|