scheme-sdk 0.3.0__tar.gz → 0.3.2__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.
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/PKG-INFO +1 -1
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/pyproject.toml +1 -1
- scheme_sdk-0.3.2/src/scheme_sdk/__init__.py +1 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/outlook.py +32 -11
- scheme_sdk-0.3.0/src/scheme_sdk/__init__.py +0 -1
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/LICENSE +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/README.md +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/__init__.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/base/__init__.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/base/base.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/base/errors.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/base/message.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/discord.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/gmail.py +0 -0
- {scheme_sdk-0.3.0 → scheme_sdk-0.3.2}/src/scheme_sdk/connectors/slack.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scheme_sdk"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
8
8
|
description = "The Scheme SDK provides connectors for ingesting conversations, messages, and files across communication platforms."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .connectors import *
|
|
@@ -18,33 +18,54 @@ class OutlookConnector(MessageConnector):
|
|
|
18
18
|
self.base = "https://graph.microsoft.com/v1.0"
|
|
19
19
|
|
|
20
20
|
def fetch_conversations(
|
|
21
|
-
self,
|
|
21
|
+
self,
|
|
22
|
+
top: int = 50,
|
|
23
|
+
query: Optional[str] = None,
|
|
24
|
+
since_iso: Optional[str] = None,
|
|
22
25
|
) -> List[Dict]:
|
|
23
26
|
url = f"{self.base}/me/messages"
|
|
27
|
+
page_size = min(max(top, 50), 200)
|
|
24
28
|
params = {
|
|
25
29
|
"$select": "id,conversationId,subject,from,receivedDateTime,hasAttachments",
|
|
26
30
|
"$orderby": "receivedDateTime desc",
|
|
27
|
-
"$top": str(
|
|
31
|
+
"$top": str(page_size),
|
|
28
32
|
}
|
|
29
33
|
if since_iso:
|
|
30
34
|
params["$filter"] = f"receivedDateTime ge {since_iso}"
|
|
35
|
+
if query:
|
|
36
|
+
params["$search"] = query
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# Dedupe by conversationId
|
|
38
|
+
# Dedupe by conversationId, fetching more pages until we have enough.
|
|
35
39
|
threads_by_conv: Dict[str, Dict] = {}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
next_url = url
|
|
41
|
+
next_params: Optional[Dict[str, str]] = params
|
|
42
|
+
|
|
43
|
+
while next_url and len(threads_by_conv) < top:
|
|
44
|
+
resp = self._request_with_throttling_retry(
|
|
45
|
+
next_url, headers=self._headers(), params=next_params
|
|
46
|
+
)
|
|
47
|
+
resp.raise_for_status()
|
|
48
|
+
data = resp.json()
|
|
49
|
+
|
|
50
|
+
for m in data.get("value", []):
|
|
51
|
+
cid = m.get("conversationId")
|
|
52
|
+
if not cid or cid in threads_by_conv:
|
|
53
|
+
continue
|
|
41
54
|
threads_by_conv[cid] = m
|
|
55
|
+
if len(threads_by_conv) >= top:
|
|
56
|
+
break
|
|
57
|
+
|
|
58
|
+
# Per Graph guidance: use @odata.nextLink as-is
|
|
59
|
+
next_url = data.get("@odata.nextLink")
|
|
60
|
+
next_params = None # nextLink already includes the query string
|
|
42
61
|
|
|
43
62
|
conv_list = list(threads_by_conv.values())
|
|
44
63
|
return [self.normalize_conversation(c) for c in conv_list]
|
|
45
64
|
|
|
46
65
|
def fetch_messages(
|
|
47
|
-
self,
|
|
66
|
+
self,
|
|
67
|
+
conversation_id: str,
|
|
68
|
+
since_iso: Optional[str] = None,
|
|
48
69
|
) -> List[Dict]:
|
|
49
70
|
url = f"{self.base}/me/messages"
|
|
50
71
|
filter_parts = [f"conversationId eq '{conversation_id}'"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from connectors import *
|
|
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
|