unique_sdk 0.10.15__tar.gz → 0.10.16__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.
Files changed (43) hide show
  1. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/CHANGELOG.md +3 -0
  2. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/PKG-INFO +33 -1
  3. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/README.md +29 -0
  4. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/pyproject.toml +1 -1
  5. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_content.py +109 -1
  6. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/LICENSE +0 -0
  7. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/__init__.py +0 -0
  8. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_api_requestor.py +0 -0
  9. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_api_resource.py +0 -0
  10. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_api_version.py +0 -0
  11. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_error.py +0 -0
  12. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_http_client.py +0 -0
  13. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_list_object.py +0 -0
  14. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_object_classes.py +0 -0
  15. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_request_options.py +0 -0
  16. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_unique_object.py +0 -0
  17. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_unique_ql.py +0 -0
  18. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_unique_response.py +0 -0
  19. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_util.py +0 -0
  20. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_version.py +0 -0
  21. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/_webhook.py +0 -0
  22. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/__init__.py +0 -0
  23. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_acronyms.py +0 -0
  24. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_agentic_table.py +0 -0
  25. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_chat_completion.py +0 -0
  26. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_embedding.py +0 -0
  27. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_event.py +0 -0
  28. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_folder.py +0 -0
  29. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_integrated.py +0 -0
  30. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_mcp.py +0 -0
  31. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_message.py +0 -0
  32. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_message_assessment.py +0 -0
  33. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_message_execution.py +0 -0
  34. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_message_log.py +0 -0
  35. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_search.py +0 -0
  36. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_search_string.py +0 -0
  37. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_short_term_memory.py +0 -0
  38. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/api_resources/_space.py +0 -0
  39. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/utils/chat_history.py +0 -0
  40. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/utils/chat_in_space.py +0 -0
  41. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/utils/file_io.py +0 -0
  42. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/unique_sdk/utils/sources.py +0 -0
  43. {unique_sdk-0.10.15 → unique_sdk-0.10.16}/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.16] - 2025-08-31
9
+ - Add function to delete a content.
10
+
8
11
  ## [0.10.15] - 2025-08-28
9
12
  - Add default values for message log types
10
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unique_sdk
3
- Version: 0.10.15
3
+ Version: 0.10.16
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Martin Fadler
@@ -554,6 +554,35 @@ Allows you to ingest a magic table sheet, each row is processed and converted in
554
554
  unique_sdk.Content.ingest_magic_table_sheets(**params)
555
555
  ```
556
556
 
557
+ #### `unique_sdk.Content.delete` (Compatible with release >.36)
558
+
559
+ Allows you to delete a file by its `contentId` or by its `filePath`. When deleting by `id`, if the file is part of a chat, the `chatId` also needs do be set. If both `contentId` and `filePath` are provided, `filePath` is ignored.
560
+
561
+ - `contentId` optional if `filePath` is provided, the id of the file to be deleted
562
+ - `chatId` optional, the id of the chat where the file is. Only needed if the file is part of a chat
563
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be deleted
564
+
565
+ Example of deleting a file from a chat.
566
+
567
+ ```python
568
+ unique_sdk.Content.delete(
569
+ user_id=user_id,
570
+ company_id=company_id,
571
+ contentId="cont_ok2343q5owbce80w78hudawu5",
572
+ chatId="chat_v3xfa7liv876h89vuiibus1"
573
+ )
574
+ ```
575
+
576
+ Example of deleting a file by its path.
577
+
578
+ ```python
579
+ unique_sdk.Content.delete(
580
+ user_id=user_id,
581
+ company_id=company_id,
582
+ filePath="/Company/finance/january.xls",
583
+ )
584
+ ```
585
+
557
586
  ### Message
558
587
 
559
588
  #### `unique_sdk.Message.list`
@@ -1516,6 +1545,9 @@ All notable changes to this project will be documented in this file.
1516
1545
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1517
1546
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1518
1547
 
1548
+ ## [0.10.16] - 2025-08-31
1549
+ - Add function to delete a content.
1550
+
1519
1551
  ## [0.10.15] - 2025-08-28
1520
1552
  - Add default values for message log types
1521
1553
 
@@ -538,6 +538,35 @@ Allows you to ingest a magic table sheet, each row is processed and converted in
538
538
  unique_sdk.Content.ingest_magic_table_sheets(**params)
539
539
  ```
540
540
 
541
+ #### `unique_sdk.Content.delete` (Compatible with release >.36)
542
+
543
+ Allows you to delete a file by its `contentId` or by its `filePath`. When deleting by `id`, if the file is part of a chat, the `chatId` also needs do be set. If both `contentId` and `filePath` are provided, `filePath` is ignored.
544
+
545
+ - `contentId` optional if `filePath` is provided, the id of the file to be deleted
546
+ - `chatId` optional, the id of the chat where the file is. Only needed if the file is part of a chat
547
+ - `filePath` optional if `contentId` is provided, the absolute path of the file to be deleted
548
+
549
+ Example of deleting a file from a chat.
550
+
551
+ ```python
552
+ unique_sdk.Content.delete(
553
+ user_id=user_id,
554
+ company_id=company_id,
555
+ contentId="cont_ok2343q5owbce80w78hudawu5",
556
+ chatId="chat_v3xfa7liv876h89vuiibus1"
557
+ )
558
+ ```
559
+
560
+ Example of deleting a file by its path.
561
+
562
+ ```python
563
+ unique_sdk.Content.delete(
564
+ user_id=user_id,
565
+ company_id=company_id,
566
+ filePath="/Company/finance/january.xls",
567
+ )
568
+ ```
569
+
541
570
  ### Message
542
571
 
543
572
  #### `unique_sdk.Message.list`
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "unique_sdk"
3
- version = "0.10.15"
3
+ version = "0.10.16"
4
4
  description = ""
5
5
  authors = [
6
6
  "Martin Fadler <martin.fadler@unique.ch>",
@@ -1,5 +1,14 @@
1
1
  from enum import Enum
2
- from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, cast
2
+ from typing import (
3
+ Any,
4
+ ClassVar,
5
+ Dict,
6
+ List,
7
+ Literal,
8
+ Optional,
9
+ TypedDict,
10
+ cast,
11
+ )
3
12
 
4
13
  from typing_extensions import NotRequired, Unpack
5
14
 
@@ -75,6 +84,7 @@ class Content(APIResource["Content"]):
75
84
  metadataFilter: dict
76
85
  skip: NotRequired[int]
77
86
  take: NotRequired[int]
87
+ filePath: NotRequired[str]
78
88
 
79
89
  class CustomApiOptions(TypedDict):
80
90
  apiIdentifier: str
@@ -148,6 +158,14 @@ class Content(APIResource["Content"]):
148
158
  contentInfos: List["Content.ContentInfo"]
149
159
  totalCount: int
150
160
 
161
+ class DeleteParams(RequestOptions):
162
+ contentId: NotRequired[str]
163
+ filePath: NotRequired[str]
164
+ chatId: NotRequired[str]
165
+
166
+ class DeleteResponse(TypedDict):
167
+ id: str
168
+
151
169
  id: str
152
170
  key: str
153
171
  url: Optional[str]
@@ -372,3 +390,93 @@ class Content(APIResource["Content"]):
372
390
  params=params,
373
391
  ),
374
392
  )
393
+
394
+ @classmethod
395
+ def delete(
396
+ cls,
397
+ user_id: str,
398
+ company_id: str,
399
+ **params: "Content.DeleteParams",
400
+ ) -> "Content.DeleteResponse":
401
+ """
402
+ Deletes a content by its id or file path.
403
+ """
404
+ content_id = cls.resolve_content_id_from_file_path(
405
+ user_id,
406
+ company_id,
407
+ params.get("contentId"),
408
+ params.get("filePath"),
409
+ )
410
+ params.pop("contentId", None)
411
+ params.pop("filePath", None)
412
+
413
+ return cast(
414
+ "Content.DeleteResponse",
415
+ cls._static_request(
416
+ "delete",
417
+ f"/content/{content_id}",
418
+ user_id,
419
+ company_id,
420
+ params=params,
421
+ ),
422
+ )
423
+
424
+ @classmethod
425
+ async def delete_async(
426
+ cls,
427
+ user_id: str,
428
+ company_id: str,
429
+ **params: "Content.DeleteParams",
430
+ ) -> "Content.DeleteResponse":
431
+ """
432
+ Async deletes a content by its id or file path.
433
+ """
434
+ content_id = cls.resolve_content_id_from_file_path(
435
+ user_id,
436
+ company_id,
437
+ params.get("contentId"),
438
+ params.get("filePath"),
439
+ )
440
+ params.pop("contentId", None)
441
+ params.pop("filePath", None)
442
+
443
+ return cast(
444
+ "Content.DeleteResponse",
445
+ await cls._static_request_async(
446
+ "delete",
447
+ f"/content/{content_id}",
448
+ user_id,
449
+ company_id,
450
+ params=params,
451
+ ),
452
+ )
453
+
454
+ @classmethod
455
+ def resolve_content_id_from_file_path(
456
+ cls,
457
+ user_id: str,
458
+ company_id: str,
459
+ content_id: str | None = None,
460
+ file_path: str | None = None,
461
+ ) -> str:
462
+ """
463
+ Returns the contentId to use: if content_id is provided, returns it;
464
+ if not, but file_path is provided, resolves and returns the id for that file path.
465
+ """
466
+ if content_id:
467
+ return content_id
468
+ if file_path:
469
+ file_info = cls.get_info(
470
+ user_id=user_id,
471
+ company_id=company_id,
472
+ filePath=file_path,
473
+ )
474
+ resolved_id = (
475
+ file_info.get("contentInfo")[0].get("id")
476
+ if file_info.get("totalCount", 0) > 0
477
+ else None
478
+ )
479
+ if not resolved_id:
480
+ raise ValueError(f"Could not find file with filePath: {file_path}")
481
+ return resolved_id
482
+ return None
File without changes