unique_sdk 0.10.12__py3-none-any.whl → 0.10.14__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.
unique_sdk/__init__.py CHANGED
@@ -88,6 +88,10 @@ from unique_sdk.api_resources._message_assessment import (
88
88
  )
89
89
  from unique_sdk.api_resources._space import Space as Space
90
90
  from unique_sdk.api_resources._mcp import MCP as MCP
91
+ from unique_sdk.api_resources._message_execution import (
92
+ MessageExecution as MessageExecution,
93
+ )
94
+ from unique_sdk.api_resources._message_log import MessageLog as MessageLog
91
95
 
92
96
  # Unique QL
93
97
  from unique_sdk._unique_ql import UQLOperator as UQLOperator
@@ -135,6 +135,15 @@ class Folder(APIResource["Folder"]):
135
135
  scopeAccesses: List["Folder.ScopeAccess"]
136
136
  applyToSubScopes: bool
137
137
 
138
+ class DeleteFolderParams(TypedDict):
139
+ """
140
+ Parameters for deleting a folder.
141
+ """
142
+
143
+ scopeId: NotRequired[str]
144
+ folderPath: NotRequired[str]
145
+ recursive: NotRequired[bool]
146
+
138
147
  class GetParams(RequestOptions):
139
148
  """
140
149
  Parameters for getting a folder by its Id or path.
@@ -152,6 +161,24 @@ class Folder(APIResource["Folder"]):
152
161
  take: NotRequired[int]
153
162
  skip: NotRequired[int]
154
163
 
164
+ class DeleteFolderResponse(TypedDict):
165
+ """
166
+ Response for deleting a folder.
167
+ """
168
+
169
+ id: str
170
+ name: str
171
+ path: str
172
+ failReason: NotRequired[str]
173
+
174
+ class DeleteResponse(TypedDict):
175
+ """
176
+ Response for deleting a folder.
177
+ """
178
+
179
+ successFolders: List["Folder.DeleteFolderResponse"]
180
+ failedFolders: List["Folder.DeleteFolderResponse"]
181
+
155
182
  @classmethod
156
183
  def get_info(
157
184
  cls, user_id: str, company_id: str, **params: Unpack["Folder.GetParams"]
@@ -379,3 +406,86 @@ class Folder(APIResource["Folder"]):
379
406
  params=params,
380
407
  ),
381
408
  )
409
+
410
+ @classmethod
411
+ def delete(
412
+ cls,
413
+ user_id: str,
414
+ company_id: str,
415
+ **params: Unpack["Folder.DeleteFolderParams"],
416
+ ) -> "Folder.DeleteResponse":
417
+ """
418
+ Delete a folder by its ID or path.
419
+ """
420
+
421
+ scopeId = cls.resolve_scope_id(
422
+ user_id, company_id, params.get("scopeId"), params.get("folderPath")
423
+ )
424
+ params.pop("scopeId", None)
425
+ params.pop("folderPath", None)
426
+
427
+ return cast(
428
+ "Folder.DeleteResponse",
429
+ cls._static_request(
430
+ "delete",
431
+ f"{cls.RESOURCE_URL}/{scopeId}",
432
+ user_id,
433
+ company_id=company_id,
434
+ params=params,
435
+ ),
436
+ )
437
+
438
+ @classmethod
439
+ async def delete_async(
440
+ cls,
441
+ user_id: str,
442
+ company_id: str,
443
+ **params: Unpack["Folder.DeleteFolderParams"],
444
+ ) -> "Folder.DeleteResponse":
445
+ """
446
+ Async delete a folder by its ID or path.
447
+ """
448
+ scopeId = cls.resolve_scope_id(
449
+ user_id, company_id, params.get("scopeId"), params.get("folderPath")
450
+ )
451
+ params.pop("scopeId", None)
452
+ params.pop("folderPath", None)
453
+
454
+ return cast(
455
+ "Folder.DeleteResponse",
456
+ await cls._static_request_async(
457
+ "delete",
458
+ f"{cls.RESOURCE_URL}/{scopeId}",
459
+ user_id,
460
+ company_id=company_id,
461
+ params=params,
462
+ ),
463
+ )
464
+
465
+ @classmethod
466
+ def resolve_scope_id(
467
+ cls,
468
+ user_id: str,
469
+ company_id: str,
470
+ scope_id: str | None = None,
471
+ folder_path: str | None = None,
472
+ ) -> str | None:
473
+ """
474
+ Returns the scopeId to use: if scope_id is provided, returns it;
475
+ if not, but folder_path is provided, resolves and returns the id for that folder path.
476
+ """
477
+ if scope_id:
478
+ return scope_id
479
+ if folder_path:
480
+ folder_info = cls.get_info(
481
+ user_id=user_id,
482
+ company_id=company_id,
483
+ folderPath=folder_path,
484
+ )
485
+ resolved_id = folder_info.get("id")
486
+ if not resolved_id:
487
+ raise ValueError(
488
+ f"Could not find a folder with folderPath: {folder_path}"
489
+ )
490
+ return resolved_id
491
+ return None
@@ -0,0 +1,164 @@
1
+ from typing import ClassVar, Literal, Unpack, cast
2
+
3
+ from unique_sdk._api_resource import APIResource
4
+ from unique_sdk._request_options import RequestOptions
5
+
6
+
7
+ class MessageExecution(APIResource["MessageExecution"]):
8
+ OBJECT_NAME: ClassVar[Literal["message_execution"]] = "message_execution"
9
+ RESOURCE_URL = "/message-execution"
10
+
11
+ class CreateMessageExecutionParams(RequestOptions):
12
+ """
13
+ Parameters for creating a message execution.
14
+ """
15
+
16
+ messageId: str
17
+ chatId: str
18
+ type: Literal["DEEP_RESEARCH"] = "DEEP_RESEARCH"
19
+ secondsRemaining: int | None = None
20
+ percentageCompleted: int | None = None
21
+
22
+ class GetMessageExecutionParams(RequestOptions):
23
+ """
24
+ Parameters for getting a message execution.
25
+ """
26
+
27
+ messageId: str
28
+
29
+ class UpdateMessageExecutionParams(RequestOptions):
30
+ """
31
+ Parameters for updating a message execution.
32
+ """
33
+
34
+ messageId: str
35
+ status: Literal["COMPLETED", "FAILED"]
36
+ secondsRemaining: int | None = None
37
+ percentageCompleted: int | None = None
38
+
39
+ messageExecutionId: str | None
40
+ messageId: str | None
41
+ status: Literal["PENDING", "RUNNING", "COMPLETED", "FAILED"]
42
+ type: Literal["DEEP_RESEARCH"] = "DEEP_RESEARCH"
43
+ secondsRemaining: int | None
44
+ percentageCompleted: int | None
45
+ createdAt: str
46
+ updatedAt: str | None
47
+
48
+ @classmethod
49
+ def create(
50
+ cls,
51
+ user_id: str,
52
+ company_id: str,
53
+ **params: Unpack["MessageExecution.CreateMessageExecutionParams"],
54
+ ) -> "MessageExecution":
55
+ """
56
+ Create a MessageExecution.
57
+ """
58
+ return cast(
59
+ "MessageExecution",
60
+ cls._static_request(
61
+ "post",
62
+ cls.RESOURCE_URL,
63
+ user_id,
64
+ company_id,
65
+ params=params,
66
+ ),
67
+ )
68
+
69
+ @classmethod
70
+ async def create_async(
71
+ cls,
72
+ user_id: str,
73
+ company_id: str,
74
+ **params: Unpack["MessageExecution.CreateMessageExecutionParams"],
75
+ ) -> "MessageExecution":
76
+ """
77
+ Async create a MessageExecution.
78
+ """
79
+ return cast(
80
+ "MessageExecution",
81
+ await cls._static_request_async(
82
+ "post",
83
+ cls.RESOURCE_URL,
84
+ user_id,
85
+ company_id,
86
+ params=params,
87
+ ),
88
+ )
89
+
90
+ @classmethod
91
+ def get(
92
+ cls,
93
+ user_id: str,
94
+ company_id: str,
95
+ **params: Unpack["MessageExecution.GetMessageExecutionParams"],
96
+ ) -> "MessageExecution":
97
+ """
98
+ Get a MessageExecution by its ID.
99
+ """
100
+ return cast(
101
+ "MessageExecution",
102
+ cls._static_request(
103
+ "get", cls.RESOURCE_URL, user_id, company_id, params=params
104
+ ),
105
+ )
106
+
107
+ @classmethod
108
+ async def get_async(
109
+ cls,
110
+ user_id: str,
111
+ company_id: str,
112
+ **params: Unpack["MessageExecution.GetMessageExecutionParams"],
113
+ ) -> "MessageExecution":
114
+ """
115
+ Async get a MessageExecution by its ID.
116
+ """
117
+ return cast(
118
+ "MessageExecution",
119
+ await cls._static_request_async(
120
+ "get", cls.RESOURCE_URL, user_id, company_id, params=params
121
+ ),
122
+ )
123
+
124
+ @classmethod
125
+ def update(
126
+ cls,
127
+ user_id: str,
128
+ company_id: str,
129
+ **params: Unpack["MessageExecution.UpdateMessageExecutionParams"],
130
+ ) -> "MessageExecution":
131
+ """
132
+ Update a MessageExecution.
133
+ """
134
+ return cast(
135
+ "MessageExecution",
136
+ cls._static_request(
137
+ "patch",
138
+ cls.RESOURCE_URL,
139
+ user_id,
140
+ company_id,
141
+ params=params,
142
+ ),
143
+ )
144
+
145
+ @classmethod
146
+ async def update_async(
147
+ cls,
148
+ user_id: str,
149
+ company_id: str,
150
+ **params: Unpack["MessageExecution.UpdateMessageExecutionParams"],
151
+ ) -> "MessageExecution":
152
+ """
153
+ Async update a MessageExecution.
154
+ """
155
+ return cast(
156
+ "MessageExecution",
157
+ await cls._static_request_async(
158
+ "patch",
159
+ cls.RESOURCE_URL,
160
+ user_id,
161
+ company_id,
162
+ params=params,
163
+ ),
164
+ )
@@ -0,0 +1,138 @@
1
+ from typing import ClassVar, Literal, TypedDict, Unpack, cast
2
+
3
+ from unique_sdk._api_resource import APIResource
4
+ from unique_sdk._request_options import RequestOptions
5
+
6
+
7
+ class MessageLog(APIResource["MessageLog"]):
8
+ OBJECT_NAME: ClassVar[Literal["message_log"]] = "message_log"
9
+ RESOURCE_URL = "/message-log"
10
+
11
+ class Reference(TypedDict):
12
+ name: str
13
+ url: str | None
14
+ sequenceNumber: int
15
+ originalIndex: list[int] | None
16
+ sourceId: str
17
+ source: str
18
+
19
+ class CreateMessageLogParams(RequestOptions):
20
+ """
21
+ Parameters for creating a message log.
22
+ """
23
+
24
+ messageId: str
25
+ text: str
26
+ status: Literal["RUNNING", "COMPLETED", "FAILED"]
27
+ order: int
28
+ details: dict | None
29
+ uncitedReferences: dict | None
30
+ references: list["MessageLog.Reference"] | None
31
+
32
+ class UpdateMessageLogParams(RequestOptions):
33
+ """
34
+ Parameters for updating a message log.
35
+ """
36
+
37
+ text: str | None
38
+ status: Literal["RUNNING", "COMPLETED", "FAILED"] | None
39
+ order: int
40
+ details: dict | None
41
+ uncitedReferences: dict | None
42
+ references: list["MessageLog.Reference"] | None
43
+
44
+ messageLogId: str | None
45
+ messageId: str | None
46
+ status: Literal["RUNNING", "COMPLETED", "FAILED"]
47
+ text: str | None
48
+ details: dict
49
+ uncitedReferences: dict
50
+ order: int
51
+ createdAt: str
52
+ updatedAt: str | None
53
+
54
+ @classmethod
55
+ def create(
56
+ cls,
57
+ user_id: str,
58
+ company_id: str,
59
+ **params: Unpack["MessageLog.CreateMessageLogParams"],
60
+ ) -> "MessageLog":
61
+ """
62
+ Create a MessageLog.
63
+ """
64
+ return cast(
65
+ "MessageLog",
66
+ cls._static_request(
67
+ "post",
68
+ cls.RESOURCE_URL,
69
+ user_id,
70
+ company_id,
71
+ params=params,
72
+ ),
73
+ )
74
+
75
+ @classmethod
76
+ async def create_async(
77
+ cls,
78
+ user_id: str,
79
+ company_id: str,
80
+ **params: Unpack["MessageLog.CreateMessageLogParams"],
81
+ ) -> "MessageLog":
82
+ """
83
+ Async create a MessageLog.
84
+ """
85
+ return cast(
86
+ "MessageLog",
87
+ await cls._static_request_async(
88
+ "post",
89
+ cls.RESOURCE_URL,
90
+ user_id,
91
+ company_id,
92
+ params=params,
93
+ ),
94
+ )
95
+
96
+ @classmethod
97
+ def update(
98
+ cls,
99
+ user_id: str,
100
+ company_id: str,
101
+ message_log_id: str,
102
+ **params: Unpack["MessageLog.UpdateMessageLogParams"],
103
+ ) -> "MessageLog":
104
+ """
105
+ Update a MessageLog.
106
+ """
107
+ return cast(
108
+ "MessageLog",
109
+ cls._static_request(
110
+ "patch",
111
+ f"{cls.RESOURCE_URL}/{message_log_id}",
112
+ user_id,
113
+ company_id,
114
+ params=params,
115
+ ),
116
+ )
117
+
118
+ @classmethod
119
+ async def update_async(
120
+ cls,
121
+ user_id: str,
122
+ company_id: str,
123
+ message_log_id: str,
124
+ **params: Unpack["MessageLog.UpdateMessageLogParams"],
125
+ ) -> "MessageLog":
126
+ """
127
+ Async update a MessageLog.
128
+ """
129
+ return cast(
130
+ "MessageLog",
131
+ await cls._static_request_async(
132
+ "patch",
133
+ f"{cls.RESOURCE_URL}/{message_log_id}",
134
+ user_id,
135
+ company_id,
136
+ params=params,
137
+ ),
138
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.10.12
3
+ Version: 0.10.14
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -1080,6 +1080,34 @@ unique_sdk.Folder.remove_access(
1080
1080
  )
1081
1081
  ```
1082
1082
 
1083
+ #### `unique_sdk.Folder.delete` (Compatible with release >.36)
1084
+
1085
+ Given a `scopeId` or `folderPath`, the function deletes the folder. If the folder is not empty or if the user has no WRITE access, the delete will fail.
1086
+
1087
+ If `recursive` is set to true, the function also deletes its subfolders and its contents, behaving exactly like the `rm -rf`. In case a subfolder has no write access, that folder is considered as failed to delete and the function continues with the other subfolders. At the end, the function returns a list of `successFolders` and `failedFolders`.
1088
+
1089
+ Examples:
1090
+ Deleting recursively by scope id:
1091
+
1092
+ ```python
1093
+ unique_sdk.Folder.delete(
1094
+ user_id=user_id,
1095
+ company_id=company_id,
1096
+ scopeId="scope_w78wfn114va9o22s13r03yq",
1097
+ recursive=True
1098
+ )
1099
+ ```
1100
+
1101
+ Deleting by path (non-recursive):
1102
+
1103
+ ```python
1104
+ unique_sdk.Folder.delete(
1105
+ user_id=user_id,
1106
+ company_id=company_id,
1107
+ folderPath="/Company/Atlas/Due Dilligence/Arch",
1108
+ )
1109
+ ```
1110
+
1083
1111
  ### Space
1084
1112
 
1085
1113
  #### `unique_sdk.Space.delete_chat`
@@ -1488,6 +1516,12 @@ All notable changes to this project will be documented in this file.
1488
1516
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1489
1517
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1490
1518
 
1519
+ ## [0.10.14] - 2025-08-28
1520
+ - Add function to delete folders and files recursively
1521
+
1522
+ ## [0.10.13] - 2025-08-24
1523
+ - Add functions to create, get and update a message eecution and create and update a message log.
1524
+
1491
1525
  ## [0.10.12] - 2025-08-24
1492
1526
  - Switch to using Content get info deprecated endpoint to make sure we support older release versions.
1493
1527
 
@@ -1,4 +1,4 @@
1
- unique_sdk/__init__.py,sha256=kD6dQiLHr0eJKy5yzN0iRNO7N2v4n9TDv6h6DTHMzoo,3840
1
+ unique_sdk/__init__.py,sha256=iSHCv4LojvIth8YnDhlHvCH6MqeIa3ZQUMFdwj0ipyY,4017
2
2
  unique_sdk/_api_requestor.py,sha256=i4gCpzx8zP95sv-AhJfpQxKvWR0U-I6lclHyV55RPtg,14397
3
3
  unique_sdk/_api_resource.py,sha256=ytjomI-IVJwsbvdPyuZCfF-bl-Abgf66bu1D34YxCu8,6244
4
4
  unique_sdk/_api_version.py,sha256=Ku4JPdeyJtnX5eJJvRCEc1_u44UObdVrvrL1T-WwWCs,46
@@ -20,11 +20,13 @@ unique_sdk/api_resources/_chat_completion.py,sha256=ILCAffxkbkfh2iV9L4KKnfe80gZm
20
20
  unique_sdk/api_resources/_content.py,sha256=WQiNdBSE7pe9QV15NXy_kqhEHCqrjH7Xzk3eSK-456c,10723
21
21
  unique_sdk/api_resources/_embedding.py,sha256=C6qak7cCUBMBINfPhgH8taCJZ9n6w1MUElqDJJ8dG10,1281
22
22
  unique_sdk/api_resources/_event.py,sha256=bpWF9vstdoAWbUzr-iiGP713ceP0zPk77GJXiImf9zg,374
23
- unique_sdk/api_resources/_folder.py,sha256=rDO3rHNddvVWBhM4gaut9WN1A_hASJHiFiAS6a8MszU,9772
23
+ unique_sdk/api_resources/_folder.py,sha256=u_x6g8g_LQsRiJm7ExYuFBxNywfbhOtnSIVK0HwcDws,12820
24
24
  unique_sdk/api_resources/_integrated.py,sha256=z_DrftwjgVCi10QQqRYnG5_-95kD7Kfjogbb-dmnJuA,5854
25
25
  unique_sdk/api_resources/_mcp.py,sha256=zKh0dyn0QnkKk57N2zlGVN_GQoxEp5T2CS38vVm6jQY,3341
26
26
  unique_sdk/api_resources/_message.py,sha256=gEDIzg3METZU2k7m69meAuf0IWmZxnYOjbBKPRMwPYE,7688
27
27
  unique_sdk/api_resources/_message_assessment.py,sha256=SSfx6eW7zb_GKe8cFJzCqW-t-_eWEXxKP5cnIb0DhIc,2276
28
+ unique_sdk/api_resources/_message_execution.py,sha256=YzNy7l_BWs8mlEi9TlZL3D_KaecNNRpLmPLUnKeNoQ4,4425
29
+ unique_sdk/api_resources/_message_log.py,sha256=ImBz-b_WDT98NZf8W-gEP4YmjONkpCmX_iZoOjOJQwo,3541
28
30
  unique_sdk/api_resources/_search.py,sha256=GQItZKoGNOVZfkLLltBmsRZYBIreRKU0lGW8Kgpj1_Q,1959
29
31
  unique_sdk/api_resources/_search_string.py,sha256=4Idw6exgZdA8qksz9WkiA68k1hTU-7yFkgT_OLU_GkE,1662
30
32
  unique_sdk/api_resources/_short_term_memory.py,sha256=vPRN-Y0WPx74E6y-A3LocGc0TxJdzT-xGL66WzZwKRg,2820
@@ -34,7 +36,7 @@ unique_sdk/utils/chat_in_space.py,sha256=3NeBjOu7p43V_6PrjwxyaTkgknUS10KE4QRuTlF
34
36
  unique_sdk/utils/file_io.py,sha256=YY8B7VJcTLOPmCXByiOfNerXGlAtjCC5EVNmAbQJ3dQ,4306
35
37
  unique_sdk/utils/sources.py,sha256=DoxxhMLcLhmDfNarjXa41H4JD2GSSDywr71hiC-4pYc,4952
36
38
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
37
- unique_sdk-0.10.12.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
38
- unique_sdk-0.10.12.dist-info/METADATA,sha256=l4d5TX7cZpHkoDLMzELqS5Mem-WI1sLXkNHaiYtjPmk,50842
39
- unique_sdk-0.10.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
- unique_sdk-0.10.12.dist-info/RECORD,,
39
+ unique_sdk-0.10.14.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
40
+ unique_sdk-0.10.14.dist-info/METADATA,sha256=c86qxzAaH_N2geRx77kekrdWl7fTEL2oOvlBKXCfXWk,51988
41
+ unique_sdk-0.10.14.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
+ unique_sdk-0.10.14.dist-info/RECORD,,