unique_sdk 0.10.19__py3-none-any.whl → 0.10.71__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.
Potentially problematic release.
This version of unique_sdk might be problematic. Click here for more details.
- unique_sdk/__init__.py +3 -0
- unique_sdk/api_resources/_agentic_table.py +33 -20
- unique_sdk/api_resources/_content.py +192 -42
- unique_sdk/api_resources/_folder.py +308 -46
- unique_sdk/api_resources/_group.py +429 -0
- unique_sdk/api_resources/_integrated.py +49 -48
- unique_sdk/api_resources/_llm_models.py +64 -0
- unique_sdk/api_resources/_mcp.py +2 -0
- unique_sdk/api_resources/_message.py +96 -3
- unique_sdk/api_resources/_message_execution.py +24 -14
- unique_sdk/api_resources/_message_log.py +46 -19
- unique_sdk/api_resources/_search_string.py +0 -1
- unique_sdk/api_resources/_space.py +387 -8
- unique_sdk/api_resources/_user.py +195 -0
- unique_sdk/utils/chat_in_space.py +30 -28
- unique_sdk/utils/file_io.py +42 -1
- unique_sdk-0.10.71.dist-info/METADATA +389 -0
- {unique_sdk-0.10.19.dist-info → unique_sdk-0.10.71.dist-info}/RECORD +20 -17
- unique_sdk-0.10.19.dist-info/METADATA +0 -1774
- {unique_sdk-0.10.19.dist-info → unique_sdk-0.10.71.dist-info}/LICENSE +0 -0
- {unique_sdk-0.10.19.dist-info → unique_sdk-0.10.71.dist-info}/WHEEL +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
1
|
from typing import (
|
|
3
2
|
ClassVar,
|
|
4
3
|
List,
|
|
@@ -23,26 +22,10 @@ class Folder(APIResource["Folder"]):
|
|
|
23
22
|
Represents the access level of a scope.
|
|
24
23
|
"""
|
|
25
24
|
|
|
26
|
-
class ScopeAccessType(Enum):
|
|
27
|
-
"""
|
|
28
|
-
Enum for scope access levels.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
READ = "READ"
|
|
32
|
-
WRITE = "WRITE"
|
|
33
|
-
|
|
34
|
-
class ScopeAccessEntityType(Enum):
|
|
35
|
-
"""
|
|
36
|
-
Enum for scope access entity types.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
USER = "USER"
|
|
40
|
-
GROUP = "GROUP"
|
|
41
|
-
|
|
42
25
|
entityId: str
|
|
43
|
-
type:
|
|
44
|
-
entityType:
|
|
45
|
-
createdAt: str
|
|
26
|
+
type: Literal["READ", "WRITE"]
|
|
27
|
+
entityType: Literal["USER", "GROUP"]
|
|
28
|
+
createdAt: NotRequired[str]
|
|
46
29
|
|
|
47
30
|
class Children(TypedDict):
|
|
48
31
|
"""
|
|
@@ -61,19 +44,19 @@ class Folder(APIResource["Folder"]):
|
|
|
61
44
|
languageModel: str | None
|
|
62
45
|
|
|
63
46
|
class IngestionConfig(TypedDict):
|
|
64
|
-
chunkMaxTokens: int | None
|
|
65
|
-
chunkMaxTokensOnePager: int | None
|
|
66
|
-
chunkMinTokens: int | None
|
|
67
|
-
chunkStrategy: str | None
|
|
68
|
-
customApiOptions: List["Folder.CustomApiOptions"] | None
|
|
69
|
-
documentMinTokens: int | None
|
|
70
|
-
excelReadMode: str | None
|
|
71
|
-
jpgReadMode: str | None
|
|
72
|
-
pdfReadMode: str | None
|
|
73
|
-
pptReadMode: str | None
|
|
47
|
+
chunkMaxTokens: NotRequired[int | None]
|
|
48
|
+
chunkMaxTokensOnePager: NotRequired[int | None]
|
|
49
|
+
chunkMinTokens: NotRequired[int | None]
|
|
50
|
+
chunkStrategy: NotRequired[str | None]
|
|
51
|
+
customApiOptions: NotRequired[List["Folder.CustomApiOptions"] | None]
|
|
52
|
+
documentMinTokens: NotRequired[int | None]
|
|
53
|
+
excelReadMode: NotRequired[str | None]
|
|
54
|
+
jpgReadMode: NotRequired[str | None]
|
|
55
|
+
pdfReadMode: NotRequired[str | None]
|
|
56
|
+
pptReadMode: NotRequired[str | None]
|
|
74
57
|
uniqueIngestionMode: str
|
|
75
|
-
vttConfig:
|
|
76
|
-
wordReadMode: str | None
|
|
58
|
+
vttConfig: NotRequired["Folder.VttConfig | None"]
|
|
59
|
+
wordReadMode: NotRequired[str | None]
|
|
77
60
|
|
|
78
61
|
class CreatedFolder(TypedDict):
|
|
79
62
|
id: str
|
|
@@ -86,6 +69,7 @@ class Folder(APIResource["Folder"]):
|
|
|
86
69
|
|
|
87
70
|
class CreateParams(RequestOptions):
|
|
88
71
|
paths: List[str]
|
|
72
|
+
inheritAccess: NotRequired[bool]
|
|
89
73
|
|
|
90
74
|
class FolderInfo(TypedDict):
|
|
91
75
|
"""
|
|
@@ -100,6 +84,10 @@ class Folder(APIResource["Folder"]):
|
|
|
100
84
|
parentId: str | None
|
|
101
85
|
externalId: str | None
|
|
102
86
|
|
|
87
|
+
class FolderInfos(TypedDict):
|
|
88
|
+
folderInfos: List["Folder.FolderInfo"]
|
|
89
|
+
totalCount: int
|
|
90
|
+
|
|
103
91
|
id: str
|
|
104
92
|
name: str
|
|
105
93
|
scopeAccess: List[ScopeAccess]
|
|
@@ -110,8 +98,8 @@ class Folder(APIResource["Folder"]):
|
|
|
110
98
|
Parameters for updating folder ingestion config.
|
|
111
99
|
"""
|
|
112
100
|
|
|
113
|
-
scopeId: str | None
|
|
114
|
-
folderPath: str | None
|
|
101
|
+
scopeId: NotRequired[str | None]
|
|
102
|
+
folderPath: NotRequired[str | None]
|
|
115
103
|
ingestionConfig: "Folder.IngestionConfig"
|
|
116
104
|
applyToSubScopes: bool
|
|
117
105
|
|
|
@@ -120,8 +108,8 @@ class Folder(APIResource["Folder"]):
|
|
|
120
108
|
Parameters for adding access to a folder.
|
|
121
109
|
"""
|
|
122
110
|
|
|
123
|
-
scopeId: str | None
|
|
124
|
-
folderPath: str | None
|
|
111
|
+
scopeId: NotRequired[str | None]
|
|
112
|
+
folderPath: NotRequired[str | None]
|
|
125
113
|
scopeAccesses: List["Folder.ScopeAccess"]
|
|
126
114
|
applyToSubScopes: bool
|
|
127
115
|
|
|
@@ -130,8 +118,8 @@ class Folder(APIResource["Folder"]):
|
|
|
130
118
|
Parameters for removing access from a folder.
|
|
131
119
|
"""
|
|
132
120
|
|
|
133
|
-
scopeId: str | None
|
|
134
|
-
folderPath: str | None
|
|
121
|
+
scopeId: NotRequired[str | None]
|
|
122
|
+
folderPath: NotRequired[str | None]
|
|
135
123
|
scopeAccesses: List["Folder.ScopeAccess"]
|
|
136
124
|
applyToSubScopes: bool
|
|
137
125
|
|
|
@@ -149,8 +137,19 @@ class Folder(APIResource["Folder"]):
|
|
|
149
137
|
Parameters for getting a folder by its Id or path.
|
|
150
138
|
"""
|
|
151
139
|
|
|
152
|
-
scopeId: str
|
|
153
|
-
folderPath: str
|
|
140
|
+
scopeId: NotRequired[str]
|
|
141
|
+
folderPath: NotRequired[str]
|
|
142
|
+
|
|
143
|
+
class UpdateParams(RequestOptions):
|
|
144
|
+
"""
|
|
145
|
+
Parameters for updating a folder.
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
scopeId: NotRequired[str]
|
|
149
|
+
folderPath: NotRequired[str]
|
|
150
|
+
parentFolderPath: NotRequired[str]
|
|
151
|
+
parentId: NotRequired[str]
|
|
152
|
+
name: NotRequired[str]
|
|
154
153
|
|
|
155
154
|
class GetInfosParams(RequestOptions):
|
|
156
155
|
"""
|
|
@@ -158,6 +157,7 @@ class Folder(APIResource["Folder"]):
|
|
|
158
157
|
"""
|
|
159
158
|
|
|
160
159
|
parentId: NotRequired[str]
|
|
160
|
+
parentFolderPath: NotRequired[str]
|
|
161
161
|
take: NotRequired[int]
|
|
162
162
|
skip: NotRequired[int]
|
|
163
163
|
|
|
@@ -179,6 +179,53 @@ class Folder(APIResource["Folder"]):
|
|
|
179
179
|
successFolders: List["Folder.DeleteFolderResponse"]
|
|
180
180
|
failedFolders: List["Folder.DeleteFolderResponse"]
|
|
181
181
|
|
|
182
|
+
class FolderPathResponse(TypedDict):
|
|
183
|
+
"""
|
|
184
|
+
Response for getting folder path.
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
folderPath: str
|
|
188
|
+
|
|
189
|
+
@classmethod
|
|
190
|
+
def get_folder_path(
|
|
191
|
+
cls,
|
|
192
|
+
user_id: str,
|
|
193
|
+
company_id: str,
|
|
194
|
+
scope_id: str,
|
|
195
|
+
) -> "Folder.FolderPathResponse":
|
|
196
|
+
"""
|
|
197
|
+
Get the complete folder path for a given folder ID.
|
|
198
|
+
"""
|
|
199
|
+
return cast(
|
|
200
|
+
"Folder.FolderPathResponse",
|
|
201
|
+
cls._static_request(
|
|
202
|
+
"get",
|
|
203
|
+
f"/folder/{scope_id}/path",
|
|
204
|
+
user_id,
|
|
205
|
+
company_id,
|
|
206
|
+
),
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
@classmethod
|
|
210
|
+
async def get_folder_path_async(
|
|
211
|
+
cls,
|
|
212
|
+
user_id: str,
|
|
213
|
+
company_id: str,
|
|
214
|
+
scope_id: str,
|
|
215
|
+
) -> "Folder.FolderPathResponse":
|
|
216
|
+
"""
|
|
217
|
+
Async get the complete folder path for a given folder ID.
|
|
218
|
+
"""
|
|
219
|
+
return cast(
|
|
220
|
+
"Folder.FolderPathResponse",
|
|
221
|
+
await cls._static_request_async(
|
|
222
|
+
"get",
|
|
223
|
+
f"/folder/{scope_id}/path",
|
|
224
|
+
user_id,
|
|
225
|
+
company_id,
|
|
226
|
+
),
|
|
227
|
+
)
|
|
228
|
+
|
|
182
229
|
@classmethod
|
|
183
230
|
def get_info(
|
|
184
231
|
cls, user_id: str, company_id: str, **params: Unpack["Folder.GetParams"]
|
|
@@ -218,12 +265,22 @@ class Folder(APIResource["Folder"]):
|
|
|
218
265
|
@classmethod
|
|
219
266
|
def get_infos(
|
|
220
267
|
cls, user_id: str, company_id: str, **params: Unpack["Folder.GetInfosParams"]
|
|
221
|
-
) -> "
|
|
268
|
+
) -> "Folder.FolderInfos":
|
|
222
269
|
"""
|
|
223
270
|
Get paginated folders based on parentId. If the parentId is not defined, the root folders will be returned.
|
|
224
271
|
"""
|
|
272
|
+
parent_id = cls.resolve_scope_id_from_folder_path(
|
|
273
|
+
user_id=user_id,
|
|
274
|
+
company_id=company_id,
|
|
275
|
+
scope_id=params.get("parentId"),
|
|
276
|
+
folder_path=params.get("parentFolderPath"),
|
|
277
|
+
)
|
|
278
|
+
params.pop("parentFolderPath", None)
|
|
279
|
+
if parent_id:
|
|
280
|
+
params["parentId"] = parent_id
|
|
281
|
+
|
|
225
282
|
return cast(
|
|
226
|
-
"
|
|
283
|
+
"Folder.FolderInfos",
|
|
227
284
|
cls._static_request(
|
|
228
285
|
"get",
|
|
229
286
|
"/folder/infos",
|
|
@@ -236,12 +293,22 @@ class Folder(APIResource["Folder"]):
|
|
|
236
293
|
@classmethod
|
|
237
294
|
async def get_infos_async(
|
|
238
295
|
cls, user_id: str, company_id: str, **params: Unpack["Folder.GetInfosParams"]
|
|
239
|
-
) -> "
|
|
296
|
+
) -> "Folder.FolderInfos":
|
|
240
297
|
"""
|
|
241
298
|
Async get paginated folders based on parentId. If the parentId is not defined, the root folders will be returned.
|
|
242
299
|
"""
|
|
300
|
+
parent_id = await cls.resolve_scope_id_from_folder_path_async(
|
|
301
|
+
user_id=user_id,
|
|
302
|
+
company_id=company_id,
|
|
303
|
+
scope_id=params.get("parentId"),
|
|
304
|
+
folder_path=params.get("parentFolderPath"),
|
|
305
|
+
)
|
|
306
|
+
params.pop("parentFolderPath", None)
|
|
307
|
+
if parent_id:
|
|
308
|
+
params["parentId"] = parent_id
|
|
309
|
+
|
|
243
310
|
return cast(
|
|
244
|
-
"
|
|
311
|
+
"Folder.FolderInfos",
|
|
245
312
|
await cls._static_request_async(
|
|
246
313
|
"get",
|
|
247
314
|
"/folder/infos",
|
|
@@ -256,7 +323,7 @@ class Folder(APIResource["Folder"]):
|
|
|
256
323
|
cls, user_id: str, company_id: str, **params: Unpack["Folder.CreateParams"]
|
|
257
324
|
) -> "Folder.CreateFolderStructureResponse":
|
|
258
325
|
return cast(
|
|
259
|
-
"Folder",
|
|
326
|
+
"Folder.CreateFolderStructureResponse",
|
|
260
327
|
cls._static_request(
|
|
261
328
|
"post",
|
|
262
329
|
cls.RESOURCE_URL,
|
|
@@ -271,7 +338,7 @@ class Folder(APIResource["Folder"]):
|
|
|
271
338
|
cls, user_id: str, company_id: str, **params: Unpack["Folder.CreateParams"]
|
|
272
339
|
) -> "Folder.CreateFolderStructureResponse":
|
|
273
340
|
return cast(
|
|
274
|
-
"Folder",
|
|
341
|
+
"Folder.CreateFolderStructureResponse",
|
|
275
342
|
await cls._static_request_async(
|
|
276
343
|
"post",
|
|
277
344
|
cls.RESOURCE_URL,
|
|
@@ -407,6 +474,84 @@ class Folder(APIResource["Folder"]):
|
|
|
407
474
|
),
|
|
408
475
|
)
|
|
409
476
|
|
|
477
|
+
@classmethod
|
|
478
|
+
def update(
|
|
479
|
+
cls,
|
|
480
|
+
user_id: str,
|
|
481
|
+
company_id: str,
|
|
482
|
+
**params: Unpack["Folder.UpdateParams"],
|
|
483
|
+
) -> "Folder.FolderInfo":
|
|
484
|
+
"""
|
|
485
|
+
Update a folder given its id or path. Can update the name or the parent folder by specifying its id or path.
|
|
486
|
+
"""
|
|
487
|
+
|
|
488
|
+
scopeId = cls.resolve_scope_id_from_folder_path(
|
|
489
|
+
user_id=user_id,
|
|
490
|
+
company_id=company_id,
|
|
491
|
+
scope_id=params.get("scopeId"),
|
|
492
|
+
folder_path=params.get("folderPath"),
|
|
493
|
+
)
|
|
494
|
+
parentId = cls.resolve_scope_id_from_folder_path(
|
|
495
|
+
user_id=user_id,
|
|
496
|
+
company_id=company_id,
|
|
497
|
+
scope_id=params.get("parentId"),
|
|
498
|
+
folder_path=params.get("parentFolderPath"),
|
|
499
|
+
)
|
|
500
|
+
params.pop("folderPath", None)
|
|
501
|
+
params.pop("parentFolderPath", None)
|
|
502
|
+
if parentId:
|
|
503
|
+
params["parentId"] = parentId
|
|
504
|
+
|
|
505
|
+
return cast(
|
|
506
|
+
"Folder.FolderInfo",
|
|
507
|
+
cls._static_request(
|
|
508
|
+
"patch",
|
|
509
|
+
f"{cls.RESOURCE_URL}/{scopeId}",
|
|
510
|
+
user_id,
|
|
511
|
+
company_id=company_id,
|
|
512
|
+
params=params,
|
|
513
|
+
),
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
@classmethod
|
|
517
|
+
async def update_async(
|
|
518
|
+
cls,
|
|
519
|
+
user_id: str,
|
|
520
|
+
company_id: str,
|
|
521
|
+
**params: Unpack["Folder.UpdateParams"],
|
|
522
|
+
) -> "Folder.FolderInfo":
|
|
523
|
+
"""
|
|
524
|
+
Async update a folder given its id or path. Can update the name or the parent folder by specifying its id or path.
|
|
525
|
+
"""
|
|
526
|
+
|
|
527
|
+
scopeId = cls.resolve_scope_id_from_folder_path(
|
|
528
|
+
user_id=user_id,
|
|
529
|
+
company_id=company_id,
|
|
530
|
+
scope_id=params.get("scopeId"),
|
|
531
|
+
folder_path=params.get("folderPath"),
|
|
532
|
+
)
|
|
533
|
+
parentId = cls.resolve_scope_id_from_folder_path(
|
|
534
|
+
user_id=user_id,
|
|
535
|
+
company_id=company_id,
|
|
536
|
+
scope_id=params.get("parentId"),
|
|
537
|
+
folder_path=params.get("parentFolderPath"),
|
|
538
|
+
)
|
|
539
|
+
params.pop("folderPath", None)
|
|
540
|
+
params.pop("parentFolderPath", None)
|
|
541
|
+
if parentId:
|
|
542
|
+
params["parentId"] = parentId
|
|
543
|
+
|
|
544
|
+
return cast(
|
|
545
|
+
"Folder.FolderInfo",
|
|
546
|
+
await cls._static_request_async(
|
|
547
|
+
"patch",
|
|
548
|
+
f"{cls.RESOURCE_URL}/{scopeId}",
|
|
549
|
+
user_id,
|
|
550
|
+
company_id=company_id,
|
|
551
|
+
params=params,
|
|
552
|
+
),
|
|
553
|
+
)
|
|
554
|
+
|
|
410
555
|
@classmethod
|
|
411
556
|
def delete(
|
|
412
557
|
cls,
|
|
@@ -473,6 +618,10 @@ class Folder(APIResource["Folder"]):
|
|
|
473
618
|
"""
|
|
474
619
|
Returns the scopeId to use: if scope_id is provided, returns it;
|
|
475
620
|
if not, but folder_path is provided, resolves and returns the id for that folder path.
|
|
621
|
+
|
|
622
|
+
Returns:
|
|
623
|
+
str: The resolved folder ID.
|
|
624
|
+
None: Failed to resolve a folder ID (e.g., folder_path not found or not provided).
|
|
476
625
|
"""
|
|
477
626
|
if scope_id:
|
|
478
627
|
return scope_id
|
|
@@ -489,3 +638,116 @@ class Folder(APIResource["Folder"]):
|
|
|
489
638
|
)
|
|
490
639
|
return resolved_id
|
|
491
640
|
return None
|
|
641
|
+
|
|
642
|
+
@classmethod
|
|
643
|
+
def resolve_scope_id_from_folder_path_with_create(
|
|
644
|
+
cls,
|
|
645
|
+
user_id: str,
|
|
646
|
+
company_id: str,
|
|
647
|
+
scope_id: str | None = None,
|
|
648
|
+
folder_path: str | None = None,
|
|
649
|
+
create_if_not_exists: bool = True,
|
|
650
|
+
) -> str | None:
|
|
651
|
+
if scope_id:
|
|
652
|
+
return scope_id
|
|
653
|
+
if folder_path:
|
|
654
|
+
try:
|
|
655
|
+
folder_info = cls.get_info(
|
|
656
|
+
user_id=user_id,
|
|
657
|
+
company_id=company_id,
|
|
658
|
+
folderPath=folder_path,
|
|
659
|
+
)
|
|
660
|
+
resolved_id = folder_info.get("id")
|
|
661
|
+
if resolved_id:
|
|
662
|
+
return resolved_id
|
|
663
|
+
except Exception:
|
|
664
|
+
pass
|
|
665
|
+
|
|
666
|
+
if create_if_not_exists:
|
|
667
|
+
result = cls.create_paths(
|
|
668
|
+
user_id=user_id,
|
|
669
|
+
company_id=company_id,
|
|
670
|
+
paths=[folder_path],
|
|
671
|
+
)
|
|
672
|
+
created_folders = result.get("createdFolders", [])
|
|
673
|
+
if created_folders:
|
|
674
|
+
return created_folders[-1]["id"]
|
|
675
|
+
raise ValueError(
|
|
676
|
+
f"Failed to create folder with folderPath: {folder_path}"
|
|
677
|
+
)
|
|
678
|
+
|
|
679
|
+
raise ValueError(f"Could not find a folder with folderPath: {folder_path}")
|
|
680
|
+
return None
|
|
681
|
+
|
|
682
|
+
@classmethod
|
|
683
|
+
async def resolve_scope_id_from_folder_path_async(
|
|
684
|
+
cls,
|
|
685
|
+
user_id: str,
|
|
686
|
+
company_id: str,
|
|
687
|
+
scope_id: str | None = None,
|
|
688
|
+
folder_path: str | None = None,
|
|
689
|
+
) -> str | None:
|
|
690
|
+
"""
|
|
691
|
+
Async version of resolve_scope_id_from_folder_path.
|
|
692
|
+
Returns the scopeId to use: if scope_id is provided, returns it;
|
|
693
|
+
if not, but folder_path is provided, resolves and returns the id for that folder path.
|
|
694
|
+
|
|
695
|
+
Returns:
|
|
696
|
+
str: The resolved folder ID.
|
|
697
|
+
None: Failed to resolve a folder ID (e.g., folder_path not found or not provided).
|
|
698
|
+
"""
|
|
699
|
+
if scope_id:
|
|
700
|
+
return scope_id
|
|
701
|
+
if folder_path:
|
|
702
|
+
folder_info = await cls.get_info_async(
|
|
703
|
+
user_id=user_id,
|
|
704
|
+
company_id=company_id,
|
|
705
|
+
folderPath=folder_path,
|
|
706
|
+
)
|
|
707
|
+
resolved_id = folder_info.get("id")
|
|
708
|
+
if not resolved_id:
|
|
709
|
+
raise ValueError(
|
|
710
|
+
f"Could not find a folder with folderPath: {folder_path}"
|
|
711
|
+
)
|
|
712
|
+
return resolved_id
|
|
713
|
+
return None
|
|
714
|
+
|
|
715
|
+
@classmethod
|
|
716
|
+
async def resolve_scope_id_from_folder_path_with_create_async(
|
|
717
|
+
cls,
|
|
718
|
+
user_id: str,
|
|
719
|
+
company_id: str,
|
|
720
|
+
scope_id: str | None = None,
|
|
721
|
+
folder_path: str | None = None,
|
|
722
|
+
create_if_not_exists: bool = True,
|
|
723
|
+
) -> str | None:
|
|
724
|
+
if scope_id:
|
|
725
|
+
return scope_id
|
|
726
|
+
if folder_path:
|
|
727
|
+
try:
|
|
728
|
+
folder_info = await cls.get_info_async(
|
|
729
|
+
user_id=user_id,
|
|
730
|
+
company_id=company_id,
|
|
731
|
+
folderPath=folder_path,
|
|
732
|
+
)
|
|
733
|
+
resolved_id = folder_info.get("id")
|
|
734
|
+
if resolved_id:
|
|
735
|
+
return resolved_id
|
|
736
|
+
except Exception:
|
|
737
|
+
pass
|
|
738
|
+
|
|
739
|
+
if create_if_not_exists:
|
|
740
|
+
result = await cls.create_paths_async(
|
|
741
|
+
user_id=user_id,
|
|
742
|
+
company_id=company_id,
|
|
743
|
+
paths=[folder_path],
|
|
744
|
+
)
|
|
745
|
+
created_folders = result.get("createdFolders", [])
|
|
746
|
+
if created_folders:
|
|
747
|
+
return created_folders[-1]["id"]
|
|
748
|
+
raise ValueError(
|
|
749
|
+
f"Failed to create folder with folderPath: {folder_path}"
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
raise ValueError(f"Could not find a folder with folderPath: {folder_path}")
|
|
753
|
+
return None
|