@wix/media 1.0.50 → 1.0.52

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 (51) hide show
  1. package/build/cjs/index.js +5 -1
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/index.typings.js +5 -1
  4. package/build/cjs/index.typings.js.map +1 -1
  5. package/build/cjs/meta.js +5 -1
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/cjs/src/media-site-media-v1-file-descriptor.http.d.ts +83 -34
  8. package/build/cjs/src/media-site-media-v1-file-descriptor.http.js +433 -350
  9. package/build/cjs/src/media-site-media-v1-file-descriptor.http.js.map +1 -1
  10. package/build/cjs/src/media-site-media-v1-file-descriptor.meta.d.ts +1 -1
  11. package/build/cjs/src/media-site-media-v1-file-descriptor.meta.js +5 -1
  12. package/build/cjs/src/media-site-media-v1-file-descriptor.meta.js.map +1 -1
  13. package/build/cjs/src/media-site-media-v1-file-descriptor.public.d.ts +10 -10
  14. package/build/cjs/src/media-site-media-v1-file-descriptor.types.d.ts +5 -6
  15. package/build/cjs/src/media-site-media-v1-file-descriptor.types.js +10 -10
  16. package/build/cjs/src/media-site-media-v1-file-descriptor.types.js.map +1 -1
  17. package/build/cjs/src/media-site-media-v1-file-descriptor.universal.d.ts +126 -69
  18. package/build/cjs/src/media-site-media-v1-file-descriptor.universal.js +227 -99
  19. package/build/cjs/src/media-site-media-v1-file-descriptor.universal.js.map +1 -1
  20. package/build/cjs/src/media-site-media-v1-folder.http.js +84 -89
  21. package/build/cjs/src/media-site-media-v1-folder.http.js.map +1 -1
  22. package/build/cjs/src/media-site-media-v1-folder.meta.d.ts +1 -1
  23. package/build/cjs/src/media-site-media-v1-folder.meta.js +5 -1
  24. package/build/cjs/src/media-site-media-v1-folder.meta.js.map +1 -1
  25. package/build/cjs/src/media-site-media-v1-folder.public.d.ts +5 -5
  26. package/build/cjs/src/media-site-media-v1-folder.types.d.ts +4 -5
  27. package/build/cjs/src/media-site-media-v1-folder.types.js +4 -4
  28. package/build/cjs/src/media-site-media-v1-folder.types.js.map +1 -1
  29. package/build/cjs/src/media-site-media-v1-folder.universal.d.ts +4 -5
  30. package/build/cjs/src/media-site-media-v1-folder.universal.js +74 -37
  31. package/build/cjs/src/media-site-media-v1-folder.universal.js.map +1 -1
  32. package/build/es/src/media-site-media-v1-file-descriptor.http.d.ts +83 -34
  33. package/build/es/src/media-site-media-v1-file-descriptor.http.js +433 -350
  34. package/build/es/src/media-site-media-v1-file-descriptor.http.js.map +1 -1
  35. package/build/es/src/media-site-media-v1-file-descriptor.meta.d.ts +1 -1
  36. package/build/es/src/media-site-media-v1-file-descriptor.public.d.ts +10 -10
  37. package/build/es/src/media-site-media-v1-file-descriptor.types.d.ts +5 -6
  38. package/build/es/src/media-site-media-v1-file-descriptor.types.js.map +1 -1
  39. package/build/es/src/media-site-media-v1-file-descriptor.universal.d.ts +126 -69
  40. package/build/es/src/media-site-media-v1-file-descriptor.universal.js +213 -89
  41. package/build/es/src/media-site-media-v1-file-descriptor.universal.js.map +1 -1
  42. package/build/es/src/media-site-media-v1-folder.http.js +84 -89
  43. package/build/es/src/media-site-media-v1-folder.http.js.map +1 -1
  44. package/build/es/src/media-site-media-v1-folder.meta.d.ts +1 -1
  45. package/build/es/src/media-site-media-v1-folder.public.d.ts +5 -5
  46. package/build/es/src/media-site-media-v1-folder.types.d.ts +4 -5
  47. package/build/es/src/media-site-media-v1-folder.types.js.map +1 -1
  48. package/build/es/src/media-site-media-v1-folder.universal.d.ts +4 -5
  49. package/build/es/src/media-site-media-v1-folder.universal.js +66 -33
  50. package/build/es/src/media-site-media-v1-folder.universal.js.map +1 -1
  51. package/package.json +7 -3
@@ -2,82 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.listDeletedFiles = exports.bulkRestoreFilesFromTrashBin = exports.bulkDeleteFiles = exports.generateVideoStreamingUrl = exports.searchFiles = exports.listFiles = exports.bulkImportFile = exports.bulkImportFiles = exports.importFile = exports.generateFileResumableUploadUrl = exports.generateFileUploadUrl = exports.updateFileDescriptor = exports.getFileDescriptors = exports.getFileDescriptor = exports.generateFileDownloadUrl = exports.generateFilesDownloadUrl = void 0;
4
4
  const metro_runtime_1 = require("@wix/metro-runtime");
5
- const ambassador_1 = require("@wix/metro-runtime/ambassador");
5
+ const float_1 = require("@wix/sdk-runtime/transformations/float");
6
+ const float_2 = require("@wix/sdk-runtime/transformations/float");
7
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
8
+ const timestamp_2 = require("@wix/sdk-runtime/transformations/timestamp");
9
+ const field_mask_1 = require("@wix/sdk-runtime/transformations/field-mask");
10
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
6
11
  const metro_runtime_2 = require("@wix/metro-runtime");
7
- const _archive = { urlExpirationDate: 'google.protobuf.Timestamp' };
8
- const _audio = { urlExpirationDate: 'google.protobuf.Timestamp' };
9
- const _audioV2 = { assets: '_audio' };
10
- const _bulkDeleteFilesRequest = {};
11
- const _bulkDeleteFilesResponse = {};
12
- const _bulkImportFileRequest = { importFileRequests: '_importFileRequest' };
13
- const _bulkImportFileResponse = { results: '_bulkImportFileResult' };
14
- const _bulkImportFileResult = { item: '_fileDescriptor' };
15
- const _bulkImportFilesRequest = { importFileRequests: '_importFileRequest' };
16
- const _bulkImportFilesResponse = { files: '_fileDescriptor' };
17
- const _bulkRestoreFilesFromTrashBinRequest = {};
18
- const _bulkRestoreFilesFromTrashBinResponse = {};
19
- const _document = { urlExpirationDate: 'google.protobuf.Timestamp' };
20
- const _faceRecognition = { confidence: 'DOUBLE' };
21
- const _fileDescriptor = {
22
- createdDate: 'google.protobuf.Timestamp',
23
- updatedDate: 'google.protobuf.Timestamp',
24
- media: '_fileMedia',
25
- };
26
- const _fileMedia = {
27
- image: '_imageMedia',
28
- video: '_videoV2',
29
- audio: '_audioV2',
30
- document: '_document',
31
- vector: '_imageMedia',
32
- archive: '_archive',
33
- model3d: '_model3D',
34
- };
35
- const _generateFileDownloadUrlRequest = {};
36
- const _generateFileDownloadUrlResponse = {};
37
- const _generateFileResumableUploadUrlRequest = {};
38
- const _generateFileResumableUploadUrlResponse = {};
39
- const _generateFilesDownloadUrlRequest = {};
40
- const _generateFilesDownloadUrlResponse = {};
41
- const _generateFileUploadUrlRequest = {};
42
- const _generateFileUploadUrlResponse = {};
43
- const _generateVideoStreamingUrlRequest = {};
44
- const _generateVideoStreamingUrlResponse = {};
45
- const _getFileDescriptorRequest = {};
46
- const _getFileDescriptorResponse = { file: '_fileDescriptor' };
47
- const _getFileDescriptorsRequest = {};
48
- const _getFileDescriptorsResponse = { files: '_fileDescriptor' };
49
- const _image = { urlExpirationDate: 'google.protobuf.Timestamp' };
50
- const _imageMedia = {
51
- image: '_image',
52
- faces: '_faceRecognition',
53
- previewImage: '_image',
54
- };
55
- const _importFileRequest = {};
56
- const _importFileResponse = { file: '_fileDescriptor' };
57
- const _listDeletedFilesRequest = {};
58
- const _listDeletedFilesResponse = { files: '_fileDescriptor' };
59
- const _listFilesRequest = {};
60
- const _listFilesResponse = { files: '_fileDescriptor' };
61
- const _model3D = {
62
- urlExpirationDate: 'google.protobuf.Timestamp',
63
- thumbnail: '_image',
64
- };
65
- const _searchFilesRequest = {};
66
- const _searchFilesResponse = { files: '_fileDescriptor' };
67
- const _updateFileDescriptorRequest = {
68
- fieldMask: 'google.protobuf.FieldMask',
69
- file: '_fileDescriptor',
70
- };
71
- const _updateFileDescriptorResponse = { file: '_fileDescriptor' };
72
- const _videoResolution = {
73
- urlExpirationDate: 'google.protobuf.Timestamp',
74
- poster: '_image',
75
- };
76
- const _videoV2 = {
77
- urlExpirationDate: 'google.protobuf.Timestamp',
78
- resolutions: '_videoResolution',
79
- posters: '_image',
80
- };
81
12
  function resolveComWixMediaSiteMediaV1FilesServiceUrl(opts) {
82
13
  const domainToMappings = {
83
14
  'apps._base_domain_': [
@@ -108,172 +39,211 @@ function resolveComWixMediaSiteMediaV1FilesServiceUrl(opts) {
108
39
  /**
109
40
  * Generates a URL for downloading a compressed file containing specific files in the Media Manager.
110
41
  *
42
+ * The `generateFilesDownloadUrl()` function returns a Promise that resolves to a download URL.
43
+ *
111
44
  * The compressed file can contain up to 1000 files.
112
45
  */
113
46
  function generateFilesDownloadUrl(payload) {
114
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_generateFilesDownloadUrlRequest, {});
115
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_generateFilesDownloadUrlResponse, {});
116
47
  function __generateFilesDownloadUrl({ host }) {
117
- const serializedData = toReq(payload);
118
48
  const metadata = {
119
49
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
120
50
  method: 'POST',
121
51
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFilesDownloadUrl',
122
52
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
123
53
  protoPath: '/v1/files/generate-download-url',
124
- data: serializedData,
54
+ data: payload,
125
55
  host,
126
56
  }),
127
- data: serializedData,
128
- transformResponse: fromRes,
57
+ data: payload,
129
58
  };
130
59
  return metadata;
131
60
  }
132
- __generateFilesDownloadUrl.fromReq = fromReq;
133
61
  return __generateFilesDownloadUrl;
134
62
  }
135
63
  exports.generateFilesDownloadUrl = generateFilesDownloadUrl;
136
64
  /**
137
65
  * Generates one or more temporary URLs for downloading a specific file in the Media Manager.
138
66
  *
67
+ * The `generateFileDownloadUrl()` function returns a Promise that resolves to an array containing download URLs for the assets specified in the options parameter.
68
+ *
139
69
  * To download different assets of the file, use the `assetKeys` parameter which generates a download URL for each asset.
140
- * If no `assetKey` is specified, it defaults to `src`, which generates one download URL in the original file's format and quality.
70
+ * If no asset key is specified, it defaults to `src`, which generates one download URL in the original file's format and quality.
141
71
  *
142
- * Use this endpoint to grant external clients access to a private media file. Use the `expirationInMinutes` parameter to set the URL expiration time, and the `expirationRedirectUrl` parameter to add a redirect url when the URL expires.
72
+ * Use this endpoint to grant external clients access to a private media file. Use the `expirationInMinutes` parameter to set the URL expiration time, and the `expirationRedirectUrl` parameter to add a redirect URL when the URL expires.
143
73
  */
144
74
  function generateFileDownloadUrl(payload) {
145
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_generateFileDownloadUrlRequest, {});
146
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_generateFileDownloadUrlResponse, {});
147
75
  function __generateFileDownloadUrl({ host }) {
148
- const serializedData = toReq(payload);
149
76
  const metadata = {
150
77
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
151
78
  method: 'POST',
152
79
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileDownloadUrl',
153
80
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
154
81
  protoPath: '/v1/files/{fileId}/generate-download-url',
155
- data: serializedData,
82
+ data: payload,
156
83
  host,
157
84
  }),
158
- data: serializedData,
159
- transformResponse: fromRes,
85
+ data: payload,
160
86
  };
161
87
  return metadata;
162
88
  }
163
- __generateFileDownloadUrl.fromReq = fromReq;
164
89
  return __generateFileDownloadUrl;
165
90
  }
166
91
  exports.generateFileDownloadUrl = generateFileDownloadUrl;
167
- /** Gets information about the specified file in the Media Manager. */
92
+ /**
93
+ * Gets information about the specified file in the Media Manager.
94
+ *
95
+ *
96
+ * The `getFileDescriptor()` function returns a Promise that resolves to the specified file's descriptor.
97
+ *
98
+ * Use `getFileDescriptors()` to get multiple file descriptors at once.
99
+ */
168
100
  function getFileDescriptor(payload) {
169
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_getFileDescriptorRequest, {});
170
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_getFileDescriptorResponse, {
171
- _archive,
172
- _audio,
173
- _audioV2,
174
- _document,
175
- _faceRecognition,
176
- _fileDescriptor,
177
- _fileMedia,
178
- _image,
179
- _imageMedia,
180
- _model3D,
181
- _videoResolution,
182
- _videoV2,
183
- });
184
101
  function __getFileDescriptor({ host }) {
185
- const serializedData = toReq(payload);
186
102
  const metadata = {
187
103
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
188
104
  method: 'GET',
189
105
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GetFileDescriptor',
190
106
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
191
107
  protoPath: '/v1/files/{fileId}',
192
- data: serializedData,
108
+ data: payload,
193
109
  host,
194
110
  }),
195
- params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
196
- transformResponse: fromRes,
111
+ params: (0, metro_runtime_1.toURLSearchParams)(payload),
112
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
113
+ {
114
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
115
+ paths: [
116
+ { path: 'file.createdDate' },
117
+ { path: 'file.updatedDate' },
118
+ { path: 'file.media.image.image.urlExpirationDate' },
119
+ { path: 'file.media.image.previewImage.urlExpirationDate' },
120
+ { path: 'file.media.video.urlExpirationDate' },
121
+ { path: 'file.media.video.resolutions.urlExpirationDate' },
122
+ { path: 'file.media.video.resolutions.poster.urlExpirationDate' },
123
+ { path: 'file.media.video.posters.urlExpirationDate' },
124
+ { path: 'file.media.audio.assets.urlExpirationDate' },
125
+ { path: 'file.media.document.urlExpirationDate' },
126
+ { path: 'file.media.vector.image.urlExpirationDate' },
127
+ { path: 'file.media.vector.previewImage.urlExpirationDate' },
128
+ { path: 'file.media.archive.urlExpirationDate' },
129
+ { path: 'file.media.model3d.urlExpirationDate' },
130
+ { path: 'file.media.model3d.thumbnail.urlExpirationDate' },
131
+ ],
132
+ },
133
+ {
134
+ transformFn: float_2.transformRESTFloatToSDKFloat,
135
+ paths: [
136
+ { path: 'file.media.image.faces.confidence' },
137
+ { path: 'file.media.vector.faces.confidence' },
138
+ ],
139
+ },
140
+ ]),
197
141
  };
198
142
  return metadata;
199
143
  }
200
- __getFileDescriptor.fromReq = fromReq;
201
144
  return __getFileDescriptor;
202
145
  }
203
146
  exports.getFileDescriptor = getFileDescriptor;
204
- /** Gets information about the specified files in the Media Manager. */
147
+ /**
148
+ * Gets information about the specified files in the Media Manager.
149
+ *
150
+ *
151
+ * The `getFileDescriptors()` function returns a Promise that resolves to an array containing the specified files' descriptors.
152
+ *
153
+ * Use `getFileDescriptor()` to get a single file descriptor.
154
+ */
205
155
  function getFileDescriptors(payload) {
206
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_getFileDescriptorsRequest, {});
207
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_getFileDescriptorsResponse, {
208
- _archive,
209
- _audio,
210
- _audioV2,
211
- _document,
212
- _faceRecognition,
213
- _fileDescriptor,
214
- _fileMedia,
215
- _image,
216
- _imageMedia,
217
- _model3D,
218
- _videoResolution,
219
- _videoV2,
220
- });
221
156
  function __getFileDescriptors({ host }) {
222
- const serializedData = toReq(payload);
223
157
  const metadata = {
224
158
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
225
159
  method: 'POST',
226
160
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GetFileDescriptors',
227
161
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
228
162
  protoPath: '/v1/files/get-files',
229
- data: serializedData,
163
+ data: payload,
230
164
  host,
231
165
  }),
232
- data: serializedData,
233
- transformResponse: fromRes,
166
+ data: payload,
167
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
168
+ {
169
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
170
+ paths: [
171
+ { path: 'files.createdDate' },
172
+ { path: 'files.updatedDate' },
173
+ { path: 'files.media.image.image.urlExpirationDate' },
174
+ { path: 'files.media.image.previewImage.urlExpirationDate' },
175
+ { path: 'files.media.video.urlExpirationDate' },
176
+ { path: 'files.media.video.resolutions.urlExpirationDate' },
177
+ {
178
+ path: 'files.media.video.resolutions.poster.urlExpirationDate',
179
+ },
180
+ { path: 'files.media.video.posters.urlExpirationDate' },
181
+ { path: 'files.media.audio.assets.urlExpirationDate' },
182
+ { path: 'files.media.document.urlExpirationDate' },
183
+ { path: 'files.media.vector.image.urlExpirationDate' },
184
+ { path: 'files.media.vector.previewImage.urlExpirationDate' },
185
+ { path: 'files.media.archive.urlExpirationDate' },
186
+ { path: 'files.media.model3d.urlExpirationDate' },
187
+ { path: 'files.media.model3d.thumbnail.urlExpirationDate' },
188
+ ],
189
+ },
190
+ {
191
+ transformFn: float_2.transformRESTFloatToSDKFloat,
192
+ paths: [
193
+ { path: 'files.media.image.faces.confidence' },
194
+ { path: 'files.media.vector.faces.confidence' },
195
+ ],
196
+ },
197
+ ]),
234
198
  };
235
199
  return metadata;
236
200
  }
237
- __getFileDescriptors.fromReq = fromReq;
238
201
  return __getFileDescriptors;
239
202
  }
240
203
  exports.getFileDescriptors = getFileDescriptors;
241
204
  /**
242
- * Updates a file. <br />
205
+ * Updates a file.
206
+ *
207
+ *
208
+ * The `updateFileDescriptor()` function returns a Promise that resolves to the updated file's descriptor.
243
209
  *
244
210
  * You can use the `parentFolderId` parameter to move a file from its current folder to a different folder.
245
211
  */
246
212
  function updateFileDescriptor(payload) {
247
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_updateFileDescriptorRequest, {
248
- _archive,
249
- _audio,
250
- _audioV2,
251
- _document,
252
- _faceRecognition,
253
- _fileDescriptor,
254
- _fileMedia,
255
- _image,
256
- _imageMedia,
257
- _model3D,
258
- _videoResolution,
259
- _videoV2,
260
- });
261
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_updateFileDescriptorResponse, {
262
- _archive,
263
- _audio,
264
- _audioV2,
265
- _document,
266
- _faceRecognition,
267
- _fileDescriptor,
268
- _fileMedia,
269
- _image,
270
- _imageMedia,
271
- _model3D,
272
- _videoResolution,
273
- _videoV2,
274
- });
275
213
  function __updateFileDescriptor({ host }) {
276
- const serializedData = toReq(payload);
214
+ const serializedData = (0, transform_paths_1.transformPaths)(payload, [
215
+ {
216
+ transformFn: field_mask_1.transformSDKFieldMaskToRESTFieldMask,
217
+ paths: [{ path: 'fieldMask' }],
218
+ },
219
+ {
220
+ transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
221
+ paths: [
222
+ { path: 'file.createdDate' },
223
+ { path: 'file.updatedDate' },
224
+ { path: 'file.media.image.image.urlExpirationDate' },
225
+ { path: 'file.media.image.previewImage.urlExpirationDate' },
226
+ { path: 'file.media.video.urlExpirationDate' },
227
+ { path: 'file.media.video.resolutions.urlExpirationDate' },
228
+ { path: 'file.media.video.resolutions.poster.urlExpirationDate' },
229
+ { path: 'file.media.video.posters.urlExpirationDate' },
230
+ { path: 'file.media.audio.assets.urlExpirationDate' },
231
+ { path: 'file.media.document.urlExpirationDate' },
232
+ { path: 'file.media.vector.image.urlExpirationDate' },
233
+ { path: 'file.media.vector.previewImage.urlExpirationDate' },
234
+ { path: 'file.media.archive.urlExpirationDate' },
235
+ { path: 'file.media.model3d.urlExpirationDate' },
236
+ { path: 'file.media.model3d.thumbnail.urlExpirationDate' },
237
+ ],
238
+ },
239
+ {
240
+ transformFn: float_1.transformSDKFloatToRESTFloat,
241
+ paths: [
242
+ { path: 'file.media.image.faces.confidence' },
243
+ { path: 'file.media.vector.faces.confidence' },
244
+ ],
245
+ },
246
+ ]);
277
247
  const metadata = {
278
248
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
279
249
  method: 'PATCH',
@@ -284,122 +254,153 @@ function updateFileDescriptor(payload) {
284
254
  host,
285
255
  }),
286
256
  data: serializedData,
287
- transformResponse: fromRes,
257
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
258
+ {
259
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
260
+ paths: [
261
+ { path: 'file.createdDate' },
262
+ { path: 'file.updatedDate' },
263
+ { path: 'file.media.image.image.urlExpirationDate' },
264
+ { path: 'file.media.image.previewImage.urlExpirationDate' },
265
+ { path: 'file.media.video.urlExpirationDate' },
266
+ { path: 'file.media.video.resolutions.urlExpirationDate' },
267
+ { path: 'file.media.video.resolutions.poster.urlExpirationDate' },
268
+ { path: 'file.media.video.posters.urlExpirationDate' },
269
+ { path: 'file.media.audio.assets.urlExpirationDate' },
270
+ { path: 'file.media.document.urlExpirationDate' },
271
+ { path: 'file.media.vector.image.urlExpirationDate' },
272
+ { path: 'file.media.vector.previewImage.urlExpirationDate' },
273
+ { path: 'file.media.archive.urlExpirationDate' },
274
+ { path: 'file.media.model3d.urlExpirationDate' },
275
+ { path: 'file.media.model3d.thumbnail.urlExpirationDate' },
276
+ ],
277
+ },
278
+ {
279
+ transformFn: float_2.transformRESTFloatToSDKFloat,
280
+ paths: [
281
+ { path: 'file.media.image.faces.confidence' },
282
+ { path: 'file.media.vector.faces.confidence' },
283
+ ],
284
+ },
285
+ ]),
288
286
  };
289
287
  return metadata;
290
288
  }
291
- __updateFileDescriptor.fromReq = fromReq;
292
289
  return __updateFileDescriptor;
293
290
  }
294
291
  exports.updateFileDescriptor = updateFileDescriptor;
295
292
  /**
296
293
  * Generates an upload URL to allow external clients to upload a file to the Media Manager.
297
294
  *
295
+ * The `generateFileUploadUrl()` function returns a Promise that resolves to an upload URL.
296
+ *
298
297
  * To learn how external clients can use the generated upload URL in the response to upload a file to the Media Manager, see the Upload API article.
299
298
  *
300
- * > **Note:** Any interruption in the upload process stops the file upload. For files larger than 10MB, or when network connection is poor, use the generateFileResumableUploadUrl() instead. With the resumable upload URL, any interruption in the upload process pauses the file upload, and resumes the file upload process after the interruption.
299
+ * > **Note:** Any interruption in the upload process stops the file upload. For files larger than 10MB, or when network connection is poor, use `generateFileResumableUploadUrl()` instead. With the resumable upload URL, any interruption in the upload process pauses the file upload, and resumes the file upload process after the interruption.
301
300
  */
302
301
  function generateFileUploadUrl(payload) {
303
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_generateFileUploadUrlRequest, {});
304
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_generateFileUploadUrlResponse, {});
305
302
  function __generateFileUploadUrl({ host }) {
306
- const serializedData = toReq(payload);
307
303
  const metadata = {
308
304
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
309
305
  method: 'POST',
310
306
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileUploadUrl',
311
307
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
312
308
  protoPath: '/v1/files/generate-upload-url',
313
- data: serializedData,
309
+ data: payload,
314
310
  host,
315
311
  }),
316
- data: serializedData,
317
- transformResponse: fromRes,
312
+ data: payload,
318
313
  };
319
314
  return metadata;
320
315
  }
321
- __generateFileUploadUrl.fromReq = fromReq;
322
316
  return __generateFileUploadUrl;
323
317
  }
324
318
  exports.generateFileUploadUrl = generateFileUploadUrl;
325
319
  /**
326
- * Generates a resumable upload URL to allow external clients to easily upload large files over 10MB to the Media Manager.
320
+ * Generates a resumable upload URL to allow external clients to upload large files over 10MB to the Media Manager.
321
+ *
322
+ * The `generateFileResumableUploadUrl()` function returns a Promise that resolves to an upload URL, token, and protocol.
327
323
  *
328
- * With the resumable upload URL, any interruptions in the upload process pauses the file upload, and resumes the file upload process after the interruption. The resumable upload URL is also helpful when network connection is poor.
324
+ * When using the resumable upload URL, any interruptions will pause the file upload process, which automatically resumes once the interruption is resolved. The resumable upload URL is also helpful when network connection is poor.
329
325
  *
330
326
  * To learn how external clients can use the generated upload URL in the response to upload large files to the Media Manager, see the Resumable Upload API article.
331
327
  */
332
328
  function generateFileResumableUploadUrl(payload) {
333
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_generateFileResumableUploadUrlRequest, {});
334
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_generateFileResumableUploadUrlResponse, {});
335
329
  function __generateFileResumableUploadUrl({ host }) {
336
- const serializedData = toReq(payload);
337
330
  const metadata = {
338
331
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
339
332
  method: 'POST',
340
333
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateFileResumableUploadUrl',
341
334
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
342
335
  protoPath: '/v1/files/generate-resumable-upload-url',
343
- data: serializedData,
336
+ data: payload,
344
337
  host,
345
338
  }),
346
- data: serializedData,
347
- transformResponse: fromRes,
339
+ data: payload,
348
340
  };
349
341
  return metadata;
350
342
  }
351
- __generateFileResumableUploadUrl.fromReq = fromReq;
352
343
  return __generateFileResumableUploadUrl;
353
344
  }
354
345
  exports.generateFileResumableUploadUrl = generateFileResumableUploadUrl;
355
346
  /**
356
- * Imports a file to the Media Manager using an external url.
347
+ * Imports a file to the Media Manager using an external URL.
357
348
  *
358
- * This function returns information about the imported file.
349
+ * The `importFile()` function returns a Promise that resolves to the imported file's descriptor.
350
+ *
351
+ * This function returns information about the imported file. Importing a file is the method through which you can add files to the Media Manager.
359
352
  * Use the `parentFolderId` parameter to specify which folder you want the file to be imported to.
360
353
  * If no folder is specified, the file is imported to the `media-root` folder.
361
354
  *
362
- * To import a file, you need to provide one of the following:
363
- * 1. Pass the file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, `'image/png'`.
364
- * 2. Pass the file's name and extension. For example, `'my-image.png'`.
365
- * 3. If you don't know the file's extension or MIME type, pass its [media type](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes) in the `mediaType` parameter of the request. For example, `'IMAGE'`. Note that this option only works if the server hosting the media allows a 'HEAD' request.
366
- *
367
- * >**Note:** The `media` property isn't returned in the `files` response object.
368
- *
355
+ * To import a file, you need to pass one of the following:
356
+ * - The file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, `'image/png'`.
357
+ * - The file's name and extension. For example, `'my-image.png'`.
358
+ * - If you don't know the file's extension or MIME type, its [media type](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes) in the `mediaType` parameter of the request. For example, `'IMAGE'`. Note that this option only works if the server hosting the media allows a 'HEAD' request.
369
359
  */
370
360
  function importFile(payload) {
371
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_importFileRequest, {});
372
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_importFileResponse, {
373
- _archive,
374
- _audio,
375
- _audioV2,
376
- _document,
377
- _faceRecognition,
378
- _fileDescriptor,
379
- _fileMedia,
380
- _image,
381
- _imageMedia,
382
- _model3D,
383
- _videoResolution,
384
- _videoV2,
385
- });
386
361
  function __importFile({ host }) {
387
- const serializedData = toReq(payload);
388
362
  const metadata = {
389
363
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
390
364
  method: 'POST',
391
365
  methodFqn: 'com.wix.media.site_media.v1.FilesService.ImportFile',
392
366
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
393
367
  protoPath: '/v1/files/import',
394
- data: serializedData,
368
+ data: payload,
395
369
  host,
396
370
  }),
397
- data: serializedData,
398
- transformResponse: fromRes,
371
+ data: payload,
372
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
373
+ {
374
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
375
+ paths: [
376
+ { path: 'file.createdDate' },
377
+ { path: 'file.updatedDate' },
378
+ { path: 'file.media.image.image.urlExpirationDate' },
379
+ { path: 'file.media.image.previewImage.urlExpirationDate' },
380
+ { path: 'file.media.video.urlExpirationDate' },
381
+ { path: 'file.media.video.resolutions.urlExpirationDate' },
382
+ { path: 'file.media.video.resolutions.poster.urlExpirationDate' },
383
+ { path: 'file.media.video.posters.urlExpirationDate' },
384
+ { path: 'file.media.audio.assets.urlExpirationDate' },
385
+ { path: 'file.media.document.urlExpirationDate' },
386
+ { path: 'file.media.vector.image.urlExpirationDate' },
387
+ { path: 'file.media.vector.previewImage.urlExpirationDate' },
388
+ { path: 'file.media.archive.urlExpirationDate' },
389
+ { path: 'file.media.model3d.urlExpirationDate' },
390
+ { path: 'file.media.model3d.thumbnail.urlExpirationDate' },
391
+ ],
392
+ },
393
+ {
394
+ transformFn: float_2.transformRESTFloatToSDKFloat,
395
+ paths: [
396
+ { path: 'file.media.image.faces.confidence' },
397
+ { path: 'file.media.vector.faces.confidence' },
398
+ ],
399
+ },
400
+ ]),
399
401
  };
400
402
  return metadata;
401
403
  }
402
- __importFile.fromReq = fromReq;
403
404
  return __importFile;
404
405
  }
405
406
  exports.importFile = importFile;
@@ -408,207 +409,276 @@ exports.importFile = importFile;
408
409
  * > This function has been replaced with `bulkImportFile()`, and will be removed on March 31, 2024.
409
410
  *
410
411
  *
412
+ * The `bulkImportFiles()` function returns a Promise that resolves to an array of the imported files' descriptors.
413
+ *
411
414
  * Imports a bulk of files to the Media Manager using external urls.
412
415
  *
413
416
  * Returns information about the imported files. Use the `parentFolderId` parameter to specify in which folder you want each file to be imported.
414
417
  * If no folder is specified, the file is imported to the `media-root` folder.
415
418
  *
416
- * To import files, you need to provide one of the following:
417
- * 1. Pass each file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, `'image/png'`.
418
- * 2. Pass each file's name and extension. For example, `'my-image.png'`.
419
- * 3. If you don't know a file's extension or MIME type, pass its [media type](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes) in the `mediaType` parameter of the request. For example, `'IMAGE'`. Note that this option only works if the server hosting the media allows a 'HEAD' request.
419
+ * To import a file, you need to pass one of the following:
420
+ * - The file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, `'image/png'`.
421
+ * - The file's name and extension. For example, `'my-image.png'`.
422
+ * - If you don't know the file's extension or MIME type, its [media type](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes) in the `mediaType` parameter of the request. For example, `'IMAGE'`. Note that this option only works if the server hosting the media allows a 'HEAD' request.
420
423
  *
421
424
  * >**Note:** The `media` property isn't returned in the `files` response object.
422
425
  */
423
426
  function bulkImportFiles(payload) {
424
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_bulkImportFilesRequest, { _importFileRequest });
425
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_bulkImportFilesResponse, {
426
- _archive,
427
- _audio,
428
- _audioV2,
429
- _document,
430
- _faceRecognition,
431
- _fileDescriptor,
432
- _fileMedia,
433
- _image,
434
- _imageMedia,
435
- _model3D,
436
- _videoResolution,
437
- _videoV2,
438
- });
439
427
  function __bulkImportFiles({ host }) {
440
- const serializedData = toReq(payload);
441
428
  const metadata = {
442
429
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
443
430
  method: 'POST',
444
431
  methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkImportFiles',
445
432
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
446
433
  protoPath: '/v1/bulk/files/import',
447
- data: serializedData,
434
+ data: payload,
448
435
  host,
449
436
  }),
450
- data: serializedData,
451
- transformResponse: fromRes,
437
+ data: payload,
438
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
439
+ {
440
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
441
+ paths: [
442
+ { path: 'files.createdDate' },
443
+ { path: 'files.updatedDate' },
444
+ { path: 'files.media.image.image.urlExpirationDate' },
445
+ { path: 'files.media.image.previewImage.urlExpirationDate' },
446
+ { path: 'files.media.video.urlExpirationDate' },
447
+ { path: 'files.media.video.resolutions.urlExpirationDate' },
448
+ {
449
+ path: 'files.media.video.resolutions.poster.urlExpirationDate',
450
+ },
451
+ { path: 'files.media.video.posters.urlExpirationDate' },
452
+ { path: 'files.media.audio.assets.urlExpirationDate' },
453
+ { path: 'files.media.document.urlExpirationDate' },
454
+ { path: 'files.media.vector.image.urlExpirationDate' },
455
+ { path: 'files.media.vector.previewImage.urlExpirationDate' },
456
+ { path: 'files.media.archive.urlExpirationDate' },
457
+ { path: 'files.media.model3d.urlExpirationDate' },
458
+ { path: 'files.media.model3d.thumbnail.urlExpirationDate' },
459
+ ],
460
+ },
461
+ {
462
+ transformFn: float_2.transformRESTFloatToSDKFloat,
463
+ paths: [
464
+ { path: 'files.media.image.faces.confidence' },
465
+ { path: 'files.media.vector.faces.confidence' },
466
+ ],
467
+ },
468
+ ]),
452
469
  };
453
470
  return metadata;
454
471
  }
455
- __bulkImportFiles.fromReq = fromReq;
456
472
  return __bulkImportFiles;
457
473
  }
458
474
  exports.bulkImportFiles = bulkImportFiles;
459
475
  /**
460
- * Imports a bulk of files to the Media Manager using external urls. <br/>
476
+ * Imports a bulk of files to the Media Manager using external urls.
461
477
  *
462
- * Returns information about the imported files. Use the `parentFolderId` parameter to specify in which folder you want each file to be imported to.
463
- * If no folder is specified, the file is imported to the `media-root` folder.
478
+ * The `bulkImportFile()` function returns a Promise that resolves to an object containing bulk import metadata and an array of imported files' descriptors and metadata.
464
479
  *
465
- * To import files, you need to provide one of the following:
466
- * 1. Pass each file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, 'image/png'.
467
- * 2. Pass each file's name and extension. For example, 'my-image.png'.
468
- * 3. If you don't know a file's extension or MIME type, pass its media type in the `mediaType` parameter of the request. For example, 'IMAGE'. Note that this option only works if the server hosting the media allows a 'HEAD' request.
480
+ * Returns information about the imported files. Use the `parentFolderId` parameter to specify in which folder you want each file to be imported.
481
+ * If no folder is specified, the file is imported to the `media-root` folder.
469
482
  *
470
- * >**Note:** The `media` property isn't returned in the `files` response object.
483
+ * To import a file, you need to pass one of the following:
484
+ * - The file's [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` parameter of the request. For example, `'image/png'`.
485
+ * - The file's name and extension. For example, `'my-image.png'`.
486
+ * - If you don't know the file's extension or MIME type, its [media type](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes) in the `mediaType` parameter of the request. For example, `'IMAGE'`. Note that this option only works if the server hosting the media allows a 'HEAD' request.
471
487
  */
472
488
  function bulkImportFile(payload) {
473
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_bulkImportFileRequest, { _importFileRequest });
474
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_bulkImportFileResponse, {
475
- _archive,
476
- _audio,
477
- _audioV2,
478
- _bulkImportFileResult,
479
- _document,
480
- _faceRecognition,
481
- _fileDescriptor,
482
- _fileMedia,
483
- _image,
484
- _imageMedia,
485
- _model3D,
486
- _videoResolution,
487
- _videoV2,
488
- });
489
489
  function __bulkImportFile({ host }) {
490
- const serializedData = toReq(payload);
491
490
  const metadata = {
492
491
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
493
492
  method: 'POST',
494
493
  methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkImportFile',
495
494
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
496
495
  protoPath: '/v1/bulk/files/import-v2',
497
- data: serializedData,
496
+ data: payload,
498
497
  host,
499
498
  }),
500
- data: serializedData,
501
- transformResponse: fromRes,
499
+ data: payload,
500
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
501
+ {
502
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
503
+ paths: [
504
+ { path: 'results.item.createdDate' },
505
+ { path: 'results.item.updatedDate' },
506
+ { path: 'results.item.media.image.image.urlExpirationDate' },
507
+ {
508
+ path: 'results.item.media.image.previewImage.urlExpirationDate',
509
+ },
510
+ { path: 'results.item.media.video.urlExpirationDate' },
511
+ {
512
+ path: 'results.item.media.video.resolutions.urlExpirationDate',
513
+ },
514
+ {
515
+ path: 'results.item.media.video.resolutions.poster.urlExpirationDate',
516
+ },
517
+ { path: 'results.item.media.video.posters.urlExpirationDate' },
518
+ { path: 'results.item.media.audio.assets.urlExpirationDate' },
519
+ { path: 'results.item.media.document.urlExpirationDate' },
520
+ { path: 'results.item.media.vector.image.urlExpirationDate' },
521
+ {
522
+ path: 'results.item.media.vector.previewImage.urlExpirationDate',
523
+ },
524
+ { path: 'results.item.media.archive.urlExpirationDate' },
525
+ { path: 'results.item.media.model3d.urlExpirationDate' },
526
+ {
527
+ path: 'results.item.media.model3d.thumbnail.urlExpirationDate',
528
+ },
529
+ ],
530
+ },
531
+ {
532
+ transformFn: float_2.transformRESTFloatToSDKFloat,
533
+ paths: [
534
+ { path: 'results.item.media.image.faces.confidence' },
535
+ { path: 'results.item.media.vector.faces.confidence' },
536
+ ],
537
+ },
538
+ ]),
502
539
  };
503
540
  return metadata;
504
541
  }
505
- __bulkImportFile.fromReq = fromReq;
506
542
  return __bulkImportFile;
507
543
  }
508
544
  exports.bulkImportFile = bulkImportFile;
509
545
  /**
510
546
  * Retrieves a list of files in the Media Manager.
511
547
  *
548
+ * The `listFiles()` function returns a Promise that resolves to an array of the specified files' descriptors and cursor information.
549
+ *
512
550
  * To retrieve a list of files within a specific folder in the Media Manager, pass the folder's ID in the `parentFolderId` parameter. If no folder is specified, the endpoint retrieves only the list of files in the root folder of the Media Manager.
551
+ *
552
+ * To retrieve a list of (non-permanently) deleted files, use the `listDeletedFiles()` function.
513
553
  */
514
554
  function listFiles(payload) {
515
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_listFilesRequest, {});
516
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_listFilesResponse, {
517
- _archive,
518
- _audio,
519
- _audioV2,
520
- _document,
521
- _faceRecognition,
522
- _fileDescriptor,
523
- _fileMedia,
524
- _image,
525
- _imageMedia,
526
- _model3D,
527
- _videoResolution,
528
- _videoV2,
529
- });
530
555
  function __listFiles({ host }) {
531
- const serializedData = toReq(payload);
532
556
  const metadata = {
533
557
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
534
558
  method: 'GET',
535
559
  methodFqn: 'com.wix.media.site_media.v1.FilesService.ListFiles',
536
560
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
537
561
  protoPath: '/v1/files',
538
- data: serializedData,
562
+ data: payload,
539
563
  host,
540
564
  }),
541
- params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
542
- transformResponse: fromRes,
565
+ params: (0, metro_runtime_1.toURLSearchParams)(payload),
566
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
567
+ {
568
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
569
+ paths: [
570
+ { path: 'files.createdDate' },
571
+ { path: 'files.updatedDate' },
572
+ { path: 'files.media.image.image.urlExpirationDate' },
573
+ { path: 'files.media.image.previewImage.urlExpirationDate' },
574
+ { path: 'files.media.video.urlExpirationDate' },
575
+ { path: 'files.media.video.resolutions.urlExpirationDate' },
576
+ {
577
+ path: 'files.media.video.resolutions.poster.urlExpirationDate',
578
+ },
579
+ { path: 'files.media.video.posters.urlExpirationDate' },
580
+ { path: 'files.media.audio.assets.urlExpirationDate' },
581
+ { path: 'files.media.document.urlExpirationDate' },
582
+ { path: 'files.media.vector.image.urlExpirationDate' },
583
+ { path: 'files.media.vector.previewImage.urlExpirationDate' },
584
+ { path: 'files.media.archive.urlExpirationDate' },
585
+ { path: 'files.media.model3d.urlExpirationDate' },
586
+ { path: 'files.media.model3d.thumbnail.urlExpirationDate' },
587
+ ],
588
+ },
589
+ {
590
+ transformFn: float_2.transformRESTFloatToSDKFloat,
591
+ paths: [
592
+ { path: 'files.media.image.faces.confidence' },
593
+ { path: 'files.media.vector.faces.confidence' },
594
+ ],
595
+ },
596
+ ]),
543
597
  };
544
598
  return metadata;
545
599
  }
546
- __listFiles.fromReq = fromReq;
547
600
  return __listFiles;
548
601
  }
549
602
  exports.listFiles = listFiles;
550
603
  /**
551
604
  * Searches all folders in the Media Manager and returns a list of files that match the terms specified in the optional parameters.
552
605
  *
553
- * If no parameters are specified, the endpoint returns all files in the `MEDIA_ROOT` folder.
606
+ * The `searchFiles()` function returns a Promise that resolves to an array of the specified files' descriptors and cursor information.
607
+ *
608
+ * If no parameters are specified, the function returns all files in the `MEDIA_ROOT` folder.
554
609
  */
555
610
  function searchFiles(payload) {
556
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_searchFilesRequest, {});
557
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_searchFilesResponse, {
558
- _archive,
559
- _audio,
560
- _audioV2,
561
- _document,
562
- _faceRecognition,
563
- _fileDescriptor,
564
- _fileMedia,
565
- _image,
566
- _imageMedia,
567
- _model3D,
568
- _videoResolution,
569
- _videoV2,
570
- });
571
611
  function __searchFiles({ host }) {
572
- const serializedData = toReq(payload);
573
612
  const metadata = {
574
613
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
575
614
  method: 'POST',
576
615
  methodFqn: 'com.wix.media.site_media.v1.FilesService.SearchFiles',
577
616
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
578
617
  protoPath: '/v1/files/search',
579
- data: serializedData,
618
+ data: payload,
580
619
  host,
581
620
  }),
582
- data: serializedData,
583
- transformResponse: fromRes,
621
+ data: payload,
622
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
623
+ {
624
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
625
+ paths: [
626
+ { path: 'files.createdDate' },
627
+ { path: 'files.updatedDate' },
628
+ { path: 'files.media.image.image.urlExpirationDate' },
629
+ { path: 'files.media.image.previewImage.urlExpirationDate' },
630
+ { path: 'files.media.video.urlExpirationDate' },
631
+ { path: 'files.media.video.resolutions.urlExpirationDate' },
632
+ {
633
+ path: 'files.media.video.resolutions.poster.urlExpirationDate',
634
+ },
635
+ { path: 'files.media.video.posters.urlExpirationDate' },
636
+ { path: 'files.media.audio.assets.urlExpirationDate' },
637
+ { path: 'files.media.document.urlExpirationDate' },
638
+ { path: 'files.media.vector.image.urlExpirationDate' },
639
+ { path: 'files.media.vector.previewImage.urlExpirationDate' },
640
+ { path: 'files.media.archive.urlExpirationDate' },
641
+ { path: 'files.media.model3d.urlExpirationDate' },
642
+ { path: 'files.media.model3d.thumbnail.urlExpirationDate' },
643
+ ],
644
+ },
645
+ {
646
+ transformFn: float_2.transformRESTFloatToSDKFloat,
647
+ paths: [
648
+ { path: 'files.media.image.faces.confidence' },
649
+ { path: 'files.media.vector.faces.confidence' },
650
+ ],
651
+ },
652
+ ]),
584
653
  };
585
654
  return metadata;
586
655
  }
587
- __searchFiles.fromReq = fromReq;
588
656
  return __searchFiles;
589
657
  }
590
658
  exports.searchFiles = searchFiles;
591
- /** Generates a URL for streaming a specific video file in the Media Manager. */
659
+ /**
660
+ * Generates a URL for streaming a specific video file in the Media Manager.
661
+ *
662
+ *
663
+ * The `generateVideoStreamingUrl()` function returns a Promise that resolves to a download URL and its asset key.
664
+ *
665
+ * To stream different assets of the file, use the `assetKeys` parameter which generates a video streaming URL for each asset. If no asset key is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
666
+ */
592
667
  function generateVideoStreamingUrl(payload) {
593
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_generateVideoStreamingUrlRequest, {});
594
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_generateVideoStreamingUrlResponse, {});
595
668
  function __generateVideoStreamingUrl({ host }) {
596
- const serializedData = toReq(payload);
597
669
  const metadata = {
598
670
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
599
671
  method: 'POST',
600
672
  methodFqn: 'com.wix.media.site_media.v1.FilesService.GenerateVideoStreamingUrl',
601
673
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
602
674
  protoPath: '/v1/files/video/{fileId}/generate-stream-url',
603
- data: serializedData,
675
+ data: payload,
604
676
  host,
605
677
  }),
606
- data: serializedData,
607
- transformResponse: fromRes,
678
+ data: payload,
608
679
  };
609
680
  return metadata;
610
681
  }
611
- __generateVideoStreamingUrl.fromReq = fromReq;
612
682
  return __generateVideoStreamingUrl;
613
683
  }
614
684
  exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
@@ -616,7 +686,9 @@ exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
616
686
  * Deletes the specified files from the Media Manager.
617
687
  *
618
688
  *
619
- * The deleted files are moved to the Media Manager's trash bin (`TRASH-ROOT` folder) unless permanently deleted. To permanently delete files, pass the `permanent` parameter with the value `true`. Permanently deleting files isn't reversible, so make sure that these files aren't being used in a site or in any other way as the files will no longer be accessible.
689
+ * The `bulkDeleteFiles()` function returns a Promise that resolves when the files are deleted.
690
+ *
691
+ * The deleted files are moved to the Media Manager's trash bin (`TRASH_ROOT` folder) unless permanently deleted. To permanently delete files, pass the `permanent` parameter with the value `true`. Permanently deleting files isn't reversible, so make sure that these files aren't being used in a site or in any other way as the files will no longer be accessible.
620
692
  *
621
693
  * >**Notes:**
622
694
  * > - The specified files can be from different folders.
@@ -626,90 +698,101 @@ exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
626
698
  * > - You can use `bulkRestoreFilesFromTrashBin()` to restore files from the Media Manager's trash bin.
627
699
  */
628
700
  function bulkDeleteFiles(payload) {
629
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_bulkDeleteFilesRequest, {});
630
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_bulkDeleteFilesResponse, {});
631
701
  function __bulkDeleteFiles({ host }) {
632
- const serializedData = toReq(payload);
633
702
  const metadata = {
634
703
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
635
704
  method: 'POST',
636
705
  methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkDeleteFiles',
637
706
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
638
707
  protoPath: '/v1/bulk/files/delete',
639
- data: serializedData,
708
+ data: payload,
640
709
  host,
641
710
  }),
642
- data: serializedData,
643
- transformResponse: fromRes,
711
+ data: payload,
644
712
  };
645
713
  return metadata;
646
714
  }
647
- __bulkDeleteFiles.fromReq = fromReq;
648
715
  return __bulkDeleteFiles;
649
716
  }
650
717
  exports.bulkDeleteFiles = bulkDeleteFiles;
651
- /** Restores the specified files from the Media Manager's trash bin, and moves them to their original locations in the Media Manager. */
718
+ /**
719
+ * Restores the specified files from the Media Manager's trash bin, and moves them to their original locations in the Media Manager.
720
+ *
721
+ * The `bulkRestoreFilesFromTrashBin()` function returns a Promise that resolves when the files have been restored.
722
+ */
652
723
  function bulkRestoreFilesFromTrashBin(payload) {
653
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_bulkRestoreFilesFromTrashBinRequest, {});
654
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_bulkRestoreFilesFromTrashBinResponse, {});
655
724
  function __bulkRestoreFilesFromTrashBin({ host }) {
656
- const serializedData = toReq(payload);
657
725
  const metadata = {
658
726
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
659
727
  method: 'POST',
660
728
  methodFqn: 'com.wix.media.site_media.v1.FilesService.BulkRestoreFilesFromTrashBin',
661
729
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
662
730
  protoPath: '/v1/bulk/trash-bin/files/restore',
663
- data: serializedData,
731
+ data: payload,
664
732
  host,
665
733
  }),
666
- data: serializedData,
667
- transformResponse: fromRes,
734
+ data: payload,
668
735
  };
669
736
  return metadata;
670
737
  }
671
- __bulkRestoreFilesFromTrashBin.fromReq = fromReq;
672
738
  return __bulkRestoreFilesFromTrashBin;
673
739
  }
674
740
  exports.bulkRestoreFilesFromTrashBin = bulkRestoreFilesFromTrashBin;
675
741
  /**
676
742
  * Retrieves a list of files in the Media Manager's trash bin.
677
743
  *
678
- * >**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
744
+ * The `listDeletedFiles()` function returns a Promise that resolves to an array of the specified deleted files' descriptors and cursor information.
745
+ *
746
+ * >**Note:** The Media Manager's trash bin (`TRASH_ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
747
+ *
748
+ * To retrieve a list of non-deleted files, use the `listFiles()` function.
679
749
  */
680
750
  function listDeletedFiles(payload) {
681
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_listDeletedFilesRequest, {});
682
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_listDeletedFilesResponse, {
683
- _archive,
684
- _audio,
685
- _audioV2,
686
- _document,
687
- _faceRecognition,
688
- _fileDescriptor,
689
- _fileMedia,
690
- _image,
691
- _imageMedia,
692
- _model3D,
693
- _videoResolution,
694
- _videoV2,
695
- });
696
751
  function __listDeletedFiles({ host }) {
697
- const serializedData = toReq(payload);
698
752
  const metadata = {
699
753
  entityFqdn: 'wix.media.site_media.v1.file_descriptor',
700
754
  method: 'GET',
701
755
  methodFqn: 'com.wix.media.site_media.v1.FilesService.ListDeletedFiles',
702
756
  url: resolveComWixMediaSiteMediaV1FilesServiceUrl({
703
757
  protoPath: '/v1/trash-bin/files',
704
- data: serializedData,
758
+ data: payload,
705
759
  host,
706
760
  }),
707
- params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
708
- transformResponse: fromRes,
761
+ params: (0, metro_runtime_1.toURLSearchParams)(payload),
762
+ transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
763
+ {
764
+ transformFn: timestamp_2.transformRESTTimestampToSDKTimestamp,
765
+ paths: [
766
+ { path: 'files.createdDate' },
767
+ { path: 'files.updatedDate' },
768
+ { path: 'files.media.image.image.urlExpirationDate' },
769
+ { path: 'files.media.image.previewImage.urlExpirationDate' },
770
+ { path: 'files.media.video.urlExpirationDate' },
771
+ { path: 'files.media.video.resolutions.urlExpirationDate' },
772
+ {
773
+ path: 'files.media.video.resolutions.poster.urlExpirationDate',
774
+ },
775
+ { path: 'files.media.video.posters.urlExpirationDate' },
776
+ { path: 'files.media.audio.assets.urlExpirationDate' },
777
+ { path: 'files.media.document.urlExpirationDate' },
778
+ { path: 'files.media.vector.image.urlExpirationDate' },
779
+ { path: 'files.media.vector.previewImage.urlExpirationDate' },
780
+ { path: 'files.media.archive.urlExpirationDate' },
781
+ { path: 'files.media.model3d.urlExpirationDate' },
782
+ { path: 'files.media.model3d.thumbnail.urlExpirationDate' },
783
+ ],
784
+ },
785
+ {
786
+ transformFn: float_2.transformRESTFloatToSDKFloat,
787
+ paths: [
788
+ { path: 'files.media.image.faces.confidence' },
789
+ { path: 'files.media.vector.faces.confidence' },
790
+ ],
791
+ },
792
+ ]),
709
793
  };
710
794
  return metadata;
711
795
  }
712
- __listDeletedFiles.fromReq = fromReq;
713
796
  return __listDeletedFiles;
714
797
  }
715
798
  exports.listDeletedFiles = listDeletedFiles;