unique_sdk 0.10.24__tar.gz → 0.10.25__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.

Potentially problematic release.


This version of unique_sdk might be problematic. Click here for more details.

Files changed (43) hide show
  1. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/CHANGELOG.md +3 -0
  2. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/PKG-INFO +46 -6
  3. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/README.md +42 -5
  4. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/pyproject.toml +1 -1
  5. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_content.py +77 -14
  6. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_folder.py +5 -22
  7. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/LICENSE +0 -0
  8. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/__init__.py +0 -0
  9. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_api_requestor.py +0 -0
  10. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_api_resource.py +0 -0
  11. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_api_version.py +0 -0
  12. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_error.py +0 -0
  13. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_http_client.py +0 -0
  14. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_list_object.py +0 -0
  15. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_object_classes.py +0 -0
  16. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_request_options.py +0 -0
  17. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_unique_object.py +0 -0
  18. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_unique_ql.py +0 -0
  19. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_unique_response.py +0 -0
  20. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_util.py +0 -0
  21. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_version.py +0 -0
  22. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/_webhook.py +0 -0
  23. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/__init__.py +0 -0
  24. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_acronyms.py +0 -0
  25. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_agentic_table.py +0 -0
  26. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_chat_completion.py +0 -0
  27. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_embedding.py +0 -0
  28. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_event.py +0 -0
  29. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_integrated.py +0 -0
  30. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_mcp.py +0 -0
  31. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_message.py +0 -0
  32. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_message_assessment.py +0 -0
  33. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_message_execution.py +0 -0
  34. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_message_log.py +0 -0
  35. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_search.py +0 -0
  36. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_search_string.py +0 -0
  37. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_short_term_memory.py +0 -0
  38. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/api_resources/_space.py +0 -0
  39. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/utils/chat_history.py +0 -0
  40. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/utils/chat_in_space.py +0 -0
  41. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/utils/file_io.py +0 -0
  42. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/utils/sources.py +0 -0
  43. {unique_sdk-0.10.24 → unique_sdk-0.10.25}/unique_sdk/utils/token.py +0 -0
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.10.25] - 2025-09-18
9
+ - Add support for udpate and delete files by file or folder path.
10
+
8
11
  ## [0.10.24] - 2025-09-17
9
12
  - Add function to update a folder.
10
13
 
@@ -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
 
@@ -540,21 +540,34 @@ Allows you to ingest a magic table sheet, each row is processed and converted in
540
540
 
541
541
  #### `unique_sdk.Content.update` (Compatible with release >.36)
542
542
 
543
- Allows you to update a file specified by its `contentId`.
543
+ Allows you to update a file specified by its `contentId` or by its `filePath`.
544
544
 
545
- - `contentId` the id of the file to be updated
545
+ - `contentId` optional if `filePath` is provided, the id of the file to be updated
546
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be updated
546
547
 
547
548
  Currently, the following updates are supported:
548
549
 
549
550
  Title update:
550
551
  - `title` optional, allows updating the title of the file
551
552
 
552
- Move the file to a different folder. this can be done by specifying either the `ownerId`.
553
- - `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`.
553
+ Move the file to a different folder. This can be done by specifying either the `ownerId` or the `parentFolderPath`.
554
+ - `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`.
555
+ - `parentFolderPath` optional, allows moving the file to a different folder. Represents the path new folder for the file.
554
556
 
555
557
  Metadata update:
556
558
  - `metadata` optional, allows updating the metadata of the file. Default metadata can not be ovrriden. (Available with release >.40)
557
559
 
560
+ Example of updating the title of a file specified by its path.
561
+
562
+ ```python
563
+ unique_sdk.Content.update(
564
+ user_id=user_id,
565
+ company_id=company_id,
566
+ filePath="/Company/finance/january.xls",
567
+ title="Revision Deck"
568
+ )
569
+ ```
570
+
558
571
  Example of moving a file specified by its content id.
559
572
 
560
573
  ```python
@@ -581,12 +594,25 @@ unique_sdk.Content.update(
581
594
  )
582
595
  ```
583
596
 
597
+ Example of moving a file to a folder specified by its path.
598
+
599
+ ```python
600
+ unique_sdk.Content.update(
601
+ user_id=user_id,
602
+ company_id=company_id,
603
+ contentId="cont_ok2343q5owbce80w78hudawu5",
604
+ ownerId="scope_e68yz5asho7glfh7c7d041el",
605
+ parentFolderPath="/Company/Revisions"
606
+ )
607
+ ```
608
+
584
609
  #### `unique_sdk.Content.delete` (Compatible with release >.36)
585
610
 
586
611
  Allows you to delete a file by its `contentId`. If the file is part of a chat, the `chatId` also needs do be set.
587
612
 
588
- - `contentId` the id of the file to be deleted
613
+ - `contentId` optional if `filePath` is provided, the id of the file to be deleted
589
614
  - `chatId` optional, the id of the chat where the file is. Only needed if the file is part of a chat
615
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be deleted
590
616
 
591
617
  Example of deleting a file from a chat.
592
618
 
@@ -599,6 +625,17 @@ unique_sdk.Content.delete(
599
625
  )
600
626
  ```
601
627
 
628
+ Example of deleting a file by its path.
629
+
630
+ ```python
631
+ unique_sdk.Content.delete(
632
+ user_id=user_id,
633
+ company_id=company_id,
634
+ filePath="/Company/finance/january.xls",
635
+ )
636
+ ```
637
+
638
+
602
639
  ### Message
603
640
 
604
641
  #### `unique_sdk.Message.list`
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_sdk"
3
- version = "0.10.24"
3
+ version = "0.10.25"
4
4
  description = ""
5
5
  authors = [
6
6
  "Martin Fadler <martin.fadler@unique.ch>",
@@ -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
  """
File without changes