@webitel/api-services 0.1.57 → 0.1.58

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.58",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -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 };