@webitel/api-services 1.0.9 → 1.0.11

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.
Files changed (107) hide show
  1. package/package.json +1 -1
  2. package/src/api/clients/__tests__/wireParamsCoverage.spec.ts +286 -0
  3. package/src/api/clients/activeCalls/activeCalls.ts +72 -0
  4. package/src/api/clients/agentPauseCauses/agentPauseCauses.ts +182 -0
  5. package/src/api/clients/agentSkills/agentSkills.ts +193 -0
  6. package/src/api/clients/agents/__tests__/agents.wireParams.spec.ts +51 -0
  7. package/src/api/clients/agents/agents.ts +203 -18
  8. package/src/api/clients/auditForms/auditForms.ts +6 -2
  9. package/src/api/clients/auditForms/auditRates.ts +91 -0
  10. package/src/api/clients/backendProfiles/backendProfiles.ts +194 -0
  11. package/src/api/clients/buckets/buckets.ts +21 -25
  12. package/src/api/clients/callHistory/callAnnotations.ts +91 -0
  13. package/src/api/clients/callHistory/callHistory.ts +76 -7
  14. package/src/api/clients/casePriorities/__tests__/casePriorities.spec.ts +50 -0
  15. package/src/api/clients/casePriorities/casePriorities.ts +25 -41
  16. package/src/api/clients/caseStatusConditions/caseStatusConditions.ts +21 -31
  17. package/src/api/clients/caseStatuses/caseStatuses.ts +10 -21
  18. package/src/api/clients/cases/cases.ts +6 -3
  19. package/src/api/clients/catalog/catalog.ts +2 -8
  20. package/src/api/clients/changelogs/changelogs.ts +8 -0
  21. package/src/api/clients/chatplans/chatplans.ts +173 -0
  22. package/src/api/clients/cognitiveProfiles/cognitiveProfiles.ts +209 -0
  23. package/src/api/clients/communications/communications.ts +38 -42
  24. package/src/api/clients/dialplans/dialplans.ts +197 -0
  25. package/src/api/clients/emailProfiles/emailProfiles.ts +222 -0
  26. package/src/api/clients/fileServices/fileServices.ts +7 -2
  27. package/src/api/clients/flows/flow.ts +54 -43
  28. package/src/api/clients/fts/fts.ts +61 -0
  29. package/src/api/clients/history/transcript/callTranscript.ts +10 -20
  30. package/src/api/clients/importTemplates/importTemplates.ts +180 -0
  31. package/src/api/clients/index.ts +30 -0
  32. package/src/api/clients/lists/blacklistNumbers.ts +155 -0
  33. package/src/api/clients/lists/blacklists.ts +20 -25
  34. package/src/api/clients/logs/logs.ts +157 -0
  35. package/src/api/clients/media/media.ts +19 -15
  36. package/src/api/clients/object/object.ts +3 -14
  37. package/src/api/clients/outboundResourceGroups/outboundResourceGroups.ts +187 -0
  38. package/src/api/clients/outboundResourceGroups/resourcesInGroup.ts +169 -0
  39. package/src/api/clients/outboundResources/outboundResources.ts +225 -0
  40. package/src/api/clients/outboundResources/resourceDisplays.ts +165 -0
  41. package/src/api/clients/pauseTemplates/pauseTemplates.ts +203 -0
  42. package/src/api/clients/queues/__tests__/queueLogs.spec.ts +3 -3
  43. package/src/api/clients/queues/__tests__/queueMembers.spec.ts +4 -4
  44. package/src/api/clients/queues/queueLogs.ts +8 -3
  45. package/src/api/clients/queues/queueMembers.ts +3 -3
  46. package/src/api/clients/queues/queues.ts +52 -0
  47. package/src/api/clients/regions/regions.ts +21 -25
  48. package/src/api/clients/schemaVariables/schemaVariables.ts +167 -0
  49. package/src/api/clients/shiftTemplates/shiftTemplates.ts +176 -0
  50. package/src/api/clients/skills/skillAgents.ts +190 -0
  51. package/src/api/clients/skills/skills.ts +21 -25
  52. package/src/api/clients/storagePolicies/storagePolicies.ts +270 -0
  53. package/src/api/clients/teamHooks/teamHooks.ts +195 -0
  54. package/src/api/clients/teamTriggers/agentTriggers.ts +77 -0
  55. package/src/api/clients/teamTriggers/teamFlows.ts +194 -0
  56. package/src/api/clients/teams/teams.ts +31 -31
  57. package/src/api/clients/triggers/triggerJobs.ts +63 -0
  58. package/src/api/clients/triggers/triggers.ts +266 -0
  59. package/src/api/clients/userSettings/userSettings.ts +8 -9
  60. package/src/api/clients/users/users.ts +2 -0
  61. package/src/api/clients/workingConditions/workingConditions.ts +184 -0
  62. package/src/api/clients/workspaceWidgets/workspaceWidgets.ts +73 -0
  63. package/src/api/clients/wtTypes/adjunctTypeRecords/adjunctTypeRecords.ts +3 -3
  64. package/src/api/clients/wtTypes/adjunctTypes/adjunctTypes.ts +1 -1
  65. package/src/api/clients//321/201ontacts/contactChatMessagesHistory.ts +15 -26
  66. package/types/.tsbuildinfo +1 -1
  67. package/types/api/clients/activeCalls/activeCalls.d.ts +7 -0
  68. package/types/api/clients/agentPauseCauses/agentPauseCauses.d.ts +21 -0
  69. package/types/api/clients/agentSkills/agentSkills.d.ts +12 -0
  70. package/types/api/clients/agents/agents.d.ts +23 -2
  71. package/types/api/clients/auditForms/auditForms.d.ts +7 -0
  72. package/types/api/clients/auditForms/auditRates.d.ts +10 -0
  73. package/types/api/clients/backendProfiles/backendProfiles.d.ts +21 -0
  74. package/types/api/clients/callHistory/callAnnotations.d.ts +12 -0
  75. package/types/api/clients/callHistory/callHistory.d.ts +24 -3
  76. package/types/api/clients/caseStatusConditions/caseStatusConditions.d.ts +4 -4
  77. package/types/api/clients/cases/cases.d.ts +5 -2
  78. package/types/api/clients/chatplans/chatplans.d.ts +21 -0
  79. package/types/api/clients/cognitiveProfiles/cognitiveProfiles.d.ts +21 -0
  80. package/types/api/clients/dialplans/dialplans.d.ts +16 -0
  81. package/types/api/clients/emailProfiles/emailProfiles.d.ts +27 -0
  82. package/types/api/clients/fileServices/fileServices.d.ts +1 -1
  83. package/types/api/clients/fts/fts.d.ts +7 -0
  84. package/types/api/clients/importTemplates/importTemplates.d.ts +21 -0
  85. package/types/api/clients/index.d.ts +30 -0
  86. package/types/api/clients/lists/blacklistNumbers.d.ts +11 -0
  87. package/types/api/clients/logs/logs.d.ts +15 -0
  88. package/types/api/clients/outboundResourceGroups/outboundResourceGroups.d.ts +20 -0
  89. package/types/api/clients/outboundResourceGroups/resourcesInGroup.d.ts +11 -0
  90. package/types/api/clients/outboundResources/outboundResources.d.ts +21 -0
  91. package/types/api/clients/outboundResources/resourceDisplays.d.ts +11 -0
  92. package/types/api/clients/pauseTemplates/pauseTemplates.d.ts +20 -0
  93. package/types/api/clients/queues/queues.d.ts +5 -0
  94. package/types/api/clients/schemaVariables/schemaVariables.d.ts +21 -0
  95. package/types/api/clients/shiftTemplates/shiftTemplates.d.ts +20 -0
  96. package/types/api/clients/skills/skillAgents.d.ts +13 -0
  97. package/types/api/clients/storagePolicies/storagePolicies.d.ts +26 -0
  98. package/types/api/clients/teamHooks/teamHooks.d.ts +12 -0
  99. package/types/api/clients/teamTriggers/agentTriggers.d.ts +23 -0
  100. package/types/api/clients/teamTriggers/teamFlows.d.ts +12 -0
  101. package/types/api/clients/triggers/triggerJobs.d.ts +7 -0
  102. package/types/api/clients/triggers/triggers.d.ts +22 -0
  103. package/types/api/clients/userSettings/userSettings.d.ts +2 -2
  104. package/types/api/clients/workingConditions/workingConditions.d.ts +20 -0
  105. package/types/api/clients/workspaceWidgets/workspaceWidgets.d.ts +3 -0
  106. package/types/api/clients/wtTypes/adjunctTypeRecords/adjunctTypeRecords.d.ts +2 -2
  107. package/types/api/clients/wtTypes/adjunctTypes/adjunctTypes.d.ts +2 -2
@@ -0,0 +1,225 @@
1
+ import deepCopy from 'deep-copy';
2
+ import { getOutboundResourceService } from '../../../gen-wire';
3
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
4
+ import {
5
+ applyTransform,
6
+ camelToSnake,
7
+ merge,
8
+ mergeEach,
9
+ notify,
10
+ sanitize,
11
+ snakeToCamel,
12
+ starToSearch,
13
+ } from '../../transformers';
14
+ import type {
15
+ AddItemParams,
16
+ ApiParams,
17
+ DeleteItemParams,
18
+ GetItemParams,
19
+ PatchItemParams,
20
+ UpdateItemParams,
21
+ } from '../_shared/types';
22
+
23
+ const fieldsToSend = [
24
+ 'limit',
25
+ 'enabled',
26
+ 'rps',
27
+ 'maxSuccessivelyErrors',
28
+ 'name',
29
+ 'errorIds',
30
+ 'display',
31
+ 'description',
32
+ 'resourceId',
33
+ 'gateway',
34
+ 'patterns',
35
+ 'failureDialDelay',
36
+ 'parameters',
37
+ ];
38
+
39
+ /*
40
+ * The form binds `maxErrors` / `cps`, the API expects
41
+ * `maxSuccessivelyErrors` / `rps`. `getResource` maps them back.
42
+ */
43
+ const preRequestHandler = (item: ApiParams) => {
44
+ const copy = deepCopy(item);
45
+ copy.maxSuccessivelyErrors = copy.maxErrors;
46
+ copy.rps = copy.cps;
47
+ return copy;
48
+ };
49
+
50
+ const getResourcesList = async (params: ApiParams) => {
51
+ const defaultObject = {
52
+ gateway: null,
53
+ enabled: false,
54
+ };
55
+
56
+ const { page, size, search, sort, fields, id } = applyTransform(params, [
57
+ merge(getDefaultGetParams()),
58
+ starToSearch('search'),
59
+ ]);
60
+
61
+ try {
62
+ const response = await getOutboundResourceService().searchOutboundResource({
63
+ page,
64
+ size,
65
+ // the generated param is `q`; `search` is what the datalist store sends
66
+ q: search,
67
+ sort,
68
+ fields,
69
+ id,
70
+ });
71
+ const { items, next } = applyTransform(response.data, [
72
+ snakeToCamel(),
73
+ merge(getDefaultGetListResponse()),
74
+ ]);
75
+ return {
76
+ items: applyTransform(items, [
77
+ mergeEach(defaultObject),
78
+ ]),
79
+ next,
80
+ };
81
+ } catch (err) {
82
+ throw applyTransform(err, [
83
+ notify,
84
+ ]);
85
+ }
86
+ };
87
+
88
+ const getResource = async ({ itemId: id }: GetItemParams) => {
89
+ const defaultObject = {
90
+ name: '',
91
+ gateway: {},
92
+ rps: 0,
93
+ limit: 0,
94
+ description: '',
95
+ maxSuccessivelyErrors: 0,
96
+ errorIds: [],
97
+ patterns: [],
98
+ failureDialDelay: 0,
99
+ parameters: {
100
+ cidType: '',
101
+ ignoreEarlyMedia: '',
102
+ },
103
+ };
104
+
105
+ const responseHandler = (response: ApiParams) => {
106
+ const copy = deepCopy(response);
107
+ copy.maxErrors = copy.maxSuccessivelyErrors;
108
+ copy.cps = copy.rps;
109
+ copy.parameters = {
110
+ ...defaultObject.parameters,
111
+ ...copy.parameters,
112
+ };
113
+ return copy;
114
+ };
115
+
116
+ try {
117
+ const response = await getOutboundResourceService().readOutboundResource(
118
+ String(id),
119
+ );
120
+ return applyTransform(response.data, [
121
+ snakeToCamel(),
122
+ merge(defaultObject),
123
+ responseHandler,
124
+ ]);
125
+ } catch (err) {
126
+ throw applyTransform(err, [
127
+ notify,
128
+ ]);
129
+ }
130
+ };
131
+
132
+ const addResource = async ({ itemInstance }: AddItemParams) => {
133
+ const item = applyTransform(itemInstance, [
134
+ preRequestHandler,
135
+ sanitize(fieldsToSend),
136
+ camelToSnake(),
137
+ ]);
138
+ try {
139
+ const response =
140
+ await getOutboundResourceService().createOutboundResource(item);
141
+ return applyTransform(response.data, [
142
+ snakeToCamel(),
143
+ ]);
144
+ } catch (err) {
145
+ throw applyTransform(err, [
146
+ notify,
147
+ ]);
148
+ }
149
+ };
150
+
151
+ const updateResource = async ({
152
+ itemInstance,
153
+ itemId: id,
154
+ }: UpdateItemParams) => {
155
+ const item = applyTransform(itemInstance, [
156
+ preRequestHandler,
157
+ sanitize(fieldsToSend),
158
+ camelToSnake(),
159
+ ]);
160
+ try {
161
+ const response = await getOutboundResourceService().updateOutboundResource(
162
+ String(id),
163
+ item,
164
+ );
165
+ return applyTransform(response.data, [
166
+ snakeToCamel(),
167
+ ]);
168
+ } catch (err) {
169
+ throw applyTransform(err, [
170
+ notify,
171
+ ]);
172
+ }
173
+ };
174
+
175
+ const patchResource = async ({ changes, id }: PatchItemParams) => {
176
+ const body = applyTransform(changes, [
177
+ sanitize(fieldsToSend),
178
+ camelToSnake(),
179
+ ]);
180
+ try {
181
+ const response = await getOutboundResourceService().patchOutboundResource(
182
+ String(id),
183
+ body,
184
+ );
185
+ return applyTransform(response.data, [
186
+ snakeToCamel(),
187
+ ]);
188
+ } catch (err) {
189
+ throw applyTransform(err, [
190
+ notify,
191
+ ]);
192
+ }
193
+ };
194
+
195
+ const deleteResource = async ({ id }: DeleteItemParams) => {
196
+ try {
197
+ const response = await getOutboundResourceService().deleteOutboundResource(
198
+ String(id),
199
+ );
200
+ return applyTransform(response.data, []);
201
+ } catch (err) {
202
+ throw applyTransform(err, [
203
+ notify,
204
+ ]);
205
+ }
206
+ };
207
+
208
+ const getResourcesLookup = (params: Parameters<typeof getResourcesList>[0]) =>
209
+ getResourcesList({
210
+ ...params,
211
+ fields: params.fields || [
212
+ 'id',
213
+ 'name',
214
+ ],
215
+ });
216
+
217
+ export const OutboundResourcesAPI = {
218
+ getList: getResourcesList,
219
+ get: getResource,
220
+ add: addResource,
221
+ patch: patchResource,
222
+ update: updateResource,
223
+ delete: deleteResource,
224
+ getLookup: getResourcesLookup,
225
+ };
@@ -0,0 +1,165 @@
1
+ import { getOutboundResourceService } from '../../../gen-wire';
2
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
3
+ import {
4
+ applyTransform,
5
+ camelToSnake,
6
+ merge,
7
+ notify,
8
+ sanitize,
9
+ snakeToCamel,
10
+ starToSearch,
11
+ } from '../../transformers';
12
+ import type {
13
+ ApiId,
14
+ ApiParams,
15
+ NestedAddItemParams,
16
+ NestedDeleteItemParams,
17
+ NestedGetItemParams,
18
+ NestedUpdateItemParams,
19
+ } from '../_shared/types';
20
+
21
+ const fieldsToSend = [
22
+ 'display',
23
+ 'resourceId',
24
+ ];
25
+
26
+ const preRequestHandler = (parentId: ApiId) => (item: ApiParams) => ({
27
+ ...item,
28
+ resourceId: parentId,
29
+ });
30
+
31
+ const getResourceDisplaysList = async (params: ApiParams) => {
32
+ const { page, size, search, sort, fields, id, parentId } = applyTransform(
33
+ params,
34
+ [
35
+ merge(getDefaultGetParams()),
36
+ starToSearch('search'),
37
+ ],
38
+ );
39
+
40
+ try {
41
+ const response =
42
+ await getOutboundResourceService().searchOutboundResourceDisplay(
43
+ String(parentId),
44
+ {
45
+ page,
46
+ size,
47
+ // the generated param is `q`; `search` is what the datalist store sends
48
+ q: search,
49
+ sort,
50
+ fields,
51
+ id,
52
+ },
53
+ );
54
+ const { items, next } = applyTransform(response.data, [
55
+ snakeToCamel(),
56
+ merge(getDefaultGetListResponse()),
57
+ ]);
58
+ return {
59
+ items,
60
+ next,
61
+ };
62
+ } catch (err) {
63
+ throw applyTransform(err, [
64
+ notify,
65
+ ]);
66
+ }
67
+ };
68
+
69
+ const getResourceDisplay = async ({
70
+ parentId,
71
+ itemId: id,
72
+ }: NestedGetItemParams) => {
73
+ try {
74
+ const response =
75
+ await getOutboundResourceService().readOutboundResourceDisplay(
76
+ String(parentId),
77
+ String(id),
78
+ );
79
+ return applyTransform(response.data, [
80
+ snakeToCamel(),
81
+ ]);
82
+ } catch (err) {
83
+ throw applyTransform(err, [
84
+ notify,
85
+ ]);
86
+ }
87
+ };
88
+
89
+ const addResourceDisplay = async ({
90
+ parentId,
91
+ itemInstance,
92
+ }: NestedAddItemParams) => {
93
+ const item = applyTransform(itemInstance, [
94
+ preRequestHandler(parentId),
95
+ sanitize(fieldsToSend),
96
+ camelToSnake(),
97
+ ]);
98
+ try {
99
+ const response =
100
+ await getOutboundResourceService().createOutboundResourceDisplay(
101
+ String(parentId),
102
+ item,
103
+ );
104
+ return applyTransform(response.data, [
105
+ snakeToCamel(),
106
+ ]);
107
+ } catch (err) {
108
+ throw applyTransform(err, [
109
+ notify,
110
+ ]);
111
+ }
112
+ };
113
+
114
+ const updateResourceDisplay = async ({
115
+ parentId,
116
+ itemInstance,
117
+ itemId: id,
118
+ }: NestedUpdateItemParams) => {
119
+ const item = applyTransform(itemInstance, [
120
+ preRequestHandler(parentId),
121
+ sanitize(fieldsToSend),
122
+ camelToSnake(),
123
+ ]);
124
+ try {
125
+ const response =
126
+ await getOutboundResourceService().updateOutboundResourceDisplay(
127
+ String(parentId),
128
+ String(id),
129
+ item,
130
+ );
131
+ return applyTransform(response.data, [
132
+ snakeToCamel(),
133
+ ]);
134
+ } catch (err) {
135
+ throw applyTransform(err, [
136
+ notify,
137
+ ]);
138
+ }
139
+ };
140
+
141
+ const deleteResourceDisplay = async ({
142
+ parentId,
143
+ id,
144
+ }: NestedDeleteItemParams) => {
145
+ try {
146
+ const response =
147
+ await getOutboundResourceService().deleteOutboundResourceDisplay(
148
+ String(parentId),
149
+ String(id),
150
+ );
151
+ return applyTransform(response.data, []);
152
+ } catch (err) {
153
+ throw applyTransform(err, [
154
+ notify,
155
+ ]);
156
+ }
157
+ };
158
+
159
+ export const ResourceDisplaysAPI = {
160
+ getList: getResourceDisplaysList,
161
+ get: getResourceDisplay,
162
+ add: addResourceDisplay,
163
+ update: updateResourceDisplay,
164
+ delete: deleteResourceDisplay,
165
+ };
@@ -0,0 +1,203 @@
1
+ import deepCopy from 'deep-copy';
2
+ import { getPauseTemplateService } from '../../../gen-wire';
3
+ import { getDefaultGetListResponse, getDefaultGetParams } from '../../defaults';
4
+ import {
5
+ applyTransform,
6
+ camelToSnake,
7
+ merge,
8
+ notify,
9
+ sanitize,
10
+ snakeToCamel,
11
+ } from '../../transformers';
12
+ import type {
13
+ AddItemParams,
14
+ ApiParams,
15
+ DeleteItemParams,
16
+ GetItemParams,
17
+ UpdateItemParams,
18
+ } from '../_shared/types';
19
+
20
+ const fieldsToSend = [
21
+ 'name',
22
+ 'description',
23
+ 'causes',
24
+ 'domainId',
25
+ 'createdAt',
26
+ 'createdBy',
27
+ 'updatedAt',
28
+ 'updatedBy',
29
+ ];
30
+
31
+ /**
32
+ * WFM services wrap both request and response payloads in an `item` envelope,
33
+ * and nest each pause cause under a `cause` key. The form binds a flat
34
+ * `{ id, name, duration }`.
35
+ */
36
+ const itemResponseHandler = (response: ApiParams) => {
37
+ const item = {
38
+ ...response.item,
39
+ };
40
+
41
+ item.causes = item.causes?.map((cause: ApiParams) => ({
42
+ id: cause.cause?.id,
43
+ name: cause.cause?.name,
44
+ duration: cause?.duration,
45
+ }));
46
+
47
+ return item;
48
+ };
49
+
50
+ const preRequestHandler = (item: ApiParams) => {
51
+ const copy = deepCopy(item);
52
+ copy.causes = copy.causes.map((cause: ApiParams) => {
53
+ if (!cause.name && !cause.id) return cause;
54
+ return {
55
+ cause: {
56
+ id: cause?.id,
57
+ name: cause?.name,
58
+ },
59
+ duration: cause.duration,
60
+ };
61
+ });
62
+ return copy;
63
+ };
64
+
65
+ const getPauseTemplatesList = async (params: ApiParams) => {
66
+ const {
67
+ search: q,
68
+ page,
69
+ size,
70
+ sort,
71
+ fields,
72
+ } = applyTransform(params, [
73
+ merge(getDefaultGetParams()),
74
+ ]);
75
+
76
+ try {
77
+ const response =
78
+ await getPauseTemplateService().pauseTemplateServiceSearchPauseTemplate({
79
+ q,
80
+ page,
81
+ size,
82
+ sort,
83
+ fields,
84
+ });
85
+ const { items, next } = applyTransform(response.data, [
86
+ snakeToCamel(),
87
+ merge(getDefaultGetListResponse()),
88
+ ]);
89
+ return {
90
+ items,
91
+ next,
92
+ };
93
+ } catch (err) {
94
+ throw applyTransform(err, [
95
+ notify,
96
+ ]);
97
+ }
98
+ };
99
+
100
+ const getPauseTemplate = async ({ itemId: id }: GetItemParams) => {
101
+ try {
102
+ const response =
103
+ await getPauseTemplateService().pauseTemplateServiceReadPauseTemplate(
104
+ String(id),
105
+ );
106
+ return applyTransform(response.data, [
107
+ snakeToCamel(),
108
+ itemResponseHandler,
109
+ ]);
110
+ } catch (err) {
111
+ throw applyTransform(err, [
112
+ notify,
113
+ ]);
114
+ }
115
+ };
116
+
117
+ const addPauseTemplate = async ({ itemInstance }: AddItemParams) => {
118
+ const item = applyTransform(itemInstance, [
119
+ sanitize(fieldsToSend),
120
+ camelToSnake(),
121
+ preRequestHandler,
122
+ ]);
123
+ try {
124
+ const response =
125
+ await getPauseTemplateService().pauseTemplateServiceCreatePauseTemplate({
126
+ item: {
127
+ ...item,
128
+ },
129
+ });
130
+ return applyTransform(response.data, [
131
+ snakeToCamel(),
132
+ itemResponseHandler,
133
+ ]);
134
+ } catch (err) {
135
+ throw applyTransform(err, [
136
+ notify,
137
+ ]);
138
+ }
139
+ };
140
+
141
+ const updatePauseTemplate = async ({
142
+ itemInstance,
143
+ itemId: id,
144
+ }: UpdateItemParams) => {
145
+ const item = applyTransform(itemInstance, [
146
+ sanitize(fieldsToSend),
147
+ camelToSnake(),
148
+ preRequestHandler,
149
+ ]);
150
+ try {
151
+ const response =
152
+ await getPauseTemplateService().pauseTemplateServiceUpdatePauseTemplate(
153
+ String(id),
154
+ {
155
+ item: {
156
+ ...item,
157
+ },
158
+ },
159
+ );
160
+ return applyTransform(response.data, [
161
+ snakeToCamel(),
162
+ itemResponseHandler,
163
+ ]);
164
+ } catch (err) {
165
+ throw applyTransform(err, [
166
+ notify,
167
+ ]);
168
+ }
169
+ };
170
+
171
+ const deletePauseTemplate = async ({ id }: DeleteItemParams) => {
172
+ try {
173
+ const response =
174
+ await getPauseTemplateService().pauseTemplateServiceDeletePauseTemplate(
175
+ String(id),
176
+ );
177
+ return applyTransform(response.data, []);
178
+ } catch (err) {
179
+ throw applyTransform(err, [
180
+ notify,
181
+ ]);
182
+ }
183
+ };
184
+
185
+ const getPauseTemplatesLookup = (
186
+ params: Parameters<typeof getPauseTemplatesList>[0],
187
+ ) =>
188
+ getPauseTemplatesList({
189
+ ...params,
190
+ fields: params.fields || [
191
+ 'id',
192
+ 'name',
193
+ ],
194
+ });
195
+
196
+ export const PauseTemplatesAPI = {
197
+ getList: getPauseTemplatesList,
198
+ get: getPauseTemplate,
199
+ add: addPauseTemplate,
200
+ update: updatePauseTemplate,
201
+ delete: deletePauseTemplate,
202
+ getLookup: getPauseTemplatesLookup,
203
+ };
@@ -88,10 +88,10 @@ describe('QueueLogsAPI.getList', () => {
88
88
  });
89
89
 
90
90
  expect(paramsSent()).toMatchObject({
91
- bucketId: [
91
+ bucket_id: [
92
92
  1,
93
93
  ],
94
- agentId: [
94
+ agent_id: [
95
95
  2,
96
96
  ],
97
97
  'leaving_at.from': 10,
@@ -109,7 +109,7 @@ describe('QueueLogsAPI.getList', () => {
109
109
 
110
110
  // `starToSearch` makes it a prefix search, as everywhere else
111
111
  expect(paramsSent()).toMatchObject({
112
- queueId: [
112
+ queue_id: [
113
113
  '7',
114
114
  ],
115
115
  q: 'joe*',
@@ -91,13 +91,13 @@ describe('QueueMembersAPI.getList', () => {
91
91
 
92
92
  expect(paramsSent()).toMatchObject({
93
93
  q: 'joe*',
94
- bucketId: [
94
+ bucket_id: [
95
95
  1,
96
96
  ],
97
- agentId: [
97
+ agent_id: [
98
98
  2,
99
99
  ],
100
- stopCause: [
100
+ stop_cause: [
101
101
  'cancel',
102
102
  ],
103
103
  'offering_at.from': 300,
@@ -123,7 +123,7 @@ describe('QueueMembersAPI.getList', () => {
123
123
  expect(paramsSent()).toMatchObject({
124
124
  'created_at.from': 100,
125
125
  'created_at.to': 200,
126
- stopCause: [
126
+ stop_cause: [
127
127
  'cancel',
128
128
  ],
129
129
  });
@@ -43,6 +43,11 @@ const getQueueLogs = async (params: ApiParams) => {
43
43
  keys (`joined_at.from`); the generated type's `joinedAtFrom` is ignored
44
44
  by the backend. Kept as a variable, not an inline literal, so TS's
45
45
  excess-property check doesn't flag the dotted keys against that type.
46
+
47
+ That cast also hides every *other* key from the check, which is how
48
+ `queueId` / `agentId` / `bucketId` sat here unnoticed: the endpoint
49
+ declares them snake_case, so all three filters were silently ignored.
50
+ `wireParamsCoverage.spec.ts` now checks this object against the schema.
46
51
  */
47
52
  const requestParams = {
48
53
  page,
@@ -52,11 +57,11 @@ const getQueueLogs = async (params: ApiParams) => {
52
57
  sort,
53
58
  fields,
54
59
  // repeated params, even for the single queue this tab shows
55
- queueId: [
60
+ queue_id: [
56
61
  String(parentId),
57
62
  ],
58
- agentId: agent,
59
- bucketId: bucket,
63
+ agent_id: agent,
64
+ bucket_id: bucket,
60
65
  result,
61
66
  'joined_at.from': joinedAt?.from,
62
67
  'joined_at.to': joinedAt?.to,
@@ -145,9 +145,9 @@ const getMembersList = async (params: ApiParams) => {
145
145
  sort,
146
146
  fields,
147
147
  id,
148
- bucketId: bucket,
149
- stopCause,
150
- agentId: agent,
148
+ bucket_id: bucket,
149
+ stop_cause: stopCause,
150
+ agent_id: agent,
151
151
  'created_at.from': createdAt?.from,
152
152
  'created_at.to': createdAt?.to,
153
153
  'offering_at.from': offeringAt?.from,