@webitel/api-services 26.8.6 → 26.8.7
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/package.json +1 -1
- package/src/api/clients/agents/agents.ts +5 -0
- package/src/api/clients/cognitiveProfiles/cognitiveProfiles.ts +5 -0
- package/src/api/clients/devices/devices.ts +227 -0
- package/src/api/clients/importTemplates/importTemplates.ts +5 -0
- package/src/api/clients/index.ts +1 -0
- package/src/api/clients/lists/blacklists.ts +5 -0
- package/src/api/clients/outboundResourceGroups/outboundResourceGroups.ts +5 -0
- package/src/api/clients/outboundResources/outboundResources.ts +5 -0
- package/src/api/clients/teams/teams.ts +5 -0
- package/types/.tsbuildinfo +1 -1
- package/types/api/clients/agents/agents.d.ts +7 -0
- package/types/api/clients/cognitiveProfiles/cognitiveProfiles.d.ts +7 -0
- package/types/api/clients/devices/devices.d.ts +31 -0
- package/types/api/clients/importTemplates/importTemplates.d.ts +7 -0
- package/types/api/clients/index.d.ts +1 -0
- package/types/api/clients/lists/blacklists.d.ts +7 -0
- package/types/api/clients/outboundResourceGroups/outboundResourceGroups.d.ts +7 -0
- package/types/api/clients/outboundResources/outboundResources.d.ts +7 -0
- package/types/api/clients/teams/teams.d.ts +7 -0
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
snakeToCamel,
|
|
16
16
|
starToSearch,
|
|
17
17
|
} from '../../transformers';
|
|
18
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
18
19
|
import type {
|
|
19
20
|
AddItemParams,
|
|
20
21
|
ApiId,
|
|
@@ -25,6 +26,8 @@ import type {
|
|
|
25
26
|
UpdateItemParams,
|
|
26
27
|
} from '../_shared/types';
|
|
27
28
|
|
|
29
|
+
const baseUrl = '/call_center/agents';
|
|
30
|
+
|
|
28
31
|
const convertStatusDuration = (value: number) => {
|
|
29
32
|
if (value > 60 * 60 * 24) return '>24:00:00';
|
|
30
33
|
return convertDuration(value);
|
|
@@ -516,4 +519,6 @@ export const AgentsAPI = {
|
|
|
516
519
|
getAgentQueues,
|
|
517
520
|
getStatusStatistics: getAgentStatusStatistics,
|
|
518
521
|
getStatusStatisticsItem: getAgentStatusStatisticsItem,
|
|
522
|
+
|
|
523
|
+
...generatePermissionsApi(baseUrl),
|
|
519
524
|
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
snakeToCamel,
|
|
11
11
|
starToSearch,
|
|
12
12
|
} from '../../transformers';
|
|
13
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
13
14
|
import type {
|
|
14
15
|
AddItemParams,
|
|
15
16
|
ApiParams,
|
|
@@ -19,6 +20,8 @@ import type {
|
|
|
19
20
|
UpdateItemParams,
|
|
20
21
|
} from '../_shared/types';
|
|
21
22
|
|
|
23
|
+
const baseUrl = '/storage/cognitive_profiles';
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* `service` and `properties.region` are returned as the raw backend values.
|
|
24
27
|
* Mapping them onto the localized service lookup and the Microsoft region
|
|
@@ -206,4 +209,6 @@ export const CognitiveProfilesAPI = {
|
|
|
206
209
|
update: updateCognitiveProfile,
|
|
207
210
|
delete: deleteCognitiveProfile,
|
|
208
211
|
getLookup: getCognitiveProfilesLookup,
|
|
212
|
+
|
|
213
|
+
...generatePermissionsApi(baseUrl),
|
|
209
214
|
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import deepCopy from 'deep-copy';
|
|
2
|
+
|
|
3
|
+
import { getDevices } from '../../../gen-wire';
|
|
4
|
+
import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
|
|
5
|
+
import {
|
|
6
|
+
applyTransform,
|
|
7
|
+
camelToSnake,
|
|
8
|
+
merge,
|
|
9
|
+
mergeEach,
|
|
10
|
+
notify,
|
|
11
|
+
sanitize,
|
|
12
|
+
snakeToCamel,
|
|
13
|
+
starToSearch,
|
|
14
|
+
} from '../../transformers';
|
|
15
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
16
|
+
import type {
|
|
17
|
+
AddItemParams,
|
|
18
|
+
ApiParams,
|
|
19
|
+
DeleteItemParams,
|
|
20
|
+
GetItemParams,
|
|
21
|
+
UpdateItemParams,
|
|
22
|
+
} from '../_shared/types';
|
|
23
|
+
|
|
24
|
+
const baseUrl = '/devices';
|
|
25
|
+
|
|
26
|
+
const fieldsToSend = [
|
|
27
|
+
'name',
|
|
28
|
+
'account',
|
|
29
|
+
'password',
|
|
30
|
+
'user',
|
|
31
|
+
'mac',
|
|
32
|
+
'ip',
|
|
33
|
+
'brand',
|
|
34
|
+
'model',
|
|
35
|
+
'phone',
|
|
36
|
+
'hotdesks',
|
|
37
|
+
'hotdesk',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const getDevicesList = async (params: ApiParams) => {
|
|
41
|
+
const listFieldsToSend = [
|
|
42
|
+
'page',
|
|
43
|
+
'size',
|
|
44
|
+
'q',
|
|
45
|
+
'sort',
|
|
46
|
+
'fields',
|
|
47
|
+
'id',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const defaultObject = {
|
|
51
|
+
state: 0,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const requestParams = applyTransform(params, [
|
|
55
|
+
merge(getDefaultGetParams()),
|
|
56
|
+
starToSearch('search'),
|
|
57
|
+
(params) => ({
|
|
58
|
+
...params,
|
|
59
|
+
q: params.search,
|
|
60
|
+
}),
|
|
61
|
+
sanitize(listFieldsToSend),
|
|
62
|
+
camelToSnake(),
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const response = await getDevices().searchDevice(requestParams);
|
|
67
|
+
const { items, next } = applyTransform(response.data, [
|
|
68
|
+
snakeToCamel(),
|
|
69
|
+
merge(getDefaultGetListResponse()),
|
|
70
|
+
]);
|
|
71
|
+
return {
|
|
72
|
+
items: applyTransform(items, [
|
|
73
|
+
mergeEach(defaultObject),
|
|
74
|
+
]),
|
|
75
|
+
next,
|
|
76
|
+
};
|
|
77
|
+
} catch (err) {
|
|
78
|
+
throw applyTransform(err, [
|
|
79
|
+
notify,
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const getDevice = async ({ itemId: id }: GetItemParams) => {
|
|
85
|
+
const defaultObject = {
|
|
86
|
+
state: 0,
|
|
87
|
+
hotdesks: [],
|
|
88
|
+
hotdesk: false,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const response = await getDevices().readDevice(String(id));
|
|
93
|
+
return applyTransform(response.data, [
|
|
94
|
+
snakeToCamel(),
|
|
95
|
+
merge(defaultObject),
|
|
96
|
+
]);
|
|
97
|
+
} catch (err) {
|
|
98
|
+
throw applyTransform(err, [
|
|
99
|
+
notify,
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** An empty password means "keep the current one", so it must not be sent. */
|
|
105
|
+
const preRequestHandler = (item: ApiParams) => {
|
|
106
|
+
const copy = deepCopy(item);
|
|
107
|
+
if (!copy.password) copy.password = undefined;
|
|
108
|
+
return copy;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const addDevice = async ({ itemInstance }: AddItemParams) => {
|
|
112
|
+
const item = applyTransform(itemInstance, [
|
|
113
|
+
preRequestHandler,
|
|
114
|
+
sanitize(fieldsToSend),
|
|
115
|
+
camelToSnake(),
|
|
116
|
+
]);
|
|
117
|
+
try {
|
|
118
|
+
const response = await getDevices().createDevice(item);
|
|
119
|
+
return applyTransform(response.data, [
|
|
120
|
+
snakeToCamel(),
|
|
121
|
+
]);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
throw applyTransform(err, [
|
|
124
|
+
notify,
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const updateDevice = async ({ itemInstance, itemId: id }: UpdateItemParams) => {
|
|
130
|
+
const item = applyTransform(itemInstance, [
|
|
131
|
+
preRequestHandler,
|
|
132
|
+
sanitize(fieldsToSend),
|
|
133
|
+
camelToSnake(),
|
|
134
|
+
]);
|
|
135
|
+
try {
|
|
136
|
+
const response = await getDevices().updateDevice(String(id), item);
|
|
137
|
+
return applyTransform(response.data, [
|
|
138
|
+
snakeToCamel(),
|
|
139
|
+
]);
|
|
140
|
+
} catch (err) {
|
|
141
|
+
throw applyTransform(err, [
|
|
142
|
+
notify,
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const deleteDevice = async ({ id }: DeleteItemParams) => {
|
|
148
|
+
try {
|
|
149
|
+
const response = await getDevices().deleteDevice(String(id));
|
|
150
|
+
return applyTransform(response.data, []);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
throw applyTransform(err, [
|
|
153
|
+
notify,
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const getDevicesLookup = (params: Parameters<typeof getDevicesList>[0]) =>
|
|
159
|
+
getDevicesList({
|
|
160
|
+
...params,
|
|
161
|
+
fields: params.fields || [
|
|
162
|
+
'id',
|
|
163
|
+
'name',
|
|
164
|
+
],
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const getDeviceHistory = async ({ parentId, from, to, ...rest }: ApiParams) => {
|
|
168
|
+
const historyFieldsToSend = [
|
|
169
|
+
'page',
|
|
170
|
+
'size',
|
|
171
|
+
'search',
|
|
172
|
+
'fields',
|
|
173
|
+
'id',
|
|
174
|
+
'timeFrom',
|
|
175
|
+
'timeTo',
|
|
176
|
+
];
|
|
177
|
+
|
|
178
|
+
const requestParams = applyTransform(
|
|
179
|
+
{
|
|
180
|
+
...rest,
|
|
181
|
+
timeFrom: from,
|
|
182
|
+
timeTo: to,
|
|
183
|
+
},
|
|
184
|
+
[
|
|
185
|
+
merge(getDefaultGetParams()),
|
|
186
|
+
starToSearch('search'),
|
|
187
|
+
(params) => ({
|
|
188
|
+
...params,
|
|
189
|
+
q: params.search,
|
|
190
|
+
}),
|
|
191
|
+
sanitize(historyFieldsToSend),
|
|
192
|
+
camelToSnake(),
|
|
193
|
+
],
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const response = await getDevices().searchDeviceAudit(
|
|
198
|
+
String(parentId),
|
|
199
|
+
requestParams,
|
|
200
|
+
);
|
|
201
|
+
const { items, next } = applyTransform(response.data, [
|
|
202
|
+
snakeToCamel(),
|
|
203
|
+
merge(getDefaultGetListResponse()),
|
|
204
|
+
]);
|
|
205
|
+
return {
|
|
206
|
+
items,
|
|
207
|
+
next,
|
|
208
|
+
};
|
|
209
|
+
} catch (err) {
|
|
210
|
+
throw applyTransform(err, [
|
|
211
|
+
notify,
|
|
212
|
+
]);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const DevicesAPI = {
|
|
217
|
+
getList: getDevicesList,
|
|
218
|
+
get: getDevice,
|
|
219
|
+
add: addDevice,
|
|
220
|
+
update: updateDevice,
|
|
221
|
+
delete: deleteDevice,
|
|
222
|
+
getLookup: getDevicesLookup,
|
|
223
|
+
|
|
224
|
+
getDeviceHistory,
|
|
225
|
+
|
|
226
|
+
...generatePermissionsApi(baseUrl),
|
|
227
|
+
};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
snakeToCamel,
|
|
10
10
|
starToSearch,
|
|
11
11
|
} from '../../transformers';
|
|
12
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
12
13
|
import type {
|
|
13
14
|
AddItemParams,
|
|
14
15
|
ApiParams,
|
|
@@ -18,6 +19,8 @@ import type {
|
|
|
18
19
|
UpdateItemParams,
|
|
19
20
|
} from '../_shared/types';
|
|
20
21
|
|
|
22
|
+
const baseUrl = '/storage/import_templates';
|
|
23
|
+
|
|
21
24
|
/**
|
|
22
25
|
* `mappings` keys are CSV column names — user data, not API fields — so the
|
|
23
26
|
* case transformers must leave them alone.
|
|
@@ -177,4 +180,6 @@ export const ImportTemplatesAPI = {
|
|
|
177
180
|
update: updateImportTemplate,
|
|
178
181
|
delete: deleteImportTemplate,
|
|
179
182
|
getLookup: getImportTemplatesLookup,
|
|
183
|
+
|
|
184
|
+
...generatePermissionsApi(baseUrl),
|
|
180
185
|
};
|
package/src/api/clients/index.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from './communications/communications';
|
|
|
36
36
|
export * from './configurations/configurations';
|
|
37
37
|
export * from './contactCases/contactCases';
|
|
38
38
|
export * from './contactGroups/contactGroups';
|
|
39
|
+
export * from './devices/devices';
|
|
39
40
|
export * from './dialplans/dialplans';
|
|
40
41
|
export * from './dynamicConditions/dynamicConditions';
|
|
41
42
|
export * from './dynamicGroups/dynamicGroups';
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
snakeToCamel,
|
|
11
11
|
starToSearch,
|
|
12
12
|
} from '../../transformers';
|
|
13
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
13
14
|
import type {
|
|
14
15
|
AddItemParams,
|
|
15
16
|
ApiParams,
|
|
@@ -18,6 +19,8 @@ import type {
|
|
|
18
19
|
UpdateItemParams,
|
|
19
20
|
} from '../_shared/types';
|
|
20
21
|
|
|
22
|
+
const baseUrl = '/call_center/list';
|
|
23
|
+
|
|
21
24
|
const getBlacklistList = async (params: ApiParams) => {
|
|
22
25
|
const defaultObject = {
|
|
23
26
|
name: '',
|
|
@@ -142,4 +145,6 @@ export const BlacklistsAPI = {
|
|
|
142
145
|
update: updateBlacklist,
|
|
143
146
|
delete: deleteBlacklist,
|
|
144
147
|
getLookup: getBlacklistsLookup,
|
|
148
|
+
|
|
149
|
+
...generatePermissionsApi(baseUrl),
|
|
145
150
|
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
snakeToCamel,
|
|
11
11
|
starToSearch,
|
|
12
12
|
} from '../../transformers';
|
|
13
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
13
14
|
import type {
|
|
14
15
|
AddItemParams,
|
|
15
16
|
ApiParams,
|
|
@@ -18,6 +19,8 @@ import type {
|
|
|
18
19
|
UpdateItemParams,
|
|
19
20
|
} from '../_shared/types';
|
|
20
21
|
|
|
22
|
+
const baseUrl = '/call_center/resource_group';
|
|
23
|
+
|
|
21
24
|
const fieldsToSend = [
|
|
22
25
|
'name',
|
|
23
26
|
'description',
|
|
@@ -184,4 +187,6 @@ export const OutboundResourceGroupsAPI = {
|
|
|
184
187
|
update: updateResourceGroup,
|
|
185
188
|
delete: deleteResourceGroup,
|
|
186
189
|
getLookup: getResourceGroupsLookup,
|
|
190
|
+
|
|
191
|
+
...generatePermissionsApi(baseUrl),
|
|
187
192
|
};
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
snakeToCamel,
|
|
12
12
|
starToSearch,
|
|
13
13
|
} from '../../transformers';
|
|
14
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
14
15
|
import type {
|
|
15
16
|
AddItemParams,
|
|
16
17
|
ApiParams,
|
|
@@ -20,6 +21,8 @@ import type {
|
|
|
20
21
|
UpdateItemParams,
|
|
21
22
|
} from '../_shared/types';
|
|
22
23
|
|
|
24
|
+
const baseUrl = '/call_center/resources';
|
|
25
|
+
|
|
23
26
|
const fieldsToSend = [
|
|
24
27
|
'limit',
|
|
25
28
|
'enabled',
|
|
@@ -222,4 +225,6 @@ export const OutboundResourcesAPI = {
|
|
|
222
225
|
update: updateResource,
|
|
223
226
|
delete: deleteResource,
|
|
224
227
|
getLookup: getResourcesLookup,
|
|
228
|
+
|
|
229
|
+
...generatePermissionsApi(baseUrl),
|
|
225
230
|
};
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
snakeToCamel,
|
|
10
10
|
starToSearch,
|
|
11
11
|
} from '../../transformers';
|
|
12
|
+
import { generatePermissionsApi } from '../_shared/generatePermissionsApi';
|
|
12
13
|
import type {
|
|
13
14
|
AddItemParams,
|
|
14
15
|
ApiParams,
|
|
@@ -17,6 +18,8 @@ import type {
|
|
|
17
18
|
UpdateItemParams,
|
|
18
19
|
} from '../_shared/types';
|
|
19
20
|
|
|
21
|
+
const baseUrl = '/call_center/teams';
|
|
22
|
+
|
|
20
23
|
const fieldsToSend = [
|
|
21
24
|
'name',
|
|
22
25
|
'description',
|
|
@@ -163,4 +166,6 @@ export const TeamsAPI = {
|
|
|
163
166
|
update: updateTeam,
|
|
164
167
|
delete: deleteTeam,
|
|
165
168
|
getLookup: getTeamsLookup,
|
|
169
|
+
|
|
170
|
+
...generatePermissionsApi(baseUrl),
|
|
166
171
|
};
|