scheme-sdk 0.3.5__tar.gz → 0.3.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: scheme_sdk
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: The Scheme SDK provides connectors for ingesting conversations, messages, and files across communication platforms.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "scheme_sdk"
7
- version = "0.3.5"
7
+ version = "0.3.6"
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" }
@@ -23,4 +23,13 @@ dev = [
23
23
  "black>=25.12.0",
24
24
  "isort>=7.0.0",
25
25
  "pre-commit>=4.5.1",
26
+ "pytest",
27
+ "python-dotenv>=1.2.1",
28
+ "responses",
29
+ ]
30
+
31
+ [tool.pytest.ini_options]
32
+ addopts = "-ra"
33
+ markers = [
34
+ "integration: tests that require real API credentials",
26
35
  ]
@@ -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
39
  "$select": "id,conversationId,subject,from,receivedDateTime,hasAttachments,webLink",
30
- "$orderby": "receivedDateTime desc",
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"],
File without changes
File without changes