scheme-sdk 0.3.4__py3-none-any.whl → 0.3.6__py3-none-any.whl
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.
scheme_sdk/connectors/outlook.py
CHANGED
|
@@ -23,17 +23,27 @@ class OutlookConnector(MessageConnector):
|
|
|
23
23
|
query: Optional[str] = None,
|
|
24
24
|
since_iso: Optional[str] = None,
|
|
25
25
|
) -> List[Dict]:
|
|
26
|
+
"""Fetch conversations from Outlook. Filter criteria are ignored if query is provided.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
top (int, optional): The number of conversations to fetch. Defaults to 50.
|
|
30
|
+
query (Optional[str], optional): The query to search for. Defaults to None.
|
|
31
|
+
since_iso (Optional[str], optional): The date to search for. Defaults to None.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
List[Dict]: The conversations.
|
|
35
|
+
"""
|
|
26
36
|
url = f"{self.base}/me/messages"
|
|
27
37
|
page_size = min(max(top, 50), 200)
|
|
28
38
|
params = {
|
|
29
|
-
"$select": "id,conversationId,subject,from,receivedDateTime,hasAttachments",
|
|
30
|
-
"$orderby": "receivedDateTime desc",
|
|
39
|
+
"$select": "id,conversationId,subject,from,receivedDateTime,hasAttachments,webLink",
|
|
31
40
|
"$top": str(page_size),
|
|
32
41
|
}
|
|
33
|
-
if since_iso:
|
|
34
|
-
params["$filter"] = f"receivedDateTime ge {since_iso}"
|
|
35
42
|
if query:
|
|
36
|
-
params["$search"] = query
|
|
43
|
+
params["$search"] = f'"{query}"'
|
|
44
|
+
elif since_iso:
|
|
45
|
+
params["$filter"] = f"receivedDateTime ge {since_iso}"
|
|
46
|
+
params["$orderby"] = "receivedDateTime desc"
|
|
37
47
|
|
|
38
48
|
# Dedupe by conversationId, fetching more pages until we have enough.
|
|
39
49
|
threads_by_conv: Dict[str, Dict] = {}
|
|
@@ -67,6 +77,15 @@ class OutlookConnector(MessageConnector):
|
|
|
67
77
|
conversation_id: str,
|
|
68
78
|
since_iso: Optional[str] = None,
|
|
69
79
|
) -> List[Dict]:
|
|
80
|
+
"""Fetch messages from a specific conversation.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
conversation_id (str): The ID of the conversation.
|
|
84
|
+
since_iso (Optional[str], optional): The date to search for. Defaults to None.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
List[Dict]: The messages.
|
|
88
|
+
"""
|
|
70
89
|
url = f"{self.base}/me/messages"
|
|
71
90
|
filter_parts = [f"conversationId eq '{conversation_id}'"]
|
|
72
91
|
if since_iso:
|
|
@@ -88,6 +107,14 @@ class OutlookConnector(MessageConnector):
|
|
|
88
107
|
]
|
|
89
108
|
|
|
90
109
|
def normalize_message(self, message: Dict) -> Dict[str, Any]:
|
|
110
|
+
"""Normalize a message from Outlook.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
message (Dict): The message to normalize.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Dict[str, Any]: The normalized message.
|
|
117
|
+
"""
|
|
91
118
|
return {
|
|
92
119
|
"title": message["subject"],
|
|
93
120
|
"platform": self.platform,
|
|
@@ -106,6 +133,14 @@ class OutlookConnector(MessageConnector):
|
|
|
106
133
|
}
|
|
107
134
|
|
|
108
135
|
def normalize_conversation(self, conversation: Dict) -> Dict[str, Any]:
|
|
136
|
+
"""Normalize a conversation from Outlook.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
conversation (Dict): The conversation to normalize.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Dict[str, Any]: The normalized conversation.
|
|
143
|
+
"""
|
|
109
144
|
return {
|
|
110
145
|
"id": conversation["conversationId"],
|
|
111
146
|
"title": conversation["subject"],
|
|
@@ -6,8 +6,8 @@ scheme_sdk/connectors/base/errors.py,sha256=53Dhz5qImXJe0q0cO7IqG4yja0OC0hnxMNMM
|
|
|
6
6
|
scheme_sdk/connectors/base/message.py,sha256=pW-snYsHlAQ5-qMFzAQr3CDaNG1Z-HRYB1fdmZww1TU,5423
|
|
7
7
|
scheme_sdk/connectors/discord.py,sha256=CdtzVlwT0aHcUayhLGno_vmfhdt_WRtGOeV2zj7Ye7I,844
|
|
8
8
|
scheme_sdk/connectors/gmail.py,sha256=wZCj917qujXSE9jexqvkDgdmz02y6QST8q9KNRwEvg0,866
|
|
9
|
-
scheme_sdk/connectors/outlook.py,sha256=
|
|
9
|
+
scheme_sdk/connectors/outlook.py,sha256=t9VeDLVlpHFMD-poNHAzEyh0bQE4e5e_5ZZS1BNcfNw,7411
|
|
10
10
|
scheme_sdk/connectors/slack.py,sha256=_g--XxS4_ImT0fs0HX9vNquTkUlaikiylBhsgJzCC-4,1434
|
|
11
|
-
scheme_sdk-0.3.
|
|
12
|
-
scheme_sdk-0.3.
|
|
13
|
-
scheme_sdk-0.3.
|
|
11
|
+
scheme_sdk-0.3.6.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
|
|
12
|
+
scheme_sdk-0.3.6.dist-info/METADATA,sha256=zJ34_ss59stOeOTmWMX1kQi73_WC0_WGtc3XLPWpyuc,15084
|
|
13
|
+
scheme_sdk-0.3.6.dist-info/RECORD,,
|
|
File without changes
|