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.

@@ -1,4 +1,15 @@
1
- from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Unpack, cast
1
+ from typing import (
2
+ Any,
3
+ ClassVar,
4
+ Dict,
5
+ List,
6
+ Literal,
7
+ NotRequired,
8
+ Optional,
9
+ TypedDict,
10
+ Unpack,
11
+ cast,
12
+ )
2
13
 
3
14
  from unique_sdk._api_resource import APIResource
4
15
  from unique_sdk._request_options import RequestOptions
@@ -7,16 +18,61 @@ from unique_sdk._request_options import RequestOptions
7
18
  class Space(APIResource["Space"]):
8
19
  OBJECT_NAME: ClassVar[Literal["space"]] = "space"
9
20
 
21
+ class ModuleParams(TypedDict):
22
+ name: str
23
+ description: NotRequired[Optional[str]]
24
+ weight: NotRequired[Optional[int]]
25
+ isExternal: NotRequired[Optional[bool]]
26
+ isCustomInstructionEnabled: NotRequired[Optional[bool]]
27
+ configuration: NotRequired[Optional[Dict[str, Any]]]
28
+ toolDefinition: NotRequired[Optional[Dict[str, Any]]]
29
+
30
+ class CreateSpaceParams(RequestOptions):
31
+ name: str
32
+ fallbackModule: str
33
+ modules: List["Space.ModuleParams"]
34
+ explanation: NotRequired[Optional[str]]
35
+ alert: NotRequired[Optional[str]]
36
+ chatUpload: NotRequired[Optional[Literal["ENABLED", "DISABLED"]]]
37
+ languageModel: NotRequired[Optional[str]]
38
+ isExternal: NotRequired[Optional[bool]]
39
+ isPinned: NotRequired[Optional[bool]]
40
+ uiType: NotRequired[
41
+ Optional[
42
+ Literal["MAGIC_TABLE", "UNIQUE_CUSTOM", "TRANSLATION", "UNIQUE_AI"]
43
+ ]
44
+ ]
45
+ settings: NotRequired[Optional[Dict[str, Any]]]
46
+
47
+ class AccessEntry(TypedDict):
48
+ entityId: str
49
+ entityType: Literal["USER", "GROUP"]
50
+ type: Literal["USE", "MANAGE", "UPLOAD"]
51
+
52
+ class AddSpaceAccessParams(RequestOptions):
53
+ access: List["Space.AccessEntry"]
54
+
55
+ class DeleteSpaceAccessParams(RequestOptions):
56
+ accessIds: List[str]
57
+
10
58
  class CreateMessageParams(RequestOptions):
11
59
  """
12
60
  Parameters for querying the assistant for a message.
13
61
  """
14
62
 
15
- chatId: str | None = None
63
+ chatId: NotRequired[str | None]
16
64
  assistantId: str
17
- text: str | None = None
18
- toolChoices: List[str] = None
19
- scopeRules: dict | None = None
65
+ text: NotRequired[str | None]
66
+ toolChoices: NotRequired[List[str] | None]
67
+ scopeRules: NotRequired[dict | None]
68
+
69
+ class GetChatMessagesParams(RequestOptions):
70
+ """
71
+ Parameters for getting chat messages.
72
+ """
73
+
74
+ skip: NotRequired[int]
75
+ take: NotRequired[int]
20
76
 
21
77
  class Reference(TypedDict):
22
78
  """
@@ -24,9 +80,10 @@ class Space(APIResource["Space"]):
24
80
  """
25
81
 
26
82
  name: str
27
- url: str | None
83
+ description: Optional[str]
84
+ url: Optional[str]
28
85
  sequenceNumber: int
29
- originalIndex: List[int] | None
86
+ originalIndex: Optional[list[int]]
30
87
  sourceId: str
31
88
  source: str
32
89
 
@@ -58,11 +115,13 @@ class Space(APIResource["Space"]):
58
115
  chatId: str
59
116
  text: str | None
60
117
  originalText: str | None
61
- role: Literal["system", "user", "assistant"]
118
+ role: Literal["SYSTEM", "USER", "ASSISTANT"]
62
119
  debugInfo: Optional[Dict[str, Any]]
120
+ gptRequest: Optional[Dict[str, Any]]
63
121
  completedAt: str | None
64
122
  createdAt: str | None
65
123
  updatedAt: str | None
124
+ startedStreamingAt: str | None
66
125
  stoppedStreamingAt: str | None
67
126
  references: Optional[List["Space.Reference"]]
68
127
  assessment: Optional[List["Space.Assessment"]]
@@ -74,6 +133,96 @@ class Space(APIResource["Space"]):
74
133
 
75
134
  chat_id: str
76
135
 
136
+ class GetAllMessagesResponse(TypedDict):
137
+ """
138
+ Response for getting all messages in a chat.
139
+ """
140
+
141
+ messages: List["Space.Message"]
142
+ totalCount: int
143
+
144
+ class McpServer(TypedDict):
145
+ """
146
+ Represents an MCP server associated with a space.
147
+ """
148
+
149
+ id: str
150
+ name: str
151
+ assistantId: str
152
+ mcpServerId: str
153
+ isEnabled: bool
154
+ createdAt: str
155
+ updatedAt: str
156
+
157
+ class Module(TypedDict):
158
+ """
159
+ Represents a module configured for a space.
160
+ """
161
+
162
+ id: str
163
+ name: str
164
+ description: Optional[str]
165
+ toolDefinition: Optional[Dict[str, Any]]
166
+ configuration: Dict[str, Any]
167
+ assistantId: str
168
+ weight: int
169
+ isExternal: bool
170
+ isCustomInstructionEnabled: bool
171
+ moduleTemplateId: Optional[str]
172
+ createdAt: str
173
+ updatedAt: str
174
+
175
+ class ScopeRule(TypedDict):
176
+ """
177
+ Represents a scope rule for a space.
178
+ """
179
+
180
+ id: str
181
+ assistantId: str
182
+ title: str
183
+ companyId: str
184
+ rule: Dict[str, Any]
185
+ isAdvanced: bool
186
+ createdAt: str
187
+ updatedAt: str
188
+
189
+ class Access(TypedDict):
190
+ id: str
191
+ entityId: str
192
+ entityType: str
193
+ type: str
194
+
195
+ class SpaceAccessResponse(TypedDict):
196
+ access: List["Space.Access"]
197
+
198
+ class DeleteSpaceAccessResponse(TypedDict):
199
+ success: bool
200
+
201
+ id: str
202
+ name: str
203
+ defaultForCompanyId: Optional[str]
204
+ title: Optional[str]
205
+ subtitle: Optional[str]
206
+ explanation: Optional[str]
207
+ alert: Optional[str]
208
+ inputLimit: Optional[int]
209
+ inputPlaceholder: Optional[str]
210
+ chatUpload: str
211
+ goals: List[str]
212
+ languageModel: Optional[str]
213
+ fallbackModule: str
214
+ access: List[str]
215
+ isExternal: bool
216
+ isPinned: bool
217
+ uiType: str
218
+ settings: Optional[Dict[str, Any]]
219
+ assistantMcpServers: List["Space.McpServer"]
220
+ modules: List["Space.Module"]
221
+ scopeRules: List["Space.ScopeRule"]
222
+ assistantAccess: List["Space.Access"]
223
+ createdAt: str
224
+ updatedAt: str
225
+
77
226
  @classmethod
78
227
  def create_message(
79
228
  cls,
@@ -118,6 +267,50 @@ class Space(APIResource["Space"]):
118
267
  ),
119
268
  )
120
269
 
270
+ @classmethod
271
+ def get_chat_messages(
272
+ cls,
273
+ user_id: str,
274
+ company_id: str,
275
+ chat_id: str,
276
+ **params: Unpack["Space.GetChatMessagesParams"],
277
+ ) -> "Space.GetAllMessagesResponse":
278
+ """
279
+ Get all messages in a space chat.
280
+ """
281
+ return cast(
282
+ "Space.GetAllMessagesResponse",
283
+ cls._static_request(
284
+ "get",
285
+ f"/space/chat/{chat_id}/messages",
286
+ user_id,
287
+ company_id,
288
+ params=params,
289
+ ),
290
+ )
291
+
292
+ @classmethod
293
+ async def get_chat_messages_async(
294
+ cls,
295
+ user_id: str,
296
+ company_id: str,
297
+ chat_id: str,
298
+ **params: Unpack["Space.GetChatMessagesParams"],
299
+ ) -> "Space.GetAllMessagesResponse":
300
+ """
301
+ Async get all messages in a space chat.
302
+ """
303
+ return cast(
304
+ "Space.GetAllMessagesResponse",
305
+ await cls._static_request_async(
306
+ "get",
307
+ f"/space/chat/{chat_id}/messages",
308
+ user_id,
309
+ company_id,
310
+ params=params,
311
+ ),
312
+ )
313
+
121
314
  @classmethod
122
315
  def get_latest_message(
123
316
  cls, user_id: str, company_id: str, chat_id: str
@@ -191,3 +384,189 @@ class Space(APIResource["Space"]):
191
384
  company_id,
192
385
  ),
193
386
  )
387
+
388
+ @classmethod
389
+ def get_space(
390
+ cls,
391
+ user_id: str,
392
+ company_id: str,
393
+ space_id: str,
394
+ ) -> "Space":
395
+ """
396
+ Get detailed information about a space (assistant).
397
+ """
398
+ return cast(
399
+ "Space",
400
+ cls._static_request(
401
+ "get",
402
+ f"/space/{space_id}",
403
+ user_id,
404
+ company_id,
405
+ ),
406
+ )
407
+
408
+ @classmethod
409
+ async def get_space_async(
410
+ cls,
411
+ user_id: str,
412
+ company_id: str,
413
+ space_id: str,
414
+ ) -> "Space":
415
+ """
416
+ Async get detailed information about a space (assistant).
417
+ """
418
+ return cast(
419
+ "Space",
420
+ await cls._static_request_async(
421
+ "get",
422
+ f"/space/{space_id}",
423
+ user_id,
424
+ company_id,
425
+ ),
426
+ )
427
+
428
+ @classmethod
429
+ def create_space(
430
+ cls,
431
+ user_id: str,
432
+ company_id: str,
433
+ **params: Unpack["Space.CreateSpaceParams"],
434
+ ) -> "Space":
435
+ return cast(
436
+ "Space",
437
+ cls._static_request(
438
+ "post",
439
+ "/space",
440
+ user_id,
441
+ company_id,
442
+ params=params,
443
+ ),
444
+ )
445
+
446
+ @classmethod
447
+ async def create_space_async(
448
+ cls,
449
+ user_id: str,
450
+ company_id: str,
451
+ **params: Unpack["Space.CreateSpaceParams"],
452
+ ) -> "Space":
453
+ return cast(
454
+ "Space",
455
+ await cls._static_request_async(
456
+ "post",
457
+ "/space",
458
+ user_id,
459
+ company_id,
460
+ params=params,
461
+ ),
462
+ )
463
+
464
+ @classmethod
465
+ def get_space_access(
466
+ cls,
467
+ user_id: str,
468
+ company_id: str,
469
+ space_id: str,
470
+ ) -> "Space.SpaceAccessResponse":
471
+ return cast(
472
+ "Space.SpaceAccessResponse",
473
+ cls._static_request(
474
+ "get",
475
+ f"/space/{space_id}/access",
476
+ user_id,
477
+ company_id,
478
+ ),
479
+ )
480
+
481
+ @classmethod
482
+ async def get_space_access_async(
483
+ cls,
484
+ user_id: str,
485
+ company_id: str,
486
+ space_id: str,
487
+ ) -> "Space.SpaceAccessResponse":
488
+ return cast(
489
+ "Space.SpaceAccessResponse",
490
+ await cls._static_request_async(
491
+ "get",
492
+ f"/space/{space_id}/access",
493
+ user_id,
494
+ company_id,
495
+ ),
496
+ )
497
+
498
+ @classmethod
499
+ def add_space_access(
500
+ cls,
501
+ user_id: str,
502
+ company_id: str,
503
+ space_id: str,
504
+ **params: Unpack["Space.AddSpaceAccessParams"],
505
+ ) -> "Space.SpaceAccessResponse":
506
+ return cast(
507
+ "Space.SpaceAccessResponse",
508
+ cls._static_request(
509
+ "post",
510
+ f"/space/{space_id}/access",
511
+ user_id,
512
+ company_id,
513
+ params=params,
514
+ ),
515
+ )
516
+
517
+ @classmethod
518
+ async def add_space_access_async(
519
+ cls,
520
+ user_id: str,
521
+ company_id: str,
522
+ space_id: str,
523
+ **params: Unpack["Space.AddSpaceAccessParams"],
524
+ ) -> "Space.SpaceAccessResponse":
525
+ return cast(
526
+ "Space.SpaceAccessResponse",
527
+ await cls._static_request_async(
528
+ "post",
529
+ f"/space/{space_id}/access",
530
+ user_id,
531
+ company_id,
532
+ params=params,
533
+ ),
534
+ )
535
+
536
+ @classmethod
537
+ def delete_space_access(
538
+ cls,
539
+ user_id: str,
540
+ company_id: str,
541
+ space_id: str,
542
+ **params: Unpack["Space.DeleteSpaceAccessParams"],
543
+ ) -> "Space.DeleteSpaceAccessResponse":
544
+ return cast(
545
+ "Space.DeleteSpaceAccessResponse",
546
+ cls._static_request(
547
+ "delete",
548
+ f"/space/{space_id}/access",
549
+ user_id,
550
+ company_id,
551
+ params=params,
552
+ ),
553
+ )
554
+
555
+ @classmethod
556
+ async def delete_space_access_async(
557
+ cls,
558
+ user_id: str,
559
+ company_id: str,
560
+ space_id: str,
561
+ **params: Unpack["Space.DeleteSpaceAccessParams"],
562
+ ) -> "Space.DeleteSpaceAccessResponse":
563
+ return cast(
564
+ "Space.DeleteSpaceAccessResponse",
565
+ await cls._static_request_async(
566
+ "delete",
567
+ f"/space/{space_id}/access",
568
+ user_id,
569
+ company_id,
570
+ params=params,
571
+ ),
572
+ )
@@ -0,0 +1,195 @@
1
+ from typing import (
2
+ Any,
3
+ ClassVar,
4
+ Dict,
5
+ List,
6
+ NotRequired,
7
+ Optional,
8
+ TypedDict,
9
+ Unpack,
10
+ cast,
11
+ )
12
+
13
+ from unique_sdk._api_resource import APIResource
14
+ from unique_sdk._request_options import RequestOptions
15
+
16
+
17
+ class User(APIResource["User"]):
18
+ OBJECT_NAME: ClassVar[str] = "users"
19
+
20
+ class GetParams(RequestOptions):
21
+ """
22
+ Parameters for getting users in a company.
23
+ """
24
+
25
+ skip: NotRequired[Optional[int]]
26
+ take: NotRequired[Optional[int]]
27
+ email: NotRequired[Optional[str]]
28
+ displayName: NotRequired[Optional[str]]
29
+ userName: NotRequired[Optional[str]]
30
+
31
+ class UpdateUserConfigurationParams(RequestOptions):
32
+ """
33
+ Parameters for updating user configuration.
34
+ """
35
+
36
+ userConfiguration: Dict[str, Any]
37
+
38
+ class UserGroup(TypedDict):
39
+ id: str
40
+ name: str
41
+ externalId: Optional[str]
42
+ parentId: Optional[str]
43
+ createdAt: str
44
+ updatedAt: str
45
+
46
+ class UserGroupsResponse(TypedDict):
47
+ groups: List["User.UserGroup"]
48
+
49
+ class User(TypedDict):
50
+ """
51
+ Represents a user in the company.
52
+ """
53
+
54
+ id: str
55
+ externalId: Optional[str]
56
+ firstName: str
57
+ lastName: str
58
+ displayName: str
59
+ userName: str
60
+ email: str
61
+ updatedAt: str
62
+ createdAt: str
63
+ active: bool
64
+
65
+ class UserWithConfiguration(User):
66
+ """
67
+ Represents a user in the company with configuration.
68
+ """
69
+
70
+ userConfiguration: Dict[str, Any]
71
+
72
+ class Users(TypedDict):
73
+ """
74
+ Response for getting users.
75
+ """
76
+
77
+ users: List["User.User"]
78
+
79
+ @classmethod
80
+ def get_users(
81
+ cls,
82
+ user_id: str,
83
+ company_id: str,
84
+ **params: Unpack["User.GetParams"],
85
+ ) -> "User.Users":
86
+ """
87
+ Get users in a company.
88
+ """
89
+ return cast(
90
+ "User.Users",
91
+ cls._static_request(
92
+ "get",
93
+ "/users",
94
+ user_id,
95
+ company_id,
96
+ params=params,
97
+ ),
98
+ )
99
+
100
+ @classmethod
101
+ async def get_users_async(
102
+ cls,
103
+ user_id: str,
104
+ company_id: str,
105
+ **params: Unpack["User.GetParams"],
106
+ ) -> "User.Users":
107
+ """
108
+ Async get users in a company.
109
+ """
110
+ return cast(
111
+ "User.Users",
112
+ await cls._static_request_async(
113
+ "get",
114
+ "/users",
115
+ user_id,
116
+ company_id,
117
+ params=params,
118
+ ),
119
+ )
120
+
121
+ @classmethod
122
+ def update_user_configuration(
123
+ cls,
124
+ user_id: str,
125
+ company_id: str,
126
+ **params: Unpack["User.UpdateUserConfigurationParams"],
127
+ ) -> "User.UserWithConfiguration":
128
+ """
129
+ Update user configuration for the current user.
130
+ """
131
+ return cast(
132
+ "User.UserWithConfiguration",
133
+ cls._static_request(
134
+ "patch",
135
+ f"/users/{user_id}/configuration",
136
+ user_id,
137
+ company_id,
138
+ params=params,
139
+ ),
140
+ )
141
+
142
+ @classmethod
143
+ async def update_user_configuration_async(
144
+ cls,
145
+ user_id: str,
146
+ company_id: str,
147
+ **params: Unpack["User.UpdateUserConfigurationParams"],
148
+ ) -> "User.UserWithConfiguration":
149
+ """
150
+ Async update user configuration for the current user.
151
+ """
152
+ return cast(
153
+ "User.UserWithConfiguration",
154
+ await cls._static_request_async(
155
+ "patch",
156
+ f"/users/{user_id}/configuration",
157
+ user_id,
158
+ company_id,
159
+ params=params,
160
+ ),
161
+ )
162
+
163
+ @classmethod
164
+ def get_user_groups(
165
+ cls,
166
+ user_id: str,
167
+ company_id: str,
168
+ target_user_id: str,
169
+ ) -> "User.UserGroupsResponse":
170
+ return cast(
171
+ "User.UserGroupsResponse",
172
+ cls._static_request(
173
+ "get",
174
+ f"/users/{target_user_id}/groups",
175
+ user_id,
176
+ company_id,
177
+ ),
178
+ )
179
+
180
+ @classmethod
181
+ async def get_user_groups_async(
182
+ cls,
183
+ user_id: str,
184
+ company_id: str,
185
+ target_user_id: str,
186
+ ) -> "User.UserGroupsResponse":
187
+ return cast(
188
+ "User.UserGroupsResponse",
189
+ await cls._static_request_async(
190
+ "get",
191
+ f"/users/{target_user_id}/groups",
192
+ user_id,
193
+ company_id,
194
+ ),
195
+ )