@or-sdk/hitl 0.35.2-beta.3703.0 → 0.35.2-beta.3708.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/cjs/api/Agents.js.map +1 -1
- package/dist/cjs/api/CannedMessages.js.map +1 -1
- package/dist/cjs/api/Commands.js.map +1 -1
- package/dist/cjs/api/Conferences.js.map +1 -1
- package/dist/cjs/api/Listeners.js +3 -2
- package/dist/cjs/api/Listeners.js.map +1 -1
- package/dist/cjs/types/commands.js.map +1 -1
- package/dist/cjs/types/conferences.js.map +1 -1
- package/dist/cjs/types/listeners.js +1 -2
- package/dist/cjs/types/listeners.js.map +1 -1
- package/dist/cjs/types/migrations.js.map +1 -1
- package/dist/cjs/types/tasks.js.map +1 -1
- package/dist/esm/api/Agents.js.map +1 -1
- package/dist/esm/api/CannedMessages.js.map +1 -1
- package/dist/esm/api/Commands.js.map +1 -1
- package/dist/esm/api/Conferences.js.map +1 -1
- package/dist/esm/api/Listeners.js +2 -1
- package/dist/esm/api/Listeners.js.map +1 -1
- package/dist/esm/types/commands.js.map +1 -1
- package/dist/esm/types/conferences.js.map +1 -1
- package/dist/esm/types/listeners.js +1 -2
- package/dist/esm/types/listeners.js.map +1 -1
- package/dist/esm/types/migrations.js.map +1 -1
- package/dist/esm/types/tasks.js.map +1 -1
- package/dist/types/api/Agents.d.ts.map +1 -1
- package/dist/types/api/CannedMessages.d.ts.map +1 -1
- package/dist/types/api/Commands.d.ts.map +1 -1
- package/dist/types/api/Conferences.d.ts +3 -3
- package/dist/types/api/Conferences.d.ts.map +1 -1
- package/dist/types/api/Listeners.d.ts +1 -0
- package/dist/types/api/Listeners.d.ts.map +1 -1
- package/dist/types/types/canned-messages.d.ts +18 -6
- package/dist/types/types/canned-messages.d.ts.map +1 -1
- package/dist/types/types/commands.d.ts +2 -1
- package/dist/types/types/commands.d.ts.map +1 -1
- package/dist/types/types/conferences.d.ts +18 -5
- package/dist/types/types/conferences.d.ts.map +1 -1
- package/dist/types/types/contacts-meta.d.ts +7 -3
- package/dist/types/types/contacts-meta.d.ts.map +1 -1
- package/dist/types/types/contacts.d.ts +4 -2
- package/dist/types/types/contacts.d.ts.map +1 -1
- package/dist/types/types/event-templates.d.ts +18 -6
- package/dist/types/types/event-templates.d.ts.map +1 -1
- package/dist/types/types/filters.d.ts +48 -26
- package/dist/types/types/filters.d.ts.map +1 -1
- package/dist/types/types/helpers.d.ts +2 -1
- package/dist/types/types/helpers.d.ts.map +1 -1
- package/dist/types/types/listeners.d.ts +23 -9
- package/dist/types/types/listeners.d.ts.map +1 -1
- package/dist/types/types/migrations.d.ts +29 -12
- package/dist/types/types/migrations.d.ts.map +1 -1
- package/dist/types/types/read-events.d.ts +8 -4
- package/dist/types/types/read-events.d.ts.map +1 -1
- package/dist/types/types/rule-groups.d.ts +13 -6
- package/dist/types/types/rule-groups.d.ts.map +1 -1
- package/dist/types/types/session-events.d.ts +18 -7
- package/dist/types/types/session-events.d.ts.map +1 -1
- package/dist/types/types/session-relations.d.ts +18 -6
- package/dist/types/types/session-relations.d.ts.map +1 -1
- package/dist/types/types/sessions.d.ts +82 -24
- package/dist/types/types/sessions.d.ts.map +1 -1
- package/dist/types/types/settings.d.ts +19 -8
- package/dist/types/types/settings.d.ts.map +1 -1
- package/dist/types/types/tasks.d.ts +2 -1
- package/dist/types/types/tasks.d.ts.map +1 -1
- package/dist/types/types/versions.d.ts +7 -2
- package/dist/types/types/versions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/Agents.ts +25 -11
- package/src/api/CannedMessages.ts +167 -18
- package/src/api/Commands.ts +43 -3
- package/src/api/Conferences.ts +135 -12
- package/src/api/ContactRuleGroups.ts +5 -5
- package/src/api/Contacts.ts +1 -1
- package/src/api/Listeners.ts +14 -10
- package/src/types/canned-messages.ts +28 -16
- package/src/types/commands.ts +3 -4
- package/src/types/conferences.ts +25 -10
- package/src/types/contacts-meta.ts +8 -7
- package/src/types/contacts.ts +4 -3
- package/src/types/event-templates.ts +26 -11
- package/src/types/filters.ts +63 -21
- package/src/types/helpers.ts +2 -2
- package/src/types/listeners.ts +33 -25
- package/src/types/migrations.ts +37 -12
- package/src/types/read-events.ts +10 -10
- package/src/types/rule-groups.ts +18 -12
- package/src/types/session-events.ts +33 -17
- package/src/types/session-relations.ts +19 -10
- package/src/types/sessions.ts +96 -44
- package/src/types/settings.ts +24 -15
- package/src/types/tasks.ts +3 -4
- package/src/types/versions.ts +7 -3
package/src/api/Agents.ts
CHANGED
|
@@ -21,6 +21,19 @@ import {
|
|
|
21
21
|
|
|
22
22
|
import { HITLBase } from './HITLBase';
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Manages HitL (Human-in-the-Loop) agents in the system
|
|
26
|
+
*
|
|
27
|
+
* This class provides functionality:
|
|
28
|
+
* - retrieve and search agents,
|
|
29
|
+
* - manage agents permissions, status and additional meta information
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* - All methods in this class interact with the `/agents` endpoint
|
|
33
|
+
* - For methods getAgentStatus, setAgentStatus and updateAgentsStatusByQuery need to use { version: 2 }
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
24
37
|
export class Agents extends HITLBase {
|
|
25
38
|
protected static MODULE_URL = 'agents';
|
|
26
39
|
protected static AGENT_SEARCH_URL = 'search';
|
|
@@ -44,6 +57,7 @@ export class Agents extends HITLBase {
|
|
|
44
57
|
* - `orderBy` - (Optional, string) Field name to order the results by
|
|
45
58
|
* - `order` - (Optional, 'asc'|'desc') Order direction
|
|
46
59
|
* - `version` - (Optional, number) API version
|
|
60
|
+
* - `timeout` - (Optional, number) Search timeout in milliseconds
|
|
47
61
|
*
|
|
48
62
|
* @returns {Promise<GetAgentsResponse>} Promise resolving to:
|
|
49
63
|
* - `data` - Array of partial agent objects {@link Agent}
|
|
@@ -53,7 +67,7 @@ export class Agents extends HITLBase {
|
|
|
53
67
|
*
|
|
54
68
|
* @example
|
|
55
69
|
* ```typescript
|
|
56
|
-
* const response = await
|
|
70
|
+
* const response = await hitlApi.agents.getAgents({
|
|
57
71
|
* limit: 10,
|
|
58
72
|
* offset: 0,
|
|
59
73
|
* orderBy: 'createdAt',
|
|
@@ -64,7 +78,7 @@ export class Agents extends HITLBase {
|
|
|
64
78
|
* @example
|
|
65
79
|
* Using projection and filtering by specific agents:
|
|
66
80
|
* ```typescript
|
|
67
|
-
* const response = await
|
|
81
|
+
* const response = await hitlApi.agents.getAgents({
|
|
68
82
|
* agentIds: ['agent1', 'agent2'],
|
|
69
83
|
* projection: ['id', 'name', 'statusData'],
|
|
70
84
|
* orderBy: 'name',
|
|
@@ -107,7 +121,7 @@ export class Agents extends HITLBase {
|
|
|
107
121
|
*
|
|
108
122
|
* @example
|
|
109
123
|
* ```typescript
|
|
110
|
-
* const response = await
|
|
124
|
+
* const response = await hitlApi.agents.getCompleteAgents();
|
|
111
125
|
* ```
|
|
112
126
|
*
|
|
113
127
|
* @remarks
|
|
@@ -144,7 +158,7 @@ export class Agents extends HITLBase {
|
|
|
144
158
|
*
|
|
145
159
|
* @example
|
|
146
160
|
* ```typescript
|
|
147
|
-
* const agent = await
|
|
161
|
+
* const agent = await hitlApi.agents.getCompleteAgentById({
|
|
148
162
|
* agentId: 'agent-id',
|
|
149
163
|
* multiUserId: 'multi456'
|
|
150
164
|
* });
|
|
@@ -193,7 +207,7 @@ export class Agents extends HITLBase {
|
|
|
193
207
|
*
|
|
194
208
|
* @example
|
|
195
209
|
* ```typescript
|
|
196
|
-
* const response = await
|
|
210
|
+
* const response = await hitlApi.agents.searchAgents({
|
|
197
211
|
* ruleGroupIds: ['group1', 'group2'],
|
|
198
212
|
* statuses: ['AVAILABLE', 'BUSY'],
|
|
199
213
|
* projection: ['id', 'name', 'statusData']
|
|
@@ -238,7 +252,7 @@ export class Agents extends HITLBase {
|
|
|
238
252
|
*
|
|
239
253
|
* @example
|
|
240
254
|
* ```typescript
|
|
241
|
-
* const updatedAgent = await
|
|
255
|
+
* const updatedAgent = await hitlApi.agents.updateAgent({
|
|
242
256
|
* agentId: 'agent-id',
|
|
243
257
|
* ruleGroupIds: ['group1', 'group2'],
|
|
244
258
|
* meta: {
|
|
@@ -284,7 +298,7 @@ export class Agents extends HITLBase {
|
|
|
284
298
|
*
|
|
285
299
|
* @example
|
|
286
300
|
* ```typescript
|
|
287
|
-
* const updatedAgent = await
|
|
301
|
+
* const updatedAgent = await hitlApi.agents.updateAgentRuleGroups({
|
|
288
302
|
* agentId: 'agent-id',
|
|
289
303
|
* addRuleGroupIds: ['group1', 'group2'],
|
|
290
304
|
* removeRuleGroupIds: ['group3', 'group4']
|
|
@@ -327,7 +341,7 @@ export class Agents extends HITLBase {
|
|
|
327
341
|
*
|
|
328
342
|
* @example
|
|
329
343
|
* ```typescript
|
|
330
|
-
* const status = await
|
|
344
|
+
* const status = await hitlApi.agents.getAgentStatus({
|
|
331
345
|
* agentId: 'agent-id',
|
|
332
346
|
* version: 2
|
|
333
347
|
* });
|
|
@@ -368,7 +382,7 @@ export class Agents extends HITLBase {
|
|
|
368
382
|
*
|
|
369
383
|
* @example
|
|
370
384
|
* ```typescript
|
|
371
|
-
* const status = await
|
|
385
|
+
* const status = await hitlApi.agents.pingAgentStatus();
|
|
372
386
|
* ```
|
|
373
387
|
*
|
|
374
388
|
* @remarks
|
|
@@ -409,7 +423,7 @@ export class Agents extends HITLBase {
|
|
|
409
423
|
*
|
|
410
424
|
* @example
|
|
411
425
|
* ```typescript
|
|
412
|
-
* await
|
|
426
|
+
* await hitlApi.agents.setAgentStatus({
|
|
413
427
|
* agentId: 'agent-id',
|
|
414
428
|
* statusData: {
|
|
415
429
|
* key: 'busy',
|
|
@@ -466,7 +480,7 @@ export class Agents extends HITLBase {
|
|
|
466
480
|
*
|
|
467
481
|
* @example
|
|
468
482
|
* ```typescript
|
|
469
|
-
* const result = await
|
|
483
|
+
* const result = await hitlApi.agents.updateAgentsStatusByQuery({
|
|
470
484
|
* query: `UPDATE hitl.agents SET status_data = jsonb_set(status_data, '{key}', '"busy"') WHERE status_data->>'key'='available' RETURNING*`,
|
|
471
485
|
* maxRetries: 5,
|
|
472
486
|
* version: 2
|
|
@@ -10,19 +10,76 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import { HITLBase } from './HITLBase';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Manages canned messages (predefined message templates) in the system
|
|
15
|
+
*
|
|
16
|
+
* This class provides functionality to create, retrieve, update, and delete canned messages.
|
|
17
|
+
* Canned messages are predefined templates that can be used for quick responses in various scenarios.
|
|
18
|
+
*
|
|
19
|
+
* Key features:
|
|
20
|
+
* - Manage message templates with categories and labels
|
|
21
|
+
* - Support for common (shared) messages across agents
|
|
22
|
+
* - Attachment handling capabilities
|
|
23
|
+
* - Rule-based tagging system
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Basic usage:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Get all canned messages
|
|
29
|
+
* const messages = await hitlApi.сannedMessages.getCannedMessages();
|
|
30
|
+
*
|
|
31
|
+
* // Create a new template
|
|
32
|
+
* const newTemplate = await hitlApi.сannedMessages.createCannedMessage({
|
|
33
|
+
* category: 'greeting',
|
|
34
|
+
* text: 'Hello! How can I help you today?',
|
|
35
|
+
* isCommon: true
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - All methods in this class interact with the `/canned-messages` endpoint
|
|
41
|
+
* - Available only { version: 1 } of API
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
13
44
|
export class CannedMessages extends HITLBase {
|
|
14
45
|
protected static MODULE_URL = 'canned-messages';
|
|
15
46
|
|
|
16
47
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
48
|
+
* Gets a list of canned messages (message templates)
|
|
49
|
+
*
|
|
50
|
+
* @param options - Configuration options for the canned messages list request
|
|
51
|
+
*
|
|
52
|
+
* Options can include:
|
|
53
|
+
* - `agentId` - (Optional, string) Filter messages by specific agent
|
|
54
|
+
* - `categories` - (Optional, string[]) Filter by message categories
|
|
55
|
+
* - `id` - (Optional, string) Get specific message by ID
|
|
56
|
+
* - `ignoreRuleTags` - (Optional, boolean) Whether to ignore rule tags in filtering
|
|
57
|
+
* - `isCommon` - (Optional, boolean) Filter by system or personal message status
|
|
58
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
59
|
+
* - `version` - (Optional, string | number) API version to use
|
|
60
|
+
*
|
|
61
|
+
* @returns {Promise<GetCannedMessagesResponse | CannedMessage>} Promise resolving to:
|
|
62
|
+
* - `data` - Array of canned message objects {@link CannedMessage}
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const response = await hitlApi.сannedMessages.getCannedMessages({
|
|
67
|
+
* categories: ['support', 'greeting'],
|
|
68
|
+
* isCommon: true,
|
|
69
|
+
* agentId: 'agent123'
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Makes a GET request to the `/canned-messages` endpoint
|
|
75
|
+
* @public
|
|
19
76
|
*/
|
|
20
77
|
public static async getCannedMessages(
|
|
21
|
-
options: GetCannedMessagesOptions = {}
|
|
78
|
+
options: GetCannedMessagesOptions = {},
|
|
22
79
|
): Promise<GetCannedMessagesResponse | CannedMessage> {
|
|
23
80
|
const route = this.getBaseUrl(options);
|
|
24
81
|
const params = Object.fromEntries(
|
|
25
|
-
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
82
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key)),
|
|
26
83
|
);
|
|
27
84
|
|
|
28
85
|
return this.request({
|
|
@@ -33,17 +90,52 @@ export class CannedMessages extends HITLBase {
|
|
|
33
90
|
});
|
|
34
91
|
}
|
|
35
92
|
|
|
36
|
-
|
|
37
93
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
94
|
+
* Creates a new canned message (message template)
|
|
95
|
+
*
|
|
96
|
+
* @param options - Configuration options for creating the canned message
|
|
97
|
+
*
|
|
98
|
+
* Required options:
|
|
99
|
+
* - `category` - (string) Category of the message
|
|
100
|
+
* - `text` - (string) Content of the message
|
|
101
|
+
*
|
|
102
|
+
* Optional options:
|
|
103
|
+
* - `agentId` - (Optional, string) ID of the agent to associate with
|
|
104
|
+
* - `attachments` - (Optional, CannedMessageAttachment[]) Array of attachments
|
|
105
|
+
* - `isCommon` - (Optional, boolean) Whether the message is system or pesronal
|
|
106
|
+
* - `label` - (Optional, string) Label for the message
|
|
107
|
+
* - `ruleTags` - (Optional, string[]) Array of rule tags
|
|
108
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
109
|
+
* - `version` - (Optional, string | number) API version to use
|
|
110
|
+
*
|
|
111
|
+
* @returns {Promise<CannedMessage>} Promise resolving to the created canned message
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const newMessage = await hitlApi.сannedMessages.createCannedMessage({
|
|
116
|
+
* category: 'support',
|
|
117
|
+
* text: "Thank you for your patience!",
|
|
118
|
+
* label: "Thank You Response",
|
|
119
|
+
* isCommon: true,
|
|
120
|
+
* ruleTags: ['greeting', 'sms'],
|
|
121
|
+
* attachments: [
|
|
122
|
+
* {
|
|
123
|
+
* "key": "IMAGE.JPG"
|
|
124
|
+
* }
|
|
125
|
+
* ]
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* Makes a POST request to the `/canned-messages` endpoint
|
|
131
|
+
* @public
|
|
40
132
|
*/
|
|
41
133
|
public static async createCannedMessage(
|
|
42
|
-
{ isCommon, agentId, ...options }: CreateCannedMessageOptions
|
|
134
|
+
{ isCommon, agentId, ...options }: CreateCannedMessageOptions,
|
|
43
135
|
): Promise<CannedMessage> {
|
|
44
136
|
const route = this.getBaseUrl(options);
|
|
45
137
|
const data = Object.fromEntries(
|
|
46
|
-
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
138
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key)),
|
|
47
139
|
);
|
|
48
140
|
|
|
49
141
|
return this.request({
|
|
@@ -58,17 +150,54 @@ export class CannedMessages extends HITLBase {
|
|
|
58
150
|
});
|
|
59
151
|
}
|
|
60
152
|
|
|
61
|
-
|
|
62
153
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
154
|
+
* Updates an existing canned message (message template)
|
|
155
|
+
*
|
|
156
|
+
* @param options - Configuration options for updating the canned message
|
|
157
|
+
*
|
|
158
|
+
* Required options:
|
|
159
|
+
* - `id` - (string) Unique identifier of the message to update
|
|
160
|
+
*
|
|
161
|
+
* Optional update fields:
|
|
162
|
+
* - `attachments` - (Optional, CannedMessageAttachment[]) Array of attachments
|
|
163
|
+
* - `category` - (Optional, string) New category for the message
|
|
164
|
+
* - `label` - (Optional, string) New label for the message
|
|
165
|
+
* - `ruleTags` - (Optional, string[]) New array of rule tags
|
|
166
|
+
* - `text` - (Optional, string) New content of the message
|
|
167
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
168
|
+
* - `version` - (Optional, string | number) API version to use
|
|
169
|
+
*
|
|
170
|
+
* System fields (automatically managed):
|
|
171
|
+
* - `createdAt` - (Optional, Date) Creation timestamp
|
|
172
|
+
* - `updatedAt` - (Optional, Date) Last update timestamp
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<CannedMessage>} Promise resolving to the updated canned message
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const updatedMessage = await hitlApi.сannedMessages.updateCannedMessage({
|
|
179
|
+
* id: "msg123",
|
|
180
|
+
* text: "Updated response text",
|
|
181
|
+
* category: "support",
|
|
182
|
+
* ruleTags: ['sms', 'admin'],
|
|
183
|
+
* attachments: [
|
|
184
|
+
* {
|
|
185
|
+
* "key": "IMAGE_2.JPG"
|
|
186
|
+
* }
|
|
187
|
+
* ]
|
|
188
|
+
* });
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* Makes a PUT request to the `/canned-messages` endpoint
|
|
193
|
+
* @public
|
|
65
194
|
*/
|
|
66
195
|
public static async updateCannedMessage(
|
|
67
|
-
options: UpdateCannedMessageOptions
|
|
196
|
+
options: UpdateCannedMessageOptions,
|
|
68
197
|
): Promise<CannedMessage> {
|
|
69
198
|
const route = this.getBaseUrl(options);
|
|
70
199
|
const data = Object.fromEntries(
|
|
71
|
-
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key))
|
|
200
|
+
Object.entries(options).filter(([key]) => !DEFAULT_OMIT_FIELDS.includes(key)),
|
|
72
201
|
);
|
|
73
202
|
|
|
74
203
|
return this.request({
|
|
@@ -80,12 +209,32 @@ export class CannedMessages extends HITLBase {
|
|
|
80
209
|
}
|
|
81
210
|
|
|
82
211
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
212
|
+
* Deletes a canned message (message template)
|
|
213
|
+
*
|
|
214
|
+
* @param options - Configuration options for deleting the canned message
|
|
215
|
+
*
|
|
216
|
+
* Required options:
|
|
217
|
+
* - `id` - (string) Unique identifier of the message to delete
|
|
218
|
+
*
|
|
219
|
+
* Optional options:
|
|
220
|
+
* - `version` - (Optional, string | number) API version to use
|
|
221
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
222
|
+
*
|
|
223
|
+
* @returns {Promise<void>} Promise that resolves when deletion is complete
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* await hitlApi.сannedMessages.deleteCannedMessage({
|
|
228
|
+
* id: "msg123"
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* Makes a DELETE request to the `/canned-messages` endpoint
|
|
234
|
+
* @public
|
|
85
235
|
*/
|
|
86
|
-
|
|
87
236
|
public static async deleteCannedMessage(
|
|
88
|
-
{ id, ...options }: DeleteCannedMessageOptions
|
|
237
|
+
{ id, ...options }: DeleteCannedMessageOptions,
|
|
89
238
|
): Promise<void> {
|
|
90
239
|
const route = this.getBaseUrl(options);
|
|
91
240
|
|
package/src/api/Commands.ts
CHANGED
|
@@ -2,15 +2,55 @@ import { ApplyCommandOptions } from '../types/commands';
|
|
|
2
2
|
|
|
3
3
|
import { HITLBase } from './HITLBase';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Manages command operations in the HitL (Human-in-the-Loop) system
|
|
7
|
+
*
|
|
8
|
+
* This class provides functionality to send and manage commands within HitL sessions,
|
|
9
|
+
* allowing control and interaction with conversations or processes.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - All methods in this class interact with the `/commands` endpoint
|
|
13
|
+
* - Available only { version: 1 } of API
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
5
17
|
export class Commands extends HITLBase {
|
|
6
18
|
protected static MODULE_URL = 'commands';
|
|
7
19
|
|
|
8
20
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
21
|
+
* Sends a command to the flow currently controlling the HitL session
|
|
22
|
+
*
|
|
23
|
+
* This method allows sending specific commands to modify or control the behavior
|
|
24
|
+
* of HitL session. The command is processed by the flow subscription
|
|
25
|
+
* of the specified session.
|
|
26
|
+
*
|
|
27
|
+
* @param options - Configuration options for the command
|
|
28
|
+
*
|
|
29
|
+
* Options can include:
|
|
30
|
+
* - `command` - (Required, string) The command to be executed in the session
|
|
31
|
+
* - `sessionId` - (Required, string) ID of the target HITL session
|
|
32
|
+
* - `data` - (Required, object) Command-specific payload containing parameters for execution
|
|
33
|
+
* - `version` - (Optional, number) API version to use for the request
|
|
34
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise<void> that resolves when the command is successfully applied
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* await hitlApi.commands.applyCommandToSession({
|
|
41
|
+
* command: 'send_message',
|
|
42
|
+
* sessionId: 'session-id',
|
|
43
|
+
* data: {
|
|
44
|
+
* media: [],
|
|
45
|
+
* text: 'hello world'
|
|
46
|
+
* }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
11
51
|
*/
|
|
12
52
|
public static async applyCommandToSession(
|
|
13
|
-
{ command, sessionId, data, ...options }: ApplyCommandOptions
|
|
53
|
+
{ command, sessionId, data, ...options }: ApplyCommandOptions,
|
|
14
54
|
): Promise<void> {
|
|
15
55
|
const route = this.getBaseUrl(options);
|
|
16
56
|
|
package/src/api/Conferences.ts
CHANGED
|
@@ -1,23 +1,86 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GetConferenceMembersOptions,
|
|
3
3
|
GetConferenceMembersResponse,
|
|
4
|
-
|
|
4
|
+
ConferenceMember,
|
|
5
5
|
AddOrUpdateConferenceMemberOptions,
|
|
6
6
|
CleanUpConferenceOptions,
|
|
7
7
|
} from '../types/conferences';
|
|
8
8
|
|
|
9
9
|
import { HITLBase } from './HITLBase';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Manages conference members and their interactions in the system
|
|
13
|
+
*
|
|
14
|
+
* This class provides functionality to manage conference participants, including retrieving,
|
|
15
|
+
* adding, updating, and removing conference members.
|
|
16
|
+
*
|
|
17
|
+
* Key features:
|
|
18
|
+
* - Manage conference member states and statuses
|
|
19
|
+
* - Handle member identifiers and types
|
|
20
|
+
* - Track member connection states
|
|
21
|
+
* - Support for cleanup operations
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* Basic usage:
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Get conference members
|
|
27
|
+
* const members = await hitlApi.conferences.getConferenceMembers({
|
|
28
|
+
* hitlSessionId: 'session123'
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Add a new conference member
|
|
32
|
+
* const newMember = await hitlApi.conferences.addOrUpdateConferenceMember({
|
|
33
|
+
* hitlSessionId: 'session123',
|
|
34
|
+
* type: 'participant',
|
|
35
|
+
* identifier: 'user456'
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - All methods in this class interact with the `/conferences` endpoint
|
|
41
|
+
* - Supports HITL (Human-In-The-Loop) session management
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
11
44
|
export class Conferences extends HITLBase {
|
|
12
45
|
protected static MODULE_URL = 'conferences';
|
|
13
46
|
|
|
14
47
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
48
|
+
* Gets a list of conference members or a specific member
|
|
49
|
+
*
|
|
50
|
+
* @param options - Configuration options for the conference members request
|
|
51
|
+
*
|
|
52
|
+
* Required options:
|
|
53
|
+
* - `hitlSessionId` - (string) ID of the HITL session
|
|
54
|
+
*
|
|
55
|
+
* Optional options:
|
|
56
|
+
* - `memberId` - (Optional, string) Get specific member by ID
|
|
57
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
58
|
+
* - `version` - (Optional, string | number) API version to use
|
|
59
|
+
*
|
|
60
|
+
* @returns {Promise<GetConferenceMembersResponse | ConferenceMember>} Promise resolving to:
|
|
61
|
+
* - Either a list of conference members or a single member if memberId is provided
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* // Get all members in a conference
|
|
66
|
+
* const response = await hitlApi.conferences.getConferenceMembers({
|
|
67
|
+
* hitlSessionId: 'session123'
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Get a specific member
|
|
71
|
+
* const member = await hitlApi.conferences.getConferenceMembers({
|
|
72
|
+
* hitlSessionId: 'session123',
|
|
73
|
+
* memberId: 'member456'
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Makes a GET request to the `/conferences` endpoint
|
|
79
|
+
* @public
|
|
17
80
|
*/
|
|
18
81
|
public static getConferenceMembers(
|
|
19
|
-
{ hitlSessionId, memberId, ...options }: GetConferenceMembersOptions
|
|
20
|
-
): Promise<GetConferenceMembersResponse |
|
|
82
|
+
{ hitlSessionId, memberId, ...options }: GetConferenceMembersOptions,
|
|
83
|
+
): Promise<GetConferenceMembersResponse | ConferenceMember> {
|
|
21
84
|
const route = this.getBaseUrl(options);
|
|
22
85
|
|
|
23
86
|
return this.request({
|
|
@@ -31,8 +94,39 @@ export class Conferences extends HITLBase {
|
|
|
31
94
|
}
|
|
32
95
|
|
|
33
96
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
97
|
+
* Adds or updates a conference member
|
|
98
|
+
*
|
|
99
|
+
* @param options - Configuration options for adding/updating the conference member
|
|
100
|
+
*
|
|
101
|
+
* Required options:
|
|
102
|
+
* - `hitlSessionId` - (string) ID of the HITL session
|
|
103
|
+
* - `identifier` - (string) Unique identifier for the member
|
|
104
|
+
* - `type` - (string) Type of the conference member
|
|
105
|
+
*
|
|
106
|
+
* Optional options:
|
|
107
|
+
* - `memberId` - (Optional, string) ID of the member to update
|
|
108
|
+
* - `status` - (Optional, string) Member's status
|
|
109
|
+
* - `state` - (Optional, string) Member's state
|
|
110
|
+
* - `disconnectedAt` - (Optional, Date) Timestamp when member disconnected
|
|
111
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
112
|
+
* - `version` - (Optional, string | number) API version to use
|
|
113
|
+
*
|
|
114
|
+
* @returns {Promise<ConferenceMember>} Promise resolving to the created/updated conference member
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const member = await hitlApi.conferences.addOrUpdateConferenceMember({
|
|
119
|
+
* hitlSessionId: 'session123',
|
|
120
|
+
* identifier: 'user456',
|
|
121
|
+
* type: 'participant',
|
|
122
|
+
* status: 'active',
|
|
123
|
+
* state: 'connected'
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* Makes a POST request to the `/conferences` endpoint
|
|
129
|
+
* @public
|
|
36
130
|
*/
|
|
37
131
|
public static addOrUpdateConferenceMember(
|
|
38
132
|
{
|
|
@@ -44,8 +138,8 @@ export class Conferences extends HITLBase {
|
|
|
44
138
|
state,
|
|
45
139
|
disconnectedAt,
|
|
46
140
|
...options
|
|
47
|
-
}: AddOrUpdateConferenceMemberOptions
|
|
48
|
-
): Promise<
|
|
141
|
+
}: AddOrUpdateConferenceMemberOptions,
|
|
142
|
+
): Promise<ConferenceMember> {
|
|
49
143
|
const route = this.getBaseUrl(options);
|
|
50
144
|
|
|
51
145
|
return this.request({
|
|
@@ -65,11 +159,40 @@ export class Conferences extends HITLBase {
|
|
|
65
159
|
}
|
|
66
160
|
|
|
67
161
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
162
|
+
* Removes conference members from a session
|
|
163
|
+
*
|
|
164
|
+
* @param options - Configuration options for cleaning up the conference
|
|
165
|
+
*
|
|
166
|
+
* Required options:
|
|
167
|
+
* - `hitlSessionId` - (string) ID of the HITL session to clean up
|
|
168
|
+
*
|
|
169
|
+
* Optional options:
|
|
170
|
+
* - `memberId` - (Optional, string) Specific member to remove
|
|
171
|
+
* - `timeout` - (Optional, number) Request timeout in milliseconds
|
|
172
|
+
* - `version` - (Optional, string | number) API version to use
|
|
173
|
+
*
|
|
174
|
+
* @returns {Promise<void>} Promise that resolves when cleanup is complete
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* // Clean up entire conference
|
|
179
|
+
* await hitlApi.conferences.cleanUpConference({
|
|
180
|
+
* hitlSessionId: 'session123'
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* // Remove specific member
|
|
184
|
+
* await hitlApi.conferences.cleanUpConference({
|
|
185
|
+
* hitlSessionId: 'session123',
|
|
186
|
+
* memberId: 'member456'
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* Makes a DELETE request to the `/conferences` endpoint
|
|
192
|
+
* @public
|
|
70
193
|
*/
|
|
71
194
|
public static cleanUpConference(
|
|
72
|
-
{ hitlSessionId, memberId, ...options }: CleanUpConferenceOptions
|
|
195
|
+
{ hitlSessionId, memberId, ...options }: CleanUpConferenceOptions,
|
|
73
196
|
): Promise<void> {
|
|
74
197
|
const route = this.getBaseUrl(options);
|
|
75
198
|
|
|
@@ -18,11 +18,11 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
18
18
|
* @param options
|
|
19
19
|
*/
|
|
20
20
|
public static searchContactRuleGroups(
|
|
21
|
-
{ groupIdList, ...options }: SearchRuleGroupsOptions = {}
|
|
21
|
+
{ groupIdList, ...options }: SearchRuleGroupsOptions = {},
|
|
22
22
|
): Promise<SearchRuleGroupsResponse | RuleGroup> {
|
|
23
23
|
const route = this.getBaseUrl(options);
|
|
24
24
|
const params = Object.fromEntries(
|
|
25
|
-
Object.entries(options).filter(([key]) => ![...DEFAULT_OMIT_FIELDS, 'accountId'].includes(key))
|
|
25
|
+
Object.entries(options).filter(([key]) => ![...DEFAULT_OMIT_FIELDS, 'accountId'].includes(key)),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
return this.request({
|
|
@@ -38,7 +38,7 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
38
38
|
* @param options
|
|
39
39
|
*/
|
|
40
40
|
public static createContactRuleGroup(
|
|
41
|
-
{ groupId, name, rules, ...options }: CreateRuleGroupOptions
|
|
41
|
+
{ groupId, name, rules, ...options }: CreateRuleGroupOptions,
|
|
42
42
|
): Promise<RuleGroup> {
|
|
43
43
|
const route = this.getBaseUrl(options);
|
|
44
44
|
|
|
@@ -59,7 +59,7 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
59
59
|
* @param options
|
|
60
60
|
*/
|
|
61
61
|
public static updateContactRuleGroup(
|
|
62
|
-
{ groupId, name, rules, ...options }: UpdateRuleGroupOptions
|
|
62
|
+
{ groupId, name, rules, ...options }: UpdateRuleGroupOptions,
|
|
63
63
|
): Promise<RuleGroup> {
|
|
64
64
|
const route = this.getBaseUrl(options);
|
|
65
65
|
|
|
@@ -80,7 +80,7 @@ export class ContactRuleGroups extends HITLBase {
|
|
|
80
80
|
* @param options
|
|
81
81
|
*/
|
|
82
82
|
public static deleteContactRuleGroup(
|
|
83
|
-
{ groupId, ...options }: DeleteRuleGroupOptions
|
|
83
|
+
{ groupId, ...options }: DeleteRuleGroupOptions,
|
|
84
84
|
): Promise<void> {
|
|
85
85
|
const route = this.getBaseUrl(options);
|
|
86
86
|
|
package/src/api/Contacts.ts
CHANGED
|
@@ -11,7 +11,7 @@ export class Contacts extends HITLBase {
|
|
|
11
11
|
* @param options
|
|
12
12
|
*/
|
|
13
13
|
public static async searchContacts(
|
|
14
|
-
options: SearchContactsOptions
|
|
14
|
+
options: SearchContactsOptions,
|
|
15
15
|
): Promise<SearchContactsResponse> {
|
|
16
16
|
const route = this.getBaseUrl(options);
|
|
17
17
|
|