@or-sdk/hitl 0.28.2 → 0.28.3-beta.590.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 +0 -14
- package/dist/cjs/api/Agents.js.map +1 -1
- package/dist/cjs/api/CannedMessages.js +0 -14
- package/dist/cjs/api/CannedMessages.js.map +1 -1
- package/dist/cjs/api/Commands.js +0 -14
- package/dist/cjs/api/Commands.js.map +1 -1
- package/dist/cjs/api/Conferences.js +0 -14
- package/dist/cjs/api/Conferences.js.map +1 -1
- package/dist/cjs/api/EventTemplates.js +0 -14
- package/dist/cjs/api/EventTemplates.js.map +1 -1
- package/dist/cjs/api/Filters.js +0 -14
- package/dist/cjs/api/Filters.js.map +1 -1
- package/dist/cjs/api/HITLBase.js +2 -1
- package/dist/cjs/api/HITLBase.js.map +1 -1
- package/dist/cjs/api/Listeners.js +0 -14
- package/dist/cjs/api/Listeners.js.map +1 -1
- package/dist/cjs/api/Migrations.js +0 -14
- package/dist/cjs/api/Migrations.js.map +1 -1
- package/dist/cjs/api/RuleGroups.js +0 -14
- package/dist/cjs/api/RuleGroups.js.map +1 -1
- package/dist/cjs/api/SessionEvents.js +11 -14
- package/dist/cjs/api/SessionEvents.js.map +1 -1
- package/dist/cjs/api/Sessions.js +162 -15
- package/dist/cjs/api/Sessions.js.map +1 -1
- package/dist/cjs/api/Settings.js +0 -14
- package/dist/cjs/api/Settings.js.map +1 -1
- package/dist/cjs/types/common.js +6 -1
- package/dist/cjs/types/common.js.map +1 -1
- package/dist/esm/api/Agents.js +0 -3
- package/dist/esm/api/Agents.js.map +1 -1
- package/dist/esm/api/CannedMessages.js +0 -3
- package/dist/esm/api/CannedMessages.js.map +1 -1
- package/dist/esm/api/Commands.js +0 -3
- package/dist/esm/api/Commands.js.map +1 -1
- package/dist/esm/api/Conferences.js +0 -3
- package/dist/esm/api/Conferences.js.map +1 -1
- package/dist/esm/api/EventTemplates.js +0 -3
- package/dist/esm/api/EventTemplates.js.map +1 -1
- package/dist/esm/api/Filters.js +0 -3
- package/dist/esm/api/Filters.js.map +1 -1
- package/dist/esm/api/HITLBase.js +2 -1
- package/dist/esm/api/HITLBase.js.map +1 -1
- package/dist/esm/api/Listeners.js +0 -3
- package/dist/esm/api/Listeners.js.map +1 -1
- package/dist/esm/api/Migrations.js +0 -3
- package/dist/esm/api/Migrations.js.map +1 -1
- package/dist/esm/api/RuleGroups.js +0 -3
- package/dist/esm/api/RuleGroups.js.map +1 -1
- package/dist/esm/api/SessionEvents.js +11 -3
- package/dist/esm/api/SessionEvents.js.map +1 -1
- package/dist/esm/api/Sessions.js +132 -4
- package/dist/esm/api/Sessions.js.map +1 -1
- package/dist/esm/api/Settings.js +0 -3
- package/dist/esm/api/Settings.js.map +1 -1
- package/dist/esm/types/common.js +2 -2
- package/dist/esm/types/common.js.map +1 -1
- package/dist/types/api/Agents.d.ts +0 -2
- package/dist/types/api/Agents.d.ts.map +1 -1
- package/dist/types/api/CannedMessages.d.ts +0 -2
- package/dist/types/api/CannedMessages.d.ts.map +1 -1
- package/dist/types/api/Commands.d.ts +0 -2
- package/dist/types/api/Commands.d.ts.map +1 -1
- package/dist/types/api/Conferences.d.ts +0 -2
- package/dist/types/api/Conferences.d.ts.map +1 -1
- package/dist/types/api/EventTemplates.d.ts +0 -2
- package/dist/types/api/EventTemplates.d.ts.map +1 -1
- package/dist/types/api/Filters.d.ts +0 -2
- package/dist/types/api/Filters.d.ts.map +1 -1
- package/dist/types/api/HITLBase.d.ts +1 -0
- package/dist/types/api/HITLBase.d.ts.map +1 -1
- package/dist/types/api/Listeners.d.ts +0 -2
- package/dist/types/api/Listeners.d.ts.map +1 -1
- package/dist/types/api/Migrations.d.ts +0 -2
- package/dist/types/api/Migrations.d.ts.map +1 -1
- package/dist/types/api/RuleGroups.d.ts +0 -2
- package/dist/types/api/RuleGroups.d.ts.map +1 -1
- package/dist/types/api/SessionEvents.d.ts +2 -3
- package/dist/types/api/SessionEvents.d.ts.map +1 -1
- package/dist/types/api/Sessions.d.ts +19 -5
- package/dist/types/api/Sessions.d.ts.map +1 -1
- package/dist/types/api/Settings.d.ts +0 -2
- package/dist/types/api/Settings.d.ts.map +1 -1
- package/dist/types/types/common.d.ts +3 -3
- package/dist/types/types/common.d.ts.map +1 -1
- package/dist/types/types/read-events.d.ts +2 -2
- package/dist/types/types/read-events.d.ts.map +1 -1
- package/dist/types/types/session-events.d.ts +2 -0
- package/dist/types/types/session-events.d.ts.map +1 -1
- package/dist/types/types/sessions.d.ts +19 -3
- package/dist/types/types/sessions.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/api/Agents.ts +0 -8
- package/src/api/CannedMessages.ts +0 -8
- package/src/api/Commands.ts +0 -8
- package/src/api/Conferences.ts +0 -8
- package/src/api/EventTemplates.ts +0 -8
- package/src/api/Filters.ts +0 -8
- package/src/api/HITLBase.ts +7 -1
- package/src/api/Listeners.ts +0 -8
- package/src/api/Migrations.ts +0 -8
- package/src/api/RuleGroups.ts +0 -8
- package/src/api/SessionEvents.ts +17 -8
- package/src/api/Sessions.ts +172 -9
- package/src/api/Settings.ts +0 -8
- package/src/types/common.ts +17 -3
- package/src/types/read-events.ts +3 -3
- package/src/types/session-events.ts +5 -0
- package/src/types/sessions.ts +45 -3
package/src/api/Sessions.ts
CHANGED
|
@@ -1,28 +1,191 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import URI from 'urijs';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
ClaimSessionByAgentOptions,
|
|
6
|
+
CloseSessionOptions,
|
|
7
|
+
GetInitTriggersOptions,
|
|
8
|
+
GetInitTriggersResponse,
|
|
9
|
+
GetQueueSessionOptions,
|
|
10
|
+
GetQueueSessionResponse,
|
|
11
|
+
GetSessionsOptions,
|
|
12
|
+
GetSessionsResponse,
|
|
13
|
+
SearchSessionsOptions,
|
|
14
|
+
SearchSessionsResponse,
|
|
15
|
+
Session,
|
|
16
|
+
StartConversationOptions,
|
|
17
|
+
TransferToBotOptions,
|
|
18
|
+
UpdateSessionOptions,
|
|
19
|
+
SearchSessionsWithContactsOptions,
|
|
20
|
+
SearchSessionsWithContactsResponse,
|
|
21
|
+
} from '../types/sessions';
|
|
5
22
|
import { HITLBase } from './HITLBase';
|
|
6
23
|
|
|
7
24
|
export class Sessions extends HITLBase {
|
|
8
25
|
protected static MODULE_URL = 'sessions';
|
|
9
|
-
|
|
26
|
+
|
|
27
|
+
protected static SEARCH_URL = 'search';
|
|
28
|
+
protected static SEARCH_WITH_CONTACTS_URL = 'search-with-contacts';
|
|
29
|
+
protected static GET_TRIGGERS_URL = 'triggers';
|
|
30
|
+
protected static GET_QUEUE_SESSION_URL = 'queue';
|
|
31
|
+
|
|
32
|
+
protected static CLAIM_URL = 'claim';
|
|
33
|
+
protected static TRANSFER_TO_BOT_URL = 'transfer-to-bot';
|
|
34
|
+
protected static START_CONVERSATION_URL = 'start-conversation';
|
|
35
|
+
protected static CLOSE_URL = 'close';
|
|
36
|
+
|
|
37
|
+
public static async getSessions(
|
|
38
|
+
options: GetSessionsOptions = {}
|
|
39
|
+
): Promise<GetSessionsResponse> {
|
|
40
|
+
const route = this.getBaseUrl(options);
|
|
41
|
+
const params = _.omit(options, ['version']);
|
|
42
|
+
|
|
43
|
+
return this.request({
|
|
44
|
+
method: 'GET',
|
|
45
|
+
route,
|
|
46
|
+
params,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static async searchSessions(
|
|
51
|
+
options: SearchSessionsOptions = {}
|
|
52
|
+
): Promise<SearchSessionsResponse> {
|
|
53
|
+
const baseUrl = this.getBaseUrl(options);
|
|
54
|
+
const route = new URI(baseUrl).segment(this.SEARCH_URL).href();
|
|
55
|
+
const params = _.omit(options, ['version']);
|
|
56
|
+
|
|
57
|
+
return this.request({
|
|
58
|
+
method: 'POST',
|
|
59
|
+
route,
|
|
60
|
+
params,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static async searchSessionsWithContacts(
|
|
65
|
+
options: SearchSessionsWithContactsOptions = {}
|
|
66
|
+
): Promise<SearchSessionsWithContactsResponse> {
|
|
67
|
+
const baseUrl = this.getBaseUrl(options);
|
|
68
|
+
const route = new URI(baseUrl)
|
|
69
|
+
.segment(this.SEARCH_WITH_CONTACTS_URL)
|
|
70
|
+
.href();
|
|
71
|
+
|
|
72
|
+
const params = _.omit(options, ['version']);
|
|
73
|
+
return this.request({
|
|
74
|
+
method: 'POST',
|
|
75
|
+
route,
|
|
76
|
+
params,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static async getQueueSession(
|
|
81
|
+
options: GetQueueSessionOptions
|
|
82
|
+
): Promise<GetQueueSessionResponse> {
|
|
83
|
+
const baseUrl = this.getBaseUrl(options);
|
|
84
|
+
const route = new URI(baseUrl).segment(this.GET_QUEUE_SESSION_URL).href();
|
|
85
|
+
const params = _.pick(options, ['agentId', 'ruleTags']);
|
|
86
|
+
|
|
87
|
+
return this.request({
|
|
88
|
+
method: 'GET',
|
|
89
|
+
route,
|
|
90
|
+
params,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
10
93
|
|
|
11
94
|
public static async getSessionInitTriggers(
|
|
12
|
-
options:
|
|
95
|
+
options: GetInitTriggersOptions = {}
|
|
13
96
|
): Promise<GetInitTriggersResponse> {
|
|
14
97
|
const baseUrl = this.getBaseUrl(options);
|
|
15
|
-
const route = new URI(baseUrl).segment(this.
|
|
98
|
+
const route = new URI(baseUrl).segment(this.GET_TRIGGERS_URL).href();
|
|
99
|
+
|
|
100
|
+
return this.request({
|
|
101
|
+
method: 'GET',
|
|
102
|
+
route,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public static async claimSessionByAgent(
|
|
107
|
+
options: ClaimSessionByAgentOptions
|
|
108
|
+
): Promise<Session> {
|
|
109
|
+
const baseUrl = this.getBaseUrl(options);
|
|
110
|
+
const route = new URI(baseUrl)
|
|
111
|
+
.segment(options.sessionId)
|
|
112
|
+
.segment(this.CLAIM_URL)
|
|
113
|
+
.href();
|
|
114
|
+
|
|
115
|
+
const params = _.pick(options, ['claimBy']);
|
|
116
|
+
const data = _.pick(options, ['params']);
|
|
117
|
+
|
|
118
|
+
return this.request({
|
|
119
|
+
method: 'POST',
|
|
120
|
+
route,
|
|
121
|
+
params,
|
|
122
|
+
data,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public static async transferToBot(
|
|
127
|
+
options: TransferToBotOptions
|
|
128
|
+
): Promise<Session> {
|
|
129
|
+
const baseUrl = this.getBaseUrl(options);
|
|
130
|
+
const route = new URI(baseUrl)
|
|
131
|
+
.segment(options.sessionId)
|
|
132
|
+
.segment(this.TRANSFER_TO_BOT_URL)
|
|
133
|
+
.href();
|
|
134
|
+
|
|
135
|
+
const params = _.pick(options, ['agentId']);
|
|
136
|
+
const data = _.pick(options, ['params']);
|
|
137
|
+
|
|
138
|
+
return this.request({
|
|
139
|
+
method: 'POST',
|
|
140
|
+
route,
|
|
141
|
+
params,
|
|
142
|
+
data,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public static async startConversation(
|
|
147
|
+
options: StartConversationOptions
|
|
148
|
+
): Promise<Session> {
|
|
149
|
+
const baseUrl = this.getBaseUrl(options);
|
|
150
|
+
const route = new URI(baseUrl).segment(this.TRANSFER_TO_BOT_URL).href();
|
|
151
|
+
|
|
152
|
+
const params = _.pick(options, ['contactId', 'triggerId']);
|
|
153
|
+
const data = _.pick(options, ['params']);
|
|
154
|
+
|
|
155
|
+
return this.request({
|
|
156
|
+
method: 'POST',
|
|
157
|
+
route,
|
|
158
|
+
params,
|
|
159
|
+
data,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public static async updateSession(
|
|
164
|
+
options: UpdateSessionOptions
|
|
165
|
+
): Promise<Session> {
|
|
166
|
+
const baseUrl = this.getBaseUrl(options);
|
|
167
|
+
const route = new URI(baseUrl).segment(options.sessionId).href();
|
|
16
168
|
|
|
169
|
+
const data = _.pick(options, ['tags']);
|
|
17
170
|
return this.request({
|
|
171
|
+
method: 'PUT',
|
|
18
172
|
route,
|
|
173
|
+
data,
|
|
19
174
|
});
|
|
20
175
|
}
|
|
21
176
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
177
|
+
public static async closeSession(
|
|
178
|
+
options: CloseSessionOptions
|
|
179
|
+
): Promise<Session> {
|
|
180
|
+
const baseUrl = this.getBaseUrl(options);
|
|
181
|
+
const route = new URI(baseUrl)
|
|
182
|
+
.segment(options.sessionId)
|
|
183
|
+
.segment(this.CLOSE_URL)
|
|
184
|
+
.href();
|
|
185
|
+
|
|
186
|
+
return this.request({
|
|
187
|
+
method: 'POST',
|
|
188
|
+
route,
|
|
26
189
|
});
|
|
27
190
|
}
|
|
28
191
|
}
|
package/src/api/Settings.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
|
|
3
|
-
import { ApiVersionOptions } from '../types';
|
|
4
3
|
import {
|
|
5
4
|
GetSettingsOptions,
|
|
6
5
|
GetSettingsResponse,
|
|
@@ -38,11 +37,4 @@ export class Settings extends HITLBase {
|
|
|
38
37
|
data,
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
protected static getBaseUrl(options: ApiVersionOptions): string {
|
|
43
|
-
return HITLBase.getBaseUrl({
|
|
44
|
-
...options,
|
|
45
|
-
module: this.MODULE_URL,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
40
|
}
|
package/src/types/common.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Token, CalApiParams } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AGENT_STATUS,
|
|
4
|
+
APP_ERROR_TYPE,
|
|
5
|
+
BROADCAST_EVENTS,
|
|
6
|
+
CALL_MEMBER_STATUS,
|
|
7
|
+
CALL_MEMBER_TYPE,
|
|
8
|
+
SESSION_STATUS,
|
|
9
|
+
} from '@onereach/types-hitl-api';
|
|
3
10
|
|
|
4
11
|
export type HITLConfig = {
|
|
5
12
|
readonly token: Token;
|
|
@@ -16,7 +23,7 @@ export interface ApiVersionOptions {
|
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
export interface BaseUrlOptions extends ApiVersionOptions {
|
|
19
|
-
readonly module
|
|
26
|
+
readonly module?: string;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
export interface IAppError {
|
|
@@ -28,4 +35,11 @@ export interface IAppError {
|
|
|
28
35
|
readonly timestamp: number;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
export {
|
|
38
|
+
export {
|
|
39
|
+
AGENT_STATUS,
|
|
40
|
+
APP_ERROR_TYPE,
|
|
41
|
+
BROADCAST_EVENTS,
|
|
42
|
+
CALL_MEMBER_STATUS,
|
|
43
|
+
CALL_MEMBER_TYPE,
|
|
44
|
+
SESSION_STATUS,
|
|
45
|
+
};
|
package/src/types/read-events.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { ApiVersionOptions, NoAccountId } from './common';
|
|
|
5
5
|
export type ReadEvent = ReadEvents.IReadEvent;
|
|
6
6
|
|
|
7
7
|
export type GetNewEventsCountOptions = ApiVersionOptions
|
|
8
|
-
& NoAccountId<ReadEvents.
|
|
9
|
-
& ReadEvents.
|
|
8
|
+
& NoAccountId<ReadEvents.IGetNewEventsCountQuery>
|
|
9
|
+
& ReadEvents.IGetNewEventsCountBody;
|
|
10
10
|
export type GetNewEventsCountResponse
|
|
11
|
-
= ReadEvents.
|
|
11
|
+
= ReadEvents.IGetNewEventsCountResponse;
|
|
12
12
|
|
|
13
13
|
export type SaveLastReadEventOptions = ApiVersionOptions
|
|
14
14
|
& NoAccountId<ReadEvents.ISaveLastReadEventQuery>
|
|
@@ -3,8 +3,13 @@ import { ApiVersionOptions, NoAccountId } from './common';
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/indent */
|
|
5
5
|
export type SessionEvent = SessionEvents.ISessionEvent;
|
|
6
|
+
|
|
6
7
|
export type GetSessionEventsOptions = ApiVersionOptions
|
|
7
8
|
& NoAccountId<SessionEvents.IGetSessionEventsQuery>;
|
|
8
9
|
export type GetSessionEventsResponse
|
|
9
10
|
= SessionEvents.IGetSessionEventsResponse;
|
|
10
11
|
|
|
12
|
+
export type AddEventsOptions = ApiVersionOptions
|
|
13
|
+
& NoAccountId<SessionEvents.IAddEventsBySessionIdQuery>
|
|
14
|
+
& SessionEvents.IAddEventsBySessionIdBody;
|
|
15
|
+
export type AddEventsResponse = SessionEvents.IAddEventsBySessionIdResponse;
|
package/src/types/sessions.ts
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
|
-
import { Sessions } from '@onereach/types-hitl-api';
|
|
2
|
-
import { ApiVersionOptions } from './common';
|
|
1
|
+
import { ISessionId, Sessions } from '@onereach/types-hitl-api';
|
|
2
|
+
import { ApiVersionOptions, NoAccountId } from './common';
|
|
3
3
|
|
|
4
|
+
export type Session = Sessions.ISession;
|
|
5
|
+
export type TransferToBot = Sessions.ITransferToBot;
|
|
6
|
+
export type Command = Sessions.ICommand;
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
9
|
+
export type GetSessionsOptions = ApiVersionOptions
|
|
10
|
+
& NoAccountId<Sessions.IGetSessionsQuery>;
|
|
11
|
+
export type GetSessionsResponse = Session | Sessions.IGetSessionsResponse;
|
|
12
|
+
|
|
13
|
+
export type SearchSessionsOptions = ApiVersionOptions
|
|
14
|
+
& NoAccountId<Sessions.ISearchSessionsQuery>;
|
|
15
|
+
export type SearchSessionsResponse = Sessions.IGetSessionsResponse;
|
|
16
|
+
|
|
17
|
+
export type SearchSessionsWithContactsOptions = ApiVersionOptions
|
|
18
|
+
& NoAccountId<Sessions.ISearchSessionsWithContactsQuery>;
|
|
19
|
+
export type SearchSessionsWithContactsResponse
|
|
20
|
+
= Sessions.ISearchSessionsWithContactsResponse;
|
|
21
|
+
|
|
22
|
+
export type GetQueueSessionOptions = ApiVersionOptions
|
|
23
|
+
& NoAccountId<Sessions.IGetQueueSessionQuery>;
|
|
24
|
+
export type GetQueueSessionResponse = Sessions.IGetQueueSessionResponse;
|
|
25
|
+
|
|
26
|
+
export type ClaimSessionByAgentOptions = ApiVersionOptions
|
|
27
|
+
& ISessionId
|
|
28
|
+
& NoAccountId<Sessions.IClaimSessionQuery>
|
|
29
|
+
& Sessions.IClaimSessionBody;
|
|
30
|
+
|
|
31
|
+
export type TransferToBotOptions = ApiVersionOptions
|
|
32
|
+
& ISessionId
|
|
33
|
+
& NoAccountId<Sessions.ITransferToBotQuery>
|
|
34
|
+
& Sessions.ITransferToBotBody;
|
|
35
|
+
|
|
36
|
+
export type StartConversationOptions = ApiVersionOptions
|
|
37
|
+
& Sessions.IInitConversationQuery
|
|
38
|
+
& Sessions.IInitConversationBody;
|
|
39
|
+
|
|
40
|
+
export type UpdateSessionOptions = ApiVersionOptions
|
|
41
|
+
& ISessionId
|
|
42
|
+
& Sessions.IUpdateSessionBody;
|
|
43
|
+
|
|
44
|
+
export type CloseSessionOptions = ApiVersionOptions & ISessionId;
|
|
45
|
+
|
|
46
|
+
export type GetInitTriggersOptions = ApiVersionOptions;
|
|
4
47
|
export type GetInitTriggersResponse = Sessions.IGetInitTriggersResponse;
|
|
5
|
-
export type InitTriggersOptions = ApiVersionOptions;
|