@webitel/api-services 0.1.57 → 0.1.59

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/api-services",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -168,12 +168,16 @@ const deleteScreenRecordingsByUser = async ({
168
168
  id,
169
169
  }: {
170
170
  userId: ApiId;
171
- id: ApiId[];
171
+ id: ApiId | ApiId[];
172
172
  }) => {
173
173
  try {
174
174
  const response = await getFileService().deleteScreenRecordings(
175
175
  String(userId),
176
- id.map(String),
176
+ Array.isArray(id)
177
+ ? id.map(String)
178
+ : [
179
+ String(id),
180
+ ],
177
181
  {},
178
182
  );
179
183
  return applyTransform(response.data, [
@@ -263,12 +267,16 @@ const deleteScreenRecordingsByAgent = async ({
263
267
  id,
264
268
  }: {
265
269
  agentId: ApiId;
266
- id: ApiId[];
270
+ id: ApiId | ApiId[];
267
271
  }) => {
268
272
  try {
269
273
  const response = await getFileService().deleteScreenRecordingsByAgent(
270
274
  String(agentId),
271
- id.map(String),
275
+ Array.isArray(id)
276
+ ? id.map(String)
277
+ : [
278
+ String(id),
279
+ ],
272
280
  {},
273
281
  );
274
282
  return applyTransform(response.data, [
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  CreateCallExportBody,
3
3
  CreateScreenrecordingExportBody,
4
+ DownloadCallArchiveQueryParams,
4
5
  getPdfService,
5
6
  ListCallExportsQueryParams,
6
7
  ListScreenrecordingExportsQueryParams,
@@ -145,6 +146,38 @@ const listCallExports = async (params: { callId: ApiId }) => {
145
146
  }
146
147
  };
147
148
 
149
+ const downloadCallArchive = async ({
150
+ callId,
151
+ fileIds,
152
+ }: {
153
+ callId: ApiId;
154
+ fileIds?: (string | number)[];
155
+ }) => {
156
+ const fieldsToSend = getShallowFieldsToSendFromZodSchema(
157
+ DownloadCallArchiveQueryParams,
158
+ );
159
+
160
+ const params = applyTransform(
161
+ {
162
+ fileIds,
163
+ },
164
+ [
165
+ sanitize(fieldsToSend),
166
+ camelToSnake(),
167
+ ],
168
+ );
169
+
170
+ try {
171
+ return await getPdfService().downloadCallArchive(String(callId), params, {
172
+ responseType: 'blob',
173
+ });
174
+ } catch (err) {
175
+ throw applyTransform(err, [
176
+ notify,
177
+ ]);
178
+ }
179
+ };
180
+
148
181
  const deleteExport = async (id: ApiId) => {
149
182
  try {
150
183
  const response = await getPdfService().deleteExport(String(id));
@@ -163,5 +196,6 @@ export const PdfServicesAPI = {
163
196
  getList: listScreenrecordingExports,
164
197
  createCallExport,
165
198
  listCallExports,
199
+ downloadCallArchive,
166
200
  delete: deleteExport,
167
201
  };
@@ -1,4 +1,5 @@
1
1
  export enum FileFormat {
2
2
  CSV = 'csv',
3
3
  XLSX = 'xlsx',
4
+ ZIP = 'zip',
4
5
  }
@@ -1,4 +1,5 @@
1
1
  import convertDuration from './convertDuration/convertDuration';
2
2
  import downloadFile from './downloadFile/downloadFile';
3
+ import { FileFormat } from './downloadFile/types/fileFormat.types';
3
4
 
4
- export { convertDuration, downloadFile };
5
+ export { convertDuration, downloadFile, FileFormat };