@webitel/api-services 0.0.98 → 0.0.101

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.0.98",
3
+ "version": "0.0.101",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm run gen:api && npm version patch && (npm run build:types || true) && (npm run format:all || true) && npm run publish-lib",
@@ -2,6 +2,7 @@ import {
2
2
  createCallExportBody,
3
3
  createScreenrecordingExportBody,
4
4
  listScreenrecordingExportsQueryParams,
5
+ listCallExportsQueryParams,
5
6
  getPdfService,
6
7
  } from '@webitel/api-services/gen';
7
8
  import { getShallowFieldsToSendFromZodSchema } from '@webitel/api-services/gen/utils';
@@ -58,20 +59,43 @@ const listScreenrecordingExports = async (params: any) => {
58
59
  }
59
60
  };
60
61
 
61
- const createCallExport = async ({fileId, params}) => {
62
+ const createCallExport = async ({ callId, itemInstance }) => {
63
+ const item = applyTransform(itemInstance, [
64
+ sanitize(getShallowFieldsToSendFromZodSchema(createCallExportBody)),
65
+ camelToSnake(),
66
+ ]);
67
+
68
+ try {
69
+ const response = await getPdfService().createCallExport(callId, item);
70
+ return applyTransform(response.data, [snakeToCamel()]);
71
+ } catch (err) {
72
+ throw applyTransform(err, [notify]);
73
+ }
74
+ };
75
+
76
+ const listCallExports = async (params: any) => {
62
77
  const fieldsToSend = getShallowFieldsToSendFromZodSchema(
63
- createCallExportBody,
78
+ listCallExportsQueryParams,
64
79
  );
65
80
 
66
- const { domainId } = applyTransform(params, [
81
+ const { page, size } = applyTransform(params, [
82
+ merge(getDefaultGetParams()),
67
83
  sanitize(fieldsToSend),
84
+ camelToSnake(),
68
85
  ]);
69
86
 
70
87
  try {
71
- const response = await getPdfService().createCallExport(fileId, {
72
- domainId,
88
+ const response = await getPdfService().listCallExports(params.callId, {
89
+ page,
90
+ size,
73
91
  });
74
- return response.data;
92
+ const { items, next } = applyTransform(response.data, [
93
+ merge(getDefaultGetListResponse()),
94
+ ]);
95
+ return {
96
+ items: applyTransform(items, [snakeToCamel()]),
97
+ next,
98
+ };
75
99
  } catch (err) {
76
100
  throw applyTransform(err, [notify]);
77
101
  }
@@ -89,6 +113,7 @@ const deleteExport = async (id: string) => {
89
113
  export const PdfServicesAPI = {
90
114
  createScreenrecordingExport,
91
115
  getList: listScreenrecordingExports,
116
+ createCallExport,
117
+ listCallExports,
92
118
  delete: deleteExport,
93
- download: createCallExport,
94
119
  };
@@ -7,9 +7,13 @@ export declare const PdfServicesAPI: {
7
7
  items: any;
8
8
  next: any;
9
9
  }>;
10
- delete: (id: string) => Promise<any>;
11
- download: ({ fileId, params }: {
12
- fileId: any;
13
- params: any;
10
+ createCallExport: ({ callId, itemInstance }: {
11
+ callId: any;
12
+ itemInstance: any;
14
13
  }) => Promise<any>;
14
+ listCallExports: (params: any) => Promise<{
15
+ items: any;
16
+ next: any;
17
+ }>;
18
+ delete: (id: string) => Promise<any>;
15
19
  };