@proteos/sdk 0.31.0 → 0.32.0
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.
- package/dist/index.cjs +136 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -84
- package/dist/index.d.ts +138 -84
- package/dist/index.js +136 -25
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/conversation/index.ts +217 -58
- package/src/conversation/types.ts +40 -2
- package/src/index.ts +40 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteos/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "TypeScript SDK for the Proteos platform",
|
|
6
6
|
"repository": {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"tsup": "^8.3.0",
|
|
67
67
|
"typescript": "^5.7.0",
|
|
68
68
|
"vitest": "^3.0.0",
|
|
69
|
-
"@proteos/
|
|
70
|
-
"@proteos/
|
|
69
|
+
"@proteos/biome-config": "0.0.0",
|
|
70
|
+
"@proteos/tsconfig": "0.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsup",
|
|
@@ -1,55 +1,56 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
|
-
import { type VoiceService, VoiceServiceImpl } from './voice.js'
|
|
3
2
|
import type {
|
|
4
3
|
AgentListener,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
MaterializeTranscriptionRequest,
|
|
8
|
-
Transcription,
|
|
4
|
+
AttachContactAddressRequest,
|
|
5
|
+
BlockContactRequest,
|
|
9
6
|
Connection,
|
|
7
|
+
Contact,
|
|
8
|
+
ContactAddress,
|
|
9
|
+
ContactErasureRequest,
|
|
10
|
+
ContactMergeProposal,
|
|
10
11
|
Conversation,
|
|
12
|
+
ConversationFilter,
|
|
13
|
+
ConversationFilterEvent,
|
|
11
14
|
CreateAgentListenerRequest,
|
|
12
15
|
CreateConnectionRequest,
|
|
16
|
+
CreateConversationFilterRequest,
|
|
13
17
|
CreateGlossaryTermRequest,
|
|
18
|
+
CreateTranscriptionRequest,
|
|
14
19
|
DispatchMeetingBotRequest,
|
|
15
20
|
GlossaryTerm,
|
|
16
21
|
InstallConnectionResponse,
|
|
17
22
|
ListAgentListenersQuery,
|
|
18
23
|
ListConnectionsQuery,
|
|
19
|
-
ListGlossaryTermsQuery,
|
|
20
|
-
ListConversationsQuery,
|
|
21
|
-
ListMessagesQuery,
|
|
22
24
|
ListContactAddressesQuery,
|
|
23
25
|
ListContactMergeProposalsQuery,
|
|
24
26
|
ListContactsQuery,
|
|
27
|
+
ListConversationFilterEventsQuery,
|
|
28
|
+
ListConversationFiltersQuery,
|
|
29
|
+
ListConversationsQuery,
|
|
30
|
+
ListGlossaryTermsQuery,
|
|
31
|
+
ListMessagesQuery,
|
|
25
32
|
ListReactionsResponse,
|
|
26
33
|
ListResponse,
|
|
27
34
|
ListRoomsQuery,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
BlockContactRequest,
|
|
31
|
-
Contact,
|
|
32
|
-
ContactAddress,
|
|
33
|
-
ConversationFilter,
|
|
34
|
-
ConversationFilterEvent,
|
|
35
|
-
CreateConversationFilterRequest,
|
|
36
|
-
ListConversationFilterEventsQuery,
|
|
37
|
-
ListConversationFiltersQuery,
|
|
38
|
-
UpdateConversationFilterRequest,
|
|
39
|
-
ContactErasureRequest,
|
|
40
|
-
ContactMergeProposal,
|
|
35
|
+
ListTranscriptionsQuery,
|
|
36
|
+
MaterializeTranscriptionRequest,
|
|
41
37
|
MergeContactsRequest,
|
|
42
|
-
|
|
43
|
-
UpdateContactRequest,
|
|
38
|
+
Message,
|
|
44
39
|
Reaction,
|
|
40
|
+
RecordPermissionEventRequest,
|
|
45
41
|
Room,
|
|
46
42
|
SendMessageRequest,
|
|
43
|
+
Transcription,
|
|
47
44
|
UnreadCounts,
|
|
48
45
|
UpdateAgentListenerRequest,
|
|
49
46
|
UpdateConnectionRequest,
|
|
47
|
+
UpdateContactRequest,
|
|
48
|
+
UpdateConversationFilterRequest,
|
|
50
49
|
UpdateConversationRequest,
|
|
50
|
+
UpdateDraftRequest,
|
|
51
51
|
UpdateGlossaryTermRequest,
|
|
52
52
|
} from './types.js'
|
|
53
|
+
import { type VoiceService, VoiceServiceImpl } from './voice.js'
|
|
53
54
|
|
|
54
55
|
const CONVERSATION_BASE_PATH = '/conversations/v1'
|
|
55
56
|
|
|
@@ -121,11 +122,17 @@ class MeetingServiceImpl implements MeetingService {
|
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
remove(conversationId: string): Promise<Conversation> {
|
|
124
|
-
return this.client.request(
|
|
125
|
+
return this.client.request(
|
|
126
|
+
'DELETE',
|
|
127
|
+
`${CONVERSATION_BASE_PATH}/meetings/${encodeURIComponent(conversationId)}`,
|
|
128
|
+
)
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
summarize(conversationId: string): Promise<Conversation> {
|
|
128
|
-
return this.client.request(
|
|
132
|
+
return this.client.request(
|
|
133
|
+
'POST',
|
|
134
|
+
`${CONVERSATION_BASE_PATH}/meetings/${encodeURIComponent(conversationId)}/summarize`,
|
|
135
|
+
)
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
|
|
@@ -139,7 +146,10 @@ export interface ConnectionService {
|
|
|
139
146
|
/** Begin the connector's install flow; open the returned URL in a popup. */
|
|
140
147
|
install(id: string): Promise<InstallConnectionResponse>
|
|
141
148
|
/** Search the contact addresses this connection can reach (org-deduped) for the compose picker. */
|
|
142
|
-
listContactAddresses(
|
|
149
|
+
listContactAddresses(
|
|
150
|
+
connectionId: string,
|
|
151
|
+
query?: ListContactAddressesQuery,
|
|
152
|
+
): Promise<ListResponse<ContactAddress>>
|
|
143
153
|
/** Search a connection's addressable VENUES (Slack channels) for the compose picker. */
|
|
144
154
|
listRooms(connectionId: string, query?: ListRoomsQuery): Promise<ListResponse<Room>>
|
|
145
155
|
}
|
|
@@ -152,7 +162,10 @@ class ConnectionServiceImpl implements ConnectionService {
|
|
|
152
162
|
}
|
|
153
163
|
|
|
154
164
|
get(id: string): Promise<Connection> {
|
|
155
|
-
return this.client.request(
|
|
165
|
+
return this.client.request(
|
|
166
|
+
'GET',
|
|
167
|
+
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(id)}`,
|
|
168
|
+
)
|
|
156
169
|
}
|
|
157
170
|
|
|
158
171
|
create(request: CreateConnectionRequest): Promise<Connection> {
|
|
@@ -160,18 +173,31 @@ class ConnectionServiceImpl implements ConnectionService {
|
|
|
160
173
|
}
|
|
161
174
|
|
|
162
175
|
update(id: string, request: UpdateConnectionRequest): Promise<Connection> {
|
|
163
|
-
return this.client.request(
|
|
176
|
+
return this.client.request(
|
|
177
|
+
'PATCH',
|
|
178
|
+
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(id)}`,
|
|
179
|
+
request,
|
|
180
|
+
)
|
|
164
181
|
}
|
|
165
182
|
|
|
166
183
|
async delete(id: string): Promise<void> {
|
|
167
|
-
await this.client.request(
|
|
184
|
+
await this.client.request(
|
|
185
|
+
'DELETE',
|
|
186
|
+
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(id)}`,
|
|
187
|
+
)
|
|
168
188
|
}
|
|
169
189
|
|
|
170
190
|
install(id: string): Promise<InstallConnectionResponse> {
|
|
171
|
-
return this.client.request(
|
|
191
|
+
return this.client.request(
|
|
192
|
+
'POST',
|
|
193
|
+
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(id)}/install`,
|
|
194
|
+
)
|
|
172
195
|
}
|
|
173
196
|
|
|
174
|
-
listContactAddresses(
|
|
197
|
+
listContactAddresses(
|
|
198
|
+
connectionId: string,
|
|
199
|
+
query: ListContactAddressesQuery = {},
|
|
200
|
+
): Promise<ListResponse<ContactAddress>> {
|
|
175
201
|
return this.client.requestWithQuery(
|
|
176
202
|
'GET',
|
|
177
203
|
`${CONVERSATION_BASE_PATH}/connections/${encodeURIComponent(connectionId)}/contact-addresses`,
|
|
@@ -202,7 +228,9 @@ export interface ContactService {
|
|
|
202
228
|
unblock(contactId: string, request?: BlockContactRequest): Promise<Contact>
|
|
203
229
|
requestErasure(contactId: string): Promise<ContactErasureRequest>
|
|
204
230
|
listErasureRequests(contactId: string): Promise<ContactErasureRequest[]>
|
|
205
|
-
listMergeProposals(
|
|
231
|
+
listMergeProposals(
|
|
232
|
+
query?: ListContactMergeProposalsQuery,
|
|
233
|
+
): Promise<ListResponse<ContactMergeProposal>>
|
|
206
234
|
approveMergeProposal(proposalId: string): Promise<ContactMergeProposal>
|
|
207
235
|
rejectMergeProposal(proposalId: string): Promise<ContactMergeProposal>
|
|
208
236
|
}
|
|
@@ -215,11 +243,18 @@ class ContactServiceImpl implements ContactService {
|
|
|
215
243
|
}
|
|
216
244
|
|
|
217
245
|
get(id: string): Promise<Contact> {
|
|
218
|
-
return this.client.request(
|
|
246
|
+
return this.client.request(
|
|
247
|
+
'GET',
|
|
248
|
+
`${CONVERSATION_BASE_PATH}/contacts/${encodeURIComponent(id)}`,
|
|
249
|
+
)
|
|
219
250
|
}
|
|
220
251
|
|
|
221
252
|
update(id: string, request: UpdateContactRequest): Promise<Contact> {
|
|
222
|
-
return this.client.request(
|
|
253
|
+
return this.client.request(
|
|
254
|
+
'PATCH',
|
|
255
|
+
`${CONVERSATION_BASE_PATH}/contacts/${encodeURIComponent(id)}`,
|
|
256
|
+
request,
|
|
257
|
+
)
|
|
223
258
|
}
|
|
224
259
|
|
|
225
260
|
attachAddress(contactId: string, request: AttachContactAddressRequest): Promise<Contact> {
|
|
@@ -245,7 +280,10 @@ class ContactServiceImpl implements ContactService {
|
|
|
245
280
|
)
|
|
246
281
|
}
|
|
247
282
|
|
|
248
|
-
recordPermissionEvent(
|
|
283
|
+
recordPermissionEvent(
|
|
284
|
+
contactId: string,
|
|
285
|
+
request: RecordPermissionEventRequest,
|
|
286
|
+
): Promise<Contact> {
|
|
249
287
|
return this.client.request(
|
|
250
288
|
'POST',
|
|
251
289
|
`${CONVERSATION_BASE_PATH}/contacts/${encodeURIComponent(contactId)}/permission-events`,
|
|
@@ -283,8 +321,14 @@ class ContactServiceImpl implements ContactService {
|
|
|
283
321
|
)
|
|
284
322
|
}
|
|
285
323
|
|
|
286
|
-
listMergeProposals(
|
|
287
|
-
|
|
324
|
+
listMergeProposals(
|
|
325
|
+
query: ListContactMergeProposalsQuery = {},
|
|
326
|
+
): Promise<ListResponse<ContactMergeProposal>> {
|
|
327
|
+
return this.client.requestWithQuery(
|
|
328
|
+
'GET',
|
|
329
|
+
`${CONVERSATION_BASE_PATH}/contact-merge-proposals`,
|
|
330
|
+
query,
|
|
331
|
+
)
|
|
288
332
|
}
|
|
289
333
|
|
|
290
334
|
approveMergeProposal(proposalId: string): Promise<ContactMergeProposal> {
|
|
@@ -325,23 +369,39 @@ class ConversationServiceImpl implements ConversationService {
|
|
|
325
369
|
}
|
|
326
370
|
|
|
327
371
|
get(id: string): Promise<Conversation> {
|
|
328
|
-
return this.client.request(
|
|
372
|
+
return this.client.request(
|
|
373
|
+
'GET',
|
|
374
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}`,
|
|
375
|
+
)
|
|
329
376
|
}
|
|
330
377
|
|
|
331
378
|
update(id: string, request: UpdateConversationRequest): Promise<Conversation> {
|
|
332
|
-
return this.client.request(
|
|
379
|
+
return this.client.request(
|
|
380
|
+
'PATCH',
|
|
381
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}`,
|
|
382
|
+
request,
|
|
383
|
+
)
|
|
333
384
|
}
|
|
334
385
|
|
|
335
386
|
end(id: string): Promise<Conversation> {
|
|
336
|
-
return this.client.request(
|
|
387
|
+
return this.client.request(
|
|
388
|
+
'POST',
|
|
389
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}/end`,
|
|
390
|
+
)
|
|
337
391
|
}
|
|
338
392
|
|
|
339
393
|
markRead(id: string): Promise<void> {
|
|
340
|
-
return this.client.request(
|
|
394
|
+
return this.client.request(
|
|
395
|
+
'POST',
|
|
396
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}/read`,
|
|
397
|
+
)
|
|
341
398
|
}
|
|
342
399
|
|
|
343
400
|
markUnread(id: string): Promise<void> {
|
|
344
|
-
return this.client.request(
|
|
401
|
+
return this.client.request(
|
|
402
|
+
'DELETE',
|
|
403
|
+
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(id)}/read`,
|
|
404
|
+
)
|
|
345
405
|
}
|
|
346
406
|
|
|
347
407
|
unreadCounts(): Promise<UnreadCounts> {
|
|
@@ -349,10 +409,30 @@ class ConversationServiceImpl implements ConversationService {
|
|
|
349
409
|
}
|
|
350
410
|
}
|
|
351
411
|
|
|
352
|
-
/** Messages within a conversation (ordered by occurred_at) + outbound send + reactions. */
|
|
412
|
+
/** Messages within a conversation (ordered by occurred_at) + outbound send + drafts + reactions. */
|
|
353
413
|
export interface MessageService {
|
|
354
|
-
listByConversation(
|
|
414
|
+
listByConversation(
|
|
415
|
+
conversationId: string,
|
|
416
|
+
query?: ListMessagesQuery,
|
|
417
|
+
): Promise<ListResponse<Message>>
|
|
418
|
+
/** One message with its read-time projections (reactions, attachments). */
|
|
419
|
+
get(messageId: string): Promise<Message>
|
|
355
420
|
send(request: SendMessageRequest): Promise<Message>
|
|
421
|
+
/**
|
|
422
|
+
* Store an outbound message for human review (status=draft) — same request
|
|
423
|
+
* shape as send, nothing reaches the connector until sendDraft. Originate
|
|
424
|
+
* mode mints a hidden status=draft conversation.
|
|
425
|
+
*/
|
|
426
|
+
draft(request: SendMessageRequest): Promise<Message>
|
|
427
|
+
/**
|
|
428
|
+
* Replace a draft's editable surface (full state, PUT semantics). 409
|
|
429
|
+
* `draft_not_editable` once the draft was sent or rejected.
|
|
430
|
+
*/
|
|
431
|
+
updateDraft(messageId: string, request: UpdateDraftRequest): Promise<Message>
|
|
432
|
+
/** Deliver a draft (draft → pending → sent/failed). 409 on a lost race. */
|
|
433
|
+
sendDraft(messageId: string): Promise<Message>
|
|
434
|
+
/** Decline a draft (draft → rejected, terminal). 409 on a lost race. */
|
|
435
|
+
rejectDraft(messageId: string): Promise<Message>
|
|
356
436
|
/** Aggregated reactions on one message (also rides on Message.reactions). */
|
|
357
437
|
getReactions(messageId: string): Promise<Reaction[]>
|
|
358
438
|
/**
|
|
@@ -367,7 +447,10 @@ export interface MessageService {
|
|
|
367
447
|
class MessageServiceImpl implements MessageService {
|
|
368
448
|
constructor(private readonly client: ProteosClient) {}
|
|
369
449
|
|
|
370
|
-
listByConversation(
|
|
450
|
+
listByConversation(
|
|
451
|
+
conversationId: string,
|
|
452
|
+
query: ListMessagesQuery = {},
|
|
453
|
+
): Promise<ListResponse<Message>> {
|
|
371
454
|
return this.client.requestWithQuery(
|
|
372
455
|
'GET',
|
|
373
456
|
`${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(conversationId)}/messages`,
|
|
@@ -375,10 +458,43 @@ class MessageServiceImpl implements MessageService {
|
|
|
375
458
|
)
|
|
376
459
|
}
|
|
377
460
|
|
|
461
|
+
get(messageId: string): Promise<Message> {
|
|
462
|
+
return this.client.request(
|
|
463
|
+
'GET',
|
|
464
|
+
`${CONVERSATION_BASE_PATH}/messages/${encodeURIComponent(messageId)}`,
|
|
465
|
+
)
|
|
466
|
+
}
|
|
467
|
+
|
|
378
468
|
send(request: SendMessageRequest): Promise<Message> {
|
|
379
469
|
return this.client.request('POST', `${CONVERSATION_BASE_PATH}/messages/send`, request)
|
|
380
470
|
}
|
|
381
471
|
|
|
472
|
+
draft(request: SendMessageRequest): Promise<Message> {
|
|
473
|
+
return this.client.request('POST', `${CONVERSATION_BASE_PATH}/messages/draft`, request)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
updateDraft(messageId: string, request: UpdateDraftRequest): Promise<Message> {
|
|
477
|
+
return this.client.request(
|
|
478
|
+
'PUT',
|
|
479
|
+
`${CONVERSATION_BASE_PATH}/messages/${encodeURIComponent(messageId)}/draft`,
|
|
480
|
+
request,
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
sendDraft(messageId: string): Promise<Message> {
|
|
485
|
+
return this.client.request(
|
|
486
|
+
'POST',
|
|
487
|
+
`${CONVERSATION_BASE_PATH}/messages/${encodeURIComponent(messageId)}/send`,
|
|
488
|
+
)
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
rejectDraft(messageId: string): Promise<Message> {
|
|
492
|
+
return this.client.request(
|
|
493
|
+
'POST',
|
|
494
|
+
`${CONVERSATION_BASE_PATH}/messages/${encodeURIComponent(messageId)}/reject`,
|
|
495
|
+
)
|
|
496
|
+
}
|
|
497
|
+
|
|
382
498
|
async getReactions(messageId: string): Promise<Reaction[]> {
|
|
383
499
|
const response: ListReactionsResponse = await this.client.request(
|
|
384
500
|
'GET',
|
|
@@ -422,7 +538,10 @@ class AgentListenerServiceImpl implements AgentListenerService {
|
|
|
422
538
|
}
|
|
423
539
|
|
|
424
540
|
get(id: string): Promise<AgentListener> {
|
|
425
|
-
return this.client.request(
|
|
541
|
+
return this.client.request(
|
|
542
|
+
'GET',
|
|
543
|
+
`${CONVERSATION_BASE_PATH}/agent-listeners/${encodeURIComponent(id)}`,
|
|
544
|
+
)
|
|
426
545
|
}
|
|
427
546
|
|
|
428
547
|
create(request: CreateAgentListenerRequest): Promise<AgentListener> {
|
|
@@ -430,11 +549,18 @@ class AgentListenerServiceImpl implements AgentListenerService {
|
|
|
430
549
|
}
|
|
431
550
|
|
|
432
551
|
update(id: string, request: UpdateAgentListenerRequest): Promise<AgentListener> {
|
|
433
|
-
return this.client.request(
|
|
552
|
+
return this.client.request(
|
|
553
|
+
'PATCH',
|
|
554
|
+
`${CONVERSATION_BASE_PATH}/agent-listeners/${encodeURIComponent(id)}`,
|
|
555
|
+
request,
|
|
556
|
+
)
|
|
434
557
|
}
|
|
435
558
|
|
|
436
559
|
async delete(id: string): Promise<void> {
|
|
437
|
-
await this.client.request(
|
|
560
|
+
await this.client.request(
|
|
561
|
+
'DELETE',
|
|
562
|
+
`${CONVERSATION_BASE_PATH}/agent-listeners/${encodeURIComponent(id)}`,
|
|
563
|
+
)
|
|
438
564
|
}
|
|
439
565
|
}
|
|
440
566
|
|
|
@@ -449,18 +575,28 @@ export interface ConversationFilterService {
|
|
|
449
575
|
create(request: CreateConversationFilterRequest): Promise<ConversationFilter>
|
|
450
576
|
update(id: string, request: UpdateConversationFilterRequest): Promise<ConversationFilter>
|
|
451
577
|
delete(id: string): Promise<void>
|
|
452
|
-
listEvents(
|
|
578
|
+
listEvents(
|
|
579
|
+
id: string,
|
|
580
|
+
query?: ListConversationFilterEventsQuery,
|
|
581
|
+
): Promise<ListResponse<ConversationFilterEvent>>
|
|
453
582
|
}
|
|
454
583
|
|
|
455
584
|
class ConversationFilterServiceImpl implements ConversationFilterService {
|
|
456
585
|
constructor(private readonly client: ProteosClient) {}
|
|
457
586
|
|
|
458
587
|
list(query: ListConversationFiltersQuery = {}): Promise<ListResponse<ConversationFilter>> {
|
|
459
|
-
return this.client.requestWithQuery(
|
|
588
|
+
return this.client.requestWithQuery(
|
|
589
|
+
'GET',
|
|
590
|
+
`${CONVERSATION_BASE_PATH}/conversation-filters`,
|
|
591
|
+
query,
|
|
592
|
+
)
|
|
460
593
|
}
|
|
461
594
|
|
|
462
595
|
get(id: string): Promise<ConversationFilter> {
|
|
463
|
-
return this.client.request(
|
|
596
|
+
return this.client.request(
|
|
597
|
+
'GET',
|
|
598
|
+
`${CONVERSATION_BASE_PATH}/conversation-filters/${encodeURIComponent(id)}`,
|
|
599
|
+
)
|
|
464
600
|
}
|
|
465
601
|
|
|
466
602
|
create(request: CreateConversationFilterRequest): Promise<ConversationFilter> {
|
|
@@ -468,14 +604,24 @@ class ConversationFilterServiceImpl implements ConversationFilterService {
|
|
|
468
604
|
}
|
|
469
605
|
|
|
470
606
|
update(id: string, request: UpdateConversationFilterRequest): Promise<ConversationFilter> {
|
|
471
|
-
return this.client.request(
|
|
607
|
+
return this.client.request(
|
|
608
|
+
'PATCH',
|
|
609
|
+
`${CONVERSATION_BASE_PATH}/conversation-filters/${encodeURIComponent(id)}`,
|
|
610
|
+
request,
|
|
611
|
+
)
|
|
472
612
|
}
|
|
473
613
|
|
|
474
614
|
async delete(id: string): Promise<void> {
|
|
475
|
-
await this.client.request(
|
|
615
|
+
await this.client.request(
|
|
616
|
+
'DELETE',
|
|
617
|
+
`${CONVERSATION_BASE_PATH}/conversation-filters/${encodeURIComponent(id)}`,
|
|
618
|
+
)
|
|
476
619
|
}
|
|
477
620
|
|
|
478
|
-
listEvents(
|
|
621
|
+
listEvents(
|
|
622
|
+
id: string,
|
|
623
|
+
query: ListConversationFilterEventsQuery = {},
|
|
624
|
+
): Promise<ListResponse<ConversationFilterEvent>> {
|
|
479
625
|
return this.client.requestWithQuery(
|
|
480
626
|
'GET',
|
|
481
627
|
`${CONVERSATION_BASE_PATH}/conversation-filters/${encodeURIComponent(id)}/events`,
|
|
@@ -506,7 +652,10 @@ class GlossaryTermServiceImpl implements GlossaryTermService {
|
|
|
506
652
|
}
|
|
507
653
|
|
|
508
654
|
get(id: string): Promise<GlossaryTerm> {
|
|
509
|
-
return this.client.request(
|
|
655
|
+
return this.client.request(
|
|
656
|
+
'GET',
|
|
657
|
+
`${CONVERSATION_BASE_PATH}/glossary-terms/${encodeURIComponent(id)}`,
|
|
658
|
+
)
|
|
510
659
|
}
|
|
511
660
|
|
|
512
661
|
create(request: CreateGlossaryTermRequest): Promise<GlossaryTerm> {
|
|
@@ -514,11 +663,18 @@ class GlossaryTermServiceImpl implements GlossaryTermService {
|
|
|
514
663
|
}
|
|
515
664
|
|
|
516
665
|
update(id: string, request: UpdateGlossaryTermRequest): Promise<GlossaryTerm> {
|
|
517
|
-
return this.client.request(
|
|
666
|
+
return this.client.request(
|
|
667
|
+
'PATCH',
|
|
668
|
+
`${CONVERSATION_BASE_PATH}/glossary-terms/${encodeURIComponent(id)}`,
|
|
669
|
+
request,
|
|
670
|
+
)
|
|
518
671
|
}
|
|
519
672
|
|
|
520
673
|
async delete(id: string): Promise<void> {
|
|
521
|
-
await this.client.request(
|
|
674
|
+
await this.client.request(
|
|
675
|
+
'DELETE',
|
|
676
|
+
`${CONVERSATION_BASE_PATH}/glossary-terms/${encodeURIComponent(id)}`,
|
|
677
|
+
)
|
|
522
678
|
}
|
|
523
679
|
}
|
|
524
680
|
|
|
@@ -548,7 +704,10 @@ class TranscriptionServiceImpl implements TranscriptionService {
|
|
|
548
704
|
}
|
|
549
705
|
|
|
550
706
|
get(id: string): Promise<Transcription> {
|
|
551
|
-
return this.client.request(
|
|
707
|
+
return this.client.request(
|
|
708
|
+
'GET',
|
|
709
|
+
`${CONVERSATION_BASE_PATH}/transcriptions/${encodeURIComponent(id)}`,
|
|
710
|
+
)
|
|
552
711
|
}
|
|
553
712
|
|
|
554
713
|
materialize(id: string, request: MaterializeTranscriptionRequest = {}): Promise<Conversation> {
|
|
@@ -61,10 +61,18 @@ export type ConnectorKey =
|
|
|
61
61
|
export type ConnectorProvider = 'native' | 'unipile' | 'ava'
|
|
62
62
|
|
|
63
63
|
export type MessageDirection = 'inbound' | 'outbound'
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Delivery state. `draft` = agent-prepared, awaiting human review (a human
|
|
66
|
+
* sends it → pending → sent/failed, or rejects it → `rejected`, terminal).
|
|
67
|
+
*/
|
|
68
|
+
export type MessageStatus = 'received' | 'pending' | 'sent' | 'failed' | 'draft' | 'rejected'
|
|
65
69
|
export type ConnectionScope = 'org' | 'user'
|
|
66
70
|
export type ConnectionStatus = 'pending' | 'active' | 'error' | 'revoked'
|
|
67
|
-
|
|
71
|
+
/**
|
|
72
|
+
* `draft` marks a conversation minted BY a draft message (originate-mode
|
|
73
|
+
* drafting) — hidden from the default list until the first successful send.
|
|
74
|
+
*/
|
|
75
|
+
export type ConversationStatus = 'active' | 'ended' | 'archived' | 'draft'
|
|
68
76
|
export type AgentListenerTriggerType = 'always' | 'mention' | 'channel' | 'keyword'
|
|
69
77
|
|
|
70
78
|
export interface UserRef {
|
|
@@ -309,6 +317,11 @@ export interface Message {
|
|
|
309
317
|
recipients?: MessageRecipient[]
|
|
310
318
|
content: ContentBlock[]
|
|
311
319
|
status: MessageStatus
|
|
320
|
+
/**
|
|
321
|
+
* The message this one was targeted at (thread-mode send/draft anchor);
|
|
322
|
+
* absent for everything else.
|
|
323
|
+
*/
|
|
324
|
+
reply_to_message_id?: string
|
|
312
325
|
occurred_at: string
|
|
313
326
|
/** Read-time projection; absent/empty on channels without reactions. */
|
|
314
327
|
reactions?: Reaction[]
|
|
@@ -426,6 +439,31 @@ export interface SendMessageRequest {
|
|
|
426
439
|
attachments?: FileRef[]
|
|
427
440
|
}
|
|
428
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Edits a status=draft message — full replacement of the editable surface
|
|
444
|
+
* (PUT semantics; always send the complete state, including attachments you
|
|
445
|
+
* want to keep). The addressing MODE is immutable. `subject` applies only
|
|
446
|
+
* while the draft's conversation is itself status=draft (originate drafts) —
|
|
447
|
+
* replies derive their subject from the thread.
|
|
448
|
+
*
|
|
449
|
+
* Recipient groups are PRESENCE-based: a group that is present (including an
|
|
450
|
+
* explicit empty `[]` — a clear) replaces the stored recipients from exactly
|
|
451
|
+
* the provided groups; omitting all three keeps the stored recipients. On any
|
|
452
|
+
* recipient edit, send all three groups.
|
|
453
|
+
*/
|
|
454
|
+
export interface UpdateDraftRequest {
|
|
455
|
+
to?: SendRecipient[]
|
|
456
|
+
/** Email only. */
|
|
457
|
+
cc?: SendRecipient[]
|
|
458
|
+
/** Email only. */
|
|
459
|
+
bcc?: SendRecipient[]
|
|
460
|
+
subject?: string
|
|
461
|
+
/** May be empty when attachments are present. */
|
|
462
|
+
content: ContentBlock[]
|
|
463
|
+
/** The complete attachment set to keep (omitting one removes its row). */
|
|
464
|
+
attachments?: FileRef[]
|
|
465
|
+
}
|
|
466
|
+
|
|
429
467
|
export interface CreateAgentListenerRequest {
|
|
430
468
|
connection_id?: string
|
|
431
469
|
conversation_id?: string
|