unique_sdk 0.10.24__py3-none-any.whl → 0.10.25__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.

@@ -12,6 +12,7 @@ from typing import (
12
12
 
13
13
  from typing_extensions import NotRequired, Unpack
14
14
 
15
+ import unique_sdk
15
16
  from unique_sdk._api_resource import APIResource
16
17
  from unique_sdk._request_options import RequestOptions
17
18
 
@@ -81,7 +82,7 @@ class Content(APIResource["Content"]):
81
82
  This is used to retrieve information about content based on various filters.
82
83
  """
83
84
 
84
- metadataFilter: dict
85
+ metadataFilter: NotRequired[dict]
85
86
  skip: NotRequired[int]
86
87
  take: NotRequired[int]
87
88
  filePath: NotRequired[str]
@@ -117,7 +118,7 @@ class Content(APIResource["Content"]):
117
118
  ownerId: str
118
119
  byteSize: Optional[int]
119
120
  ingestionConfig: "Content.IngestionConfig"
120
- metadata: dict[str, Any] | None = None
121
+ metadata: NotRequired[dict[str, str | None]]
121
122
 
122
123
  class UpsertParams(RequestOptions):
123
124
  input: "Content.Input"
@@ -129,7 +130,9 @@ class Content(APIResource["Content"]):
129
130
 
130
131
  class UpdateParams(RequestOptions):
131
132
  contentId: NotRequired[str]
133
+ filePath: NotRequired[str]
132
134
  ownerId: NotRequired[str]
135
+ parentFolderPath: NotRequired[str]
133
136
  title: NotRequired[str]
134
137
  metadata: NotRequired[dict[str, str | None]]
135
138
 
@@ -161,11 +164,16 @@ class Content(APIResource["Content"]):
161
164
  expiredAt: str | None
162
165
 
163
166
  class PaginatedContentInfo(TypedDict):
167
+ contentInfo: List["Content.ContentInfo"]
168
+ totalCount: int
169
+
170
+ class PaginatedContentInfos(TypedDict):
164
171
  contentInfos: List["Content.ContentInfo"]
165
172
  totalCount: int
166
173
 
167
174
  class DeleteParams(RequestOptions):
168
175
  contentId: NotRequired[str]
176
+ filePath: NotRequired[str]
169
177
  chatId: NotRequired[str]
170
178
 
171
179
  class DeleteResponse(TypedDict):
@@ -284,9 +292,9 @@ class Content(APIResource["Content"]):
284
292
  user_id: str,
285
293
  company_id: str,
286
294
  **params: Unpack["Content.ContentInfoParams"],
287
- ) -> "Content.PaginatedContentInfo":
295
+ ) -> "Content.PaginatedContentInfos":
288
296
  return cast(
289
- Content.PaginatedContentInfo,
297
+ Content.PaginatedContentInfos,
290
298
  cls._static_request(
291
299
  "post",
292
300
  "/content/infos",
@@ -302,9 +310,9 @@ class Content(APIResource["Content"]):
302
310
  user_id: str,
303
311
  company_id: str,
304
312
  **params: Unpack["Content.ContentInfoParams"],
305
- ) -> "Content.PaginatedContentInfo":
313
+ ) -> "Content.PaginatedContentInfos":
306
314
  return cast(
307
- Content.PaginatedContentInfo,
315
+ Content.PaginatedContentInfos,
308
316
  await cls._static_request_async(
309
317
  "post",
310
318
  "/content/infos",
@@ -403,11 +411,29 @@ class Content(APIResource["Content"]):
403
411
  company_id: str,
404
412
  **params: Unpack["Content.UpdateParams"],
405
413
  ) -> "Content.ContentInfo":
414
+ content_id = cls.resolve_content_id_from_file_path(
415
+ user_id=user_id,
416
+ company_id=company_id,
417
+ content_id=params.get("contentId"),
418
+ file_path=params.get("filePath"),
419
+ )
420
+ owner_id = unique_sdk.Folder.resolve_scope_id_from_folder_path(
421
+ user_id,
422
+ company_id,
423
+ params.get("ownerId"),
424
+ params.get("parentFolderPath"),
425
+ )
426
+ params.pop("contentId", None)
427
+ params.pop("filePath", None)
428
+ params.pop("parentFolderPath", None)
429
+ if owner_id is not None:
430
+ params["ownerId"] = owner_id
431
+
406
432
  return cast(
407
433
  "Content.ContentInfo",
408
434
  cls._static_request(
409
435
  "patch",
410
- f"/content/{params.get('contentId')}",
436
+ f"/content/{content_id}",
411
437
  user_id,
412
438
  company_id,
413
439
  params=params,
@@ -421,11 +447,29 @@ class Content(APIResource["Content"]):
421
447
  company_id: str,
422
448
  **params: Unpack["Content.UpdateParams"],
423
449
  ) -> "Content.ContentInfo":
450
+ content_id = cls.resolve_content_id_from_file_path(
451
+ user_id,
452
+ company_id,
453
+ params.get("contentId"),
454
+ params.get("filePath"),
455
+ )
456
+ owner_id = unique_sdk.Folder.resolve_scope_id_from_folder_path(
457
+ user_id,
458
+ company_id,
459
+ params.get("ownerId"),
460
+ params.get("parentFolderPath"),
461
+ )
462
+ params.pop("contentId", None)
463
+ params.pop("filePath", None)
464
+ params.pop("parentFolderPath", None)
465
+ if owner_id is not None:
466
+ params["ownerId"] = owner_id
467
+
424
468
  return cast(
425
469
  "Content.ContentInfo",
426
470
  await cls._static_request_async(
427
471
  "patch",
428
- f"/content/{params.get('contentId')}",
472
+ f"/content/{content_id}",
429
473
  user_id,
430
474
  company_id,
431
475
  params=params,
@@ -437,17 +481,25 @@ class Content(APIResource["Content"]):
437
481
  cls,
438
482
  user_id: str,
439
483
  company_id: str,
440
- **params: "Content.DeleteParams",
484
+ **params: Unpack["Content.DeleteParams"],
441
485
  ) -> "Content.DeleteResponse":
442
486
  """
443
487
  Deletes a content by its id or file path.
444
488
  """
489
+ content_id = cls.resolve_content_id_from_file_path(
490
+ user_id,
491
+ company_id,
492
+ params.get("contentId"),
493
+ params.get("filePath"),
494
+ )
495
+ params.pop("contentId", None)
496
+ params.pop("filePath", None)
445
497
 
446
498
  return cast(
447
499
  "Content.DeleteResponse",
448
500
  cls._static_request(
449
501
  "delete",
450
- f"/content/{params.get('contentId')}",
502
+ f"/content/{content_id}",
451
503
  user_id,
452
504
  company_id,
453
505
  params=params,
@@ -459,17 +511,25 @@ class Content(APIResource["Content"]):
459
511
  cls,
460
512
  user_id: str,
461
513
  company_id: str,
462
- **params: "Content.DeleteParams",
514
+ **params: Unpack["Content.DeleteParams"],
463
515
  ) -> "Content.DeleteResponse":
464
516
  """
465
517
  Async deletes a content by its id or file path.
466
518
  """
519
+ content_id = cls.resolve_content_id_from_file_path(
520
+ user_id,
521
+ company_id,
522
+ params.get("contentId"),
523
+ params.get("filePath"),
524
+ )
525
+ params.pop("contentId", None)
526
+ params.pop("filePath", None)
467
527
 
468
528
  return cast(
469
529
  "Content.DeleteResponse",
470
530
  await cls._static_request_async(
471
531
  "delete",
472
- f"/content/{params.get('contentId')}",
532
+ f"/content/{content_id}",
473
533
  user_id,
474
534
  company_id,
475
535
  params=params,
@@ -483,7 +543,7 @@ class Content(APIResource["Content"]):
483
543
  company_id: str,
484
544
  content_id: str | None = None,
485
545
  file_path: str | None = None,
486
- ) -> str:
546
+ ) -> str | None:
487
547
  """
488
548
  Returns the contentId to use: if content_id is provided, returns it;
489
549
  if not, but file_path is provided, resolves and returns the id for that file path.
@@ -496,9 +556,12 @@ class Content(APIResource["Content"]):
496
556
  company_id=company_id,
497
557
  filePath=file_path,
498
558
  )
559
+ content_infos = file_info.get("contentInfo")
499
560
  resolved_id = (
500
- file_info.get("contentInfo")[0].get("id")
561
+ content_infos[0].get("id")
501
562
  if file_info.get("totalCount", 0) > 0
563
+ and content_infos is not None
564
+ and len(content_infos) > 0
502
565
  else None
503
566
  )
504
567
  if not resolved_id:
@@ -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: ScopeAccessType
44
- entityType: ScopeAccessEntityType
45
- createdAt: str | None = None
26
+ type: Literal["READ", "WRITE"]
27
+ entityType: Literal["USER", "GROUP"]
28
+ createdAt: NotRequired[str]
46
29
 
47
30
  class Children(TypedDict):
48
31
  """
@@ -149,8 +132,8 @@ class Folder(APIResource["Folder"]):
149
132
  Parameters for getting a folder by its Id or path.
150
133
  """
151
134
 
152
- scopeId: str | None = None
153
- folderPath: str | None = None
135
+ scopeId: NotRequired[str]
136
+ folderPath: NotRequired[str]
154
137
 
155
138
  class UpdateParams(RequestOptions):
156
139
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.10.24
3
+ Version: 0.10.25
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -558,21 +558,34 @@ Allows you to ingest a magic table sheet, each row is processed and converted in
558
558
 
559
559
  #### `unique_sdk.Content.update` (Compatible with release >.36)
560
560
 
561
- Allows you to update a file specified by its `contentId`.
561
+ Allows you to update a file specified by its `contentId` or by its `filePath`.
562
562
 
563
- - `contentId` the id of the file to be updated
563
+ - `contentId` optional if `filePath` is provided, the id of the file to be updated
564
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be updated
564
565
 
565
566
  Currently, the following updates are supported:
566
567
 
567
568
  Title update:
568
569
  - `title` optional, allows updating the title of the file
569
570
 
570
- Move the file to a different folder. this can be done by specifying either the `ownerId`.
571
- - `ownerId` optional, allows moving the file to a different folder. Represents the new folder for the file and it should be the id of a folder e.g.: `scope_dhjfieurfloakmdle`.
571
+ Move the file to a different folder. This can be done by specifying either the `ownerId` or the `parentFolderPath`.
572
+ - `ownerId` optional, allows moving the file to a different folder. Represents the new folder for the file and it should be the id of a folder e.g.: `scope_dhjfieurfloakmdle`.
573
+ - `parentFolderPath` optional, allows moving the file to a different folder. Represents the path new folder for the file.
572
574
 
573
575
  Metadata update:
574
576
  - `metadata` optional, allows updating the metadata of the file. Default metadata can not be ovrriden. (Available with release >.40)
575
577
 
578
+ Example of updating the title of a file specified by its path.
579
+
580
+ ```python
581
+ unique_sdk.Content.update(
582
+ user_id=user_id,
583
+ company_id=company_id,
584
+ filePath="/Company/finance/january.xls",
585
+ title="Revision Deck"
586
+ )
587
+ ```
588
+
576
589
  Example of moving a file specified by its content id.
577
590
 
578
591
  ```python
@@ -599,12 +612,25 @@ unique_sdk.Content.update(
599
612
  )
600
613
  ```
601
614
 
615
+ Example of moving a file to a folder specified by its path.
616
+
617
+ ```python
618
+ unique_sdk.Content.update(
619
+ user_id=user_id,
620
+ company_id=company_id,
621
+ contentId="cont_ok2343q5owbce80w78hudawu5",
622
+ ownerId="scope_e68yz5asho7glfh7c7d041el",
623
+ parentFolderPath="/Company/Revisions"
624
+ )
625
+ ```
626
+
602
627
  #### `unique_sdk.Content.delete` (Compatible with release >.36)
603
628
 
604
629
  Allows you to delete a file by its `contentId`. If the file is part of a chat, the `chatId` also needs do be set.
605
630
 
606
- - `contentId` the id of the file to be deleted
631
+ - `contentId` optional if `filePath` is provided, the id of the file to be deleted
607
632
  - `chatId` optional, the id of the chat where the file is. Only needed if the file is part of a chat
633
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be deleted
608
634
 
609
635
  Example of deleting a file from a chat.
610
636
 
@@ -617,6 +643,17 @@ unique_sdk.Content.delete(
617
643
  )
618
644
  ```
619
645
 
646
+ Example of deleting a file by its path.
647
+
648
+ ```python
649
+ unique_sdk.Content.delete(
650
+ user_id=user_id,
651
+ company_id=company_id,
652
+ filePath="/Company/finance/january.xls",
653
+ )
654
+ ```
655
+
656
+
620
657
  ### Message
621
658
 
622
659
  #### `unique_sdk.Message.list`
@@ -1625,6 +1662,9 @@ All notable changes to this project will be documented in this file.
1625
1662
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1626
1663
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1627
1664
 
1665
+ ## [0.10.25] - 2025-09-18
1666
+ - Add support for udpate and delete files by file or folder path.
1667
+
1628
1668
  ## [0.10.24] - 2025-09-17
1629
1669
  - Add function to update a folder.
1630
1670
 
@@ -17,10 +17,10 @@ unique_sdk/api_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
17
17
  unique_sdk/api_resources/_acronyms.py,sha256=GIU1XH1flGWQYcpsFqTYwg4ioIGxVmb15tux84nmhEg,891
18
18
  unique_sdk/api_resources/_agentic_table.py,sha256=8-_f7t-m_iiiOj2835iESoxz91YRxl4-tkxpzQbgdcI,9958
19
19
  unique_sdk/api_resources/_chat_completion.py,sha256=ILCAffxkbkfh2iV9L4KKnfe80gZmT9pWfkNmf3mq68U,2172
20
- unique_sdk/api_resources/_content.py,sha256=pkRKOVNOB-7vaSPjXAHuT0RWXvduQ3-OMzGsDRSMvb4,14159
20
+ unique_sdk/api_resources/_content.py,sha256=idNKE9mwLPehuE2sHn_SKu7zCys2tYiuYeMzJ0pfLoo,16277
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=gUTbpmlt0_O4Vjor7Vs-wbxxq13VvLUl5JPwPNFI9jc,15593
23
+ unique_sdk/api_resources/_folder.py,sha256=JUYsH_7EBbHMFNESR68kxlQ4HTYXFve6Nwivj44qdnw,15234
24
24
  unique_sdk/api_resources/_integrated.py,sha256=O8e673z-RB7FRFMQYn_YEuHijebr5W7KJxkUnymbBZk,6164
25
25
  unique_sdk/api_resources/_mcp.py,sha256=zKh0dyn0QnkKk57N2zlGVN_GQoxEp5T2CS38vVm6jQY,3341
26
26
  unique_sdk/api_resources/_message.py,sha256=gEDIzg3METZU2k7m69meAuf0IWmZxnYOjbBKPRMwPYE,7688
@@ -36,7 +36,7 @@ unique_sdk/utils/chat_in_space.py,sha256=NrH9e2lvXtj_oePG0RWUqFoTanMblF8-VgtnVfs
36
36
  unique_sdk/utils/file_io.py,sha256=YY8B7VJcTLOPmCXByiOfNerXGlAtjCC5EVNmAbQJ3dQ,4306
37
37
  unique_sdk/utils/sources.py,sha256=DoxxhMLcLhmDfNarjXa41H4JD2GSSDywr71hiC-4pYc,4952
38
38
  unique_sdk/utils/token.py,sha256=AzKuAA1AwBtnvSFxGcsHLpxXr_wWE5Mj4jYBbOz2ljA,1740
39
- unique_sdk-0.10.24.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
40
- unique_sdk-0.10.24.dist-info/METADATA,sha256=kOoLhAC0MUUf7MXB8WuVVgMxXgZNkZChCbq5JF_RiYY,56395
41
- unique_sdk-0.10.24.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
- unique_sdk-0.10.24.dist-info/RECORD,,
39
+ unique_sdk-0.10.25.dist-info/LICENSE,sha256=EJCWoHgrXVBUb47PnjeV4MFIEOR71MAdCOIgv61J-4k,1065
40
+ unique_sdk-0.10.25.dist-info/METADATA,sha256=PYDK9o8e_mg5oVFJUoYfDSG2bgG-OLoucUUPlMzSBok,57611
41
+ unique_sdk-0.10.25.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
+ unique_sdk-0.10.25.dist-info/RECORD,,