@wix/auto_sdk_media_files 1.0.17 → 1.0.19

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 (119) hide show
  1. package/build/cjs/index.d.ts +295 -1
  2. package/build/cjs/index.js +2264 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/{es/src/media-site-media-v1-file-descriptor-files.types.d.ts → cjs/media-site-media-v1-file-descriptor-files.universal-C5dCrbUZ.d.ts} +457 -220
  5. package/build/cjs/meta.d.ts +1052 -1
  6. package/build/cjs/meta.js +1326 -15
  7. package/build/cjs/meta.js.map +1 -1
  8. package/build/{cjs/src/media-site-media-v1-file-descriptor-files.public.d.ts → es/index.d.mts} +63 -26
  9. package/build/es/index.mjs +2212 -0
  10. package/build/es/index.mjs.map +1 -0
  11. package/build/{cjs/src/media-site-media-v1-file-descriptor-files.types.d.ts → es/media-site-media-v1-file-descriptor-files.universal-C5dCrbUZ.d.mts} +457 -220
  12. package/build/es/meta.d.mts +1052 -0
  13. package/build/es/meta.mjs +1287 -0
  14. package/build/es/meta.mjs.map +1 -0
  15. package/build/internal/cjs/index.d.ts +295 -1
  16. package/build/internal/cjs/index.js +2264 -15
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/internal/cjs/{src/media-site-media-v1-file-descriptor-files.types.d.ts → media-site-media-v1-file-descriptor-files.universal-C5dCrbUZ.d.ts} +457 -220
  19. package/build/internal/cjs/meta.d.ts +1052 -1
  20. package/build/internal/cjs/meta.js +1326 -15
  21. package/build/internal/cjs/meta.js.map +1 -1
  22. package/build/internal/{cjs/src/media-site-media-v1-file-descriptor-files.public.d.ts → es/index.d.mts} +63 -26
  23. package/build/internal/es/index.mjs +2212 -0
  24. package/build/internal/es/index.mjs.map +1 -0
  25. package/build/internal/es/{src/media-site-media-v1-file-descriptor-files.types.d.ts → media-site-media-v1-file-descriptor-files.universal-C5dCrbUZ.d.mts} +457 -220
  26. package/build/internal/es/meta.d.mts +1052 -0
  27. package/build/internal/es/meta.mjs +1287 -0
  28. package/build/internal/es/meta.mjs.map +1 -0
  29. package/package.json +10 -9
  30. package/build/cjs/index.typings.d.ts +0 -1
  31. package/build/cjs/index.typings.js +0 -18
  32. package/build/cjs/index.typings.js.map +0 -1
  33. package/build/cjs/src/media-site-media-v1-file-descriptor-files.context.d.ts +0 -45
  34. package/build/cjs/src/media-site-media-v1-file-descriptor-files.context.js +0 -60
  35. package/build/cjs/src/media-site-media-v1-file-descriptor-files.context.js.map +0 -1
  36. package/build/cjs/src/media-site-media-v1-file-descriptor-files.http.d.ts +0 -148
  37. package/build/cjs/src/media-site-media-v1-file-descriptor-files.http.js +0 -1118
  38. package/build/cjs/src/media-site-media-v1-file-descriptor-files.http.js.map +0 -1
  39. package/build/cjs/src/media-site-media-v1-file-descriptor-files.meta.d.ts +0 -28
  40. package/build/cjs/src/media-site-media-v1-file-descriptor-files.meta.js +0 -332
  41. package/build/cjs/src/media-site-media-v1-file-descriptor-files.meta.js.map +0 -1
  42. package/build/cjs/src/media-site-media-v1-file-descriptor-files.public.js +0 -265
  43. package/build/cjs/src/media-site-media-v1-file-descriptor-files.public.js.map +0 -1
  44. package/build/cjs/src/media-site-media-v1-file-descriptor-files.types.js +0 -119
  45. package/build/cjs/src/media-site-media-v1-file-descriptor-files.types.js.map +0 -1
  46. package/build/cjs/src/media-site-media-v1-file-descriptor-files.universal.d.ts +0 -2486
  47. package/build/cjs/src/media-site-media-v1-file-descriptor-files.universal.js +0 -1451
  48. package/build/cjs/src/media-site-media-v1-file-descriptor-files.universal.js.map +0 -1
  49. package/build/es/index.d.ts +0 -1
  50. package/build/es/index.js +0 -2
  51. package/build/es/index.js.map +0 -1
  52. package/build/es/index.typings.d.ts +0 -1
  53. package/build/es/index.typings.js +0 -2
  54. package/build/es/index.typings.js.map +0 -1
  55. package/build/es/meta.d.ts +0 -1
  56. package/build/es/meta.js +0 -2
  57. package/build/es/meta.js.map +0 -1
  58. package/build/es/src/media-site-media-v1-file-descriptor-files.context.d.ts +0 -45
  59. package/build/es/src/media-site-media-v1-file-descriptor-files.context.js +0 -45
  60. package/build/es/src/media-site-media-v1-file-descriptor-files.context.js.map +0 -1
  61. package/build/es/src/media-site-media-v1-file-descriptor-files.http.d.ts +0 -148
  62. package/build/es/src/media-site-media-v1-file-descriptor-files.http.js +0 -1099
  63. package/build/es/src/media-site-media-v1-file-descriptor-files.http.js.map +0 -1
  64. package/build/es/src/media-site-media-v1-file-descriptor-files.meta.d.ts +0 -28
  65. package/build/es/src/media-site-media-v1-file-descriptor-files.meta.js +0 -290
  66. package/build/es/src/media-site-media-v1-file-descriptor-files.meta.js.map +0 -1
  67. package/build/es/src/media-site-media-v1-file-descriptor-files.public.d.ts +0 -258
  68. package/build/es/src/media-site-media-v1-file-descriptor-files.public.js +0 -234
  69. package/build/es/src/media-site-media-v1-file-descriptor-files.public.js.map +0 -1
  70. package/build/es/src/media-site-media-v1-file-descriptor-files.types.js +0 -116
  71. package/build/es/src/media-site-media-v1-file-descriptor-files.types.js.map +0 -1
  72. package/build/es/src/media-site-media-v1-file-descriptor-files.universal.d.ts +0 -2486
  73. package/build/es/src/media-site-media-v1-file-descriptor-files.universal.js +0 -1409
  74. package/build/es/src/media-site-media-v1-file-descriptor-files.universal.js.map +0 -1
  75. package/build/internal/cjs/index.typings.d.ts +0 -1
  76. package/build/internal/cjs/index.typings.js +0 -18
  77. package/build/internal/cjs/index.typings.js.map +0 -1
  78. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.context.d.ts +0 -45
  79. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.context.js +0 -60
  80. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.context.js.map +0 -1
  81. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.http.d.ts +0 -148
  82. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.http.js +0 -1118
  83. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.http.js.map +0 -1
  84. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.meta.d.ts +0 -28
  85. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.meta.js +0 -332
  86. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.meta.js.map +0 -1
  87. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.public.js +0 -265
  88. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.public.js.map +0 -1
  89. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.types.js +0 -119
  90. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.types.js.map +0 -1
  91. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.universal.d.ts +0 -2486
  92. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.universal.js +0 -1451
  93. package/build/internal/cjs/src/media-site-media-v1-file-descriptor-files.universal.js.map +0 -1
  94. package/build/internal/es/index.d.ts +0 -1
  95. package/build/internal/es/index.js +0 -2
  96. package/build/internal/es/index.js.map +0 -1
  97. package/build/internal/es/index.typings.d.ts +0 -1
  98. package/build/internal/es/index.typings.js +0 -2
  99. package/build/internal/es/index.typings.js.map +0 -1
  100. package/build/internal/es/meta.d.ts +0 -1
  101. package/build/internal/es/meta.js +0 -2
  102. package/build/internal/es/meta.js.map +0 -1
  103. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.context.d.ts +0 -45
  104. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.context.js +0 -45
  105. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.context.js.map +0 -1
  106. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.http.d.ts +0 -148
  107. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.http.js +0 -1099
  108. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.http.js.map +0 -1
  109. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.meta.d.ts +0 -28
  110. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.meta.js +0 -290
  111. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.meta.js.map +0 -1
  112. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.public.d.ts +0 -258
  113. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.public.js +0 -234
  114. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.public.js.map +0 -1
  115. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.types.js +0 -116
  116. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.types.js.map +0 -1
  117. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.universal.d.ts +0 -2486
  118. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.universal.js +0 -1409
  119. package/build/internal/es/src/media-site-media-v1-file-descriptor-files.universal.js.map +0 -1
@@ -1,1451 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- 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 = exports.WebhookIdentityType = exports.StreamFormat = exports.RootFolder = exports.SortOrder = exports.UploadProtocol = exports.ContentDisposition = exports.ImageAnnotationType = exports.IdentityType = exports.Namespace = exports.State = exports.OperationStatus = exports.MediaType = void 0;
27
- const transform_error_1 = require("@wix/sdk-runtime/transform-error");
28
- const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
29
- const ambassadorWixMediaSiteMediaV1FileDescriptor = __importStar(require("./media-site-media-v1-file-descriptor-files.http.js"));
30
- const audio_1 = require("@wix/sdk-runtime/transformations/audio");
31
- const audio_2 = require("@wix/sdk-runtime/transformations/audio");
32
- const image_1 = require("@wix/sdk-runtime/transformations/image");
33
- const image_2 = require("@wix/sdk-runtime/transformations/image");
34
- const video_v2_1 = require("@wix/sdk-runtime/transformations/video-v2");
35
- const video_v2_2 = require("@wix/sdk-runtime/transformations/video-v2");
36
- const document_1 = require("@wix/sdk-runtime/transformations/document");
37
- const document_2 = require("@wix/sdk-runtime/transformations/document");
38
- const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
39
- var MediaType;
40
- (function (MediaType) {
41
- MediaType["UNKNOWN"] = "UNKNOWN";
42
- MediaType["IMAGE"] = "IMAGE";
43
- MediaType["VIDEO"] = "VIDEO";
44
- MediaType["AUDIO"] = "AUDIO";
45
- MediaType["DOCUMENT"] = "DOCUMENT";
46
- MediaType["VECTOR"] = "VECTOR";
47
- MediaType["ARCHIVE"] = "ARCHIVE";
48
- MediaType["MODEL3D"] = "MODEL3D";
49
- MediaType["OTHER"] = "OTHER";
50
- })(MediaType || (exports.MediaType = MediaType = {}));
51
- var OperationStatus;
52
- (function (OperationStatus) {
53
- /** File upload or processing failed */
54
- OperationStatus["FAILED"] = "FAILED";
55
- /** File is ready for consumption */
56
- OperationStatus["READY"] = "READY";
57
- /** File is waiting for processing or currently being processed */
58
- OperationStatus["PENDING"] = "PENDING";
59
- })(OperationStatus || (exports.OperationStatus = OperationStatus = {}));
60
- var State;
61
- (function (State) {
62
- /** File is ready for consumption */
63
- State["OK"] = "OK";
64
- /** Deleted file */
65
- State["DELETED"] = "DELETED";
66
- })(State || (exports.State = State = {}));
67
- var Namespace;
68
- (function (Namespace) {
69
- Namespace["NO_NAMESPACE"] = "NO_NAMESPACE";
70
- Namespace["OTHERS"] = "OTHERS";
71
- /** ANY = 2; */
72
- Namespace["WIX_VIDEO"] = "WIX_VIDEO";
73
- /** _nsWixMusic */
74
- Namespace["WIX_MUSIC"] = "WIX_MUSIC";
75
- /** _nsArtStore */
76
- Namespace["ALBUMS_AND_ART_STORE"] = "ALBUMS_AND_ART_STORE";
77
- /** _nsDigitalProduct */
78
- Namespace["WIX_ECOM"] = "WIX_ECOM";
79
- /** _nsPhotoShareApp */
80
- Namespace["PHOTO_SHARE_APP"] = "PHOTO_SHARE_APP";
81
- /** _nsSharingApp, */
82
- Namespace["SHARING_APP"] = "SHARING_APP";
83
- /** engage */
84
- Namespace["CHAT"] = "CHAT";
85
- /** logobuilder */
86
- Namespace["LOGO_BUILDER"] = "LOGO_BUILDER";
87
- /** WixExposure */
88
- Namespace["ALBUMS_OLD"] = "ALBUMS_OLD";
89
- /** chat-mobile-uploads */
90
- Namespace["CHAT_MOBILE"] = "CHAT_MOBILE";
91
- /** _nsWixForms */
92
- Namespace["WIX_FORMS"] = "WIX_FORMS";
93
- /** _nsWixLegends */
94
- Namespace["WIX_LEGENDS"] = "WIX_LEGENDS";
95
- })(Namespace || (exports.Namespace = Namespace = {}));
96
- var IdentityType;
97
- (function (IdentityType) {
98
- IdentityType["UNKNOWN"] = "UNKNOWN";
99
- IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
100
- IdentityType["MEMBER"] = "MEMBER";
101
- IdentityType["WIX_USER"] = "WIX_USER";
102
- IdentityType["APP"] = "APP";
103
- })(IdentityType || (exports.IdentityType = IdentityType = {}));
104
- var ImageAnnotationType;
105
- (function (ImageAnnotationType) {
106
- ImageAnnotationType["UNKNOWN_IMAGE_ANNOTATION_TYPE"] = "UNKNOWN_IMAGE_ANNOTATION_TYPE";
107
- ImageAnnotationType["CONTAINS_TEXT"] = "CONTAINS_TEXT";
108
- ImageAnnotationType["IS_ANIMATED"] = "IS_ANIMATED";
109
- ImageAnnotationType["FACES"] = "FACES";
110
- ImageAnnotationType["LABELS"] = "LABELS";
111
- ImageAnnotationType["COLORS"] = "COLORS";
112
- ImageAnnotationType["CAPTION"] = "CAPTION";
113
- })(ImageAnnotationType || (exports.ImageAnnotationType = ImageAnnotationType = {}));
114
- var ContentDisposition;
115
- (function (ContentDisposition) {
116
- /** Using the link in the browser will download the file */
117
- ContentDisposition["ATTACHMENT"] = "ATTACHMENT";
118
- /** Using the link in the browser will open the file in the browser */
119
- ContentDisposition["INLINE"] = "INLINE";
120
- })(ContentDisposition || (exports.ContentDisposition = ContentDisposition = {}));
121
- var UploadProtocol;
122
- (function (UploadProtocol) {
123
- /** The upload protocol to use for implementing the resumable upload. */
124
- UploadProtocol["TUS"] = "TUS";
125
- })(UploadProtocol || (exports.UploadProtocol = UploadProtocol = {}));
126
- var SortOrder;
127
- (function (SortOrder) {
128
- SortOrder["ASC"] = "ASC";
129
- SortOrder["DESC"] = "DESC";
130
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
131
- var RootFolder;
132
- (function (RootFolder) {
133
- /** Root of all site media */
134
- RootFolder["MEDIA_ROOT"] = "MEDIA_ROOT";
135
- /** Root of the trash system folder */
136
- RootFolder["TRASH_ROOT"] = "TRASH_ROOT";
137
- /** Root of all visitor uploads */
138
- RootFolder["VISITOR_UPLOADS_ROOT"] = "VISITOR_UPLOADS_ROOT";
139
- })(RootFolder || (exports.RootFolder = RootFolder = {}));
140
- var StreamFormat;
141
- (function (StreamFormat) {
142
- StreamFormat["UNKNOWN"] = "UNKNOWN";
143
- StreamFormat["HLS"] = "HLS";
144
- StreamFormat["DASH"] = "DASH";
145
- })(StreamFormat || (exports.StreamFormat = StreamFormat = {}));
146
- var WebhookIdentityType;
147
- (function (WebhookIdentityType) {
148
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
149
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
150
- WebhookIdentityType["MEMBER"] = "MEMBER";
151
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
152
- WebhookIdentityType["APP"] = "APP";
153
- })(WebhookIdentityType || (exports.WebhookIdentityType = WebhookIdentityType = {}));
154
- /**
155
- * Generates a URL for downloading a compressed file containing specific files in the Media Manager.
156
- *
157
- * The compressed file can contain up to 1000 files.
158
- *
159
- * To generate a permanent URL for downloading a compressed file that contains multiple files in the Media Manager, call the Generate Files Download URL endpoint.
160
- * Since this is a permanent URL, it is less secure.
161
- * Therefore, to download private files, call the Generate File Download URL endpoint for each private file that you want to generate a download URL for.
162
- * @public
163
- * @requiredField fileIds
164
- * @param fileIds - IDs of the files to download.
165
- *
166
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
167
- * Learn more in the File and Folder IDs article.
168
- * @permissionId MEDIA.SITE_MEDIA_FILES_DOWNLOAD
169
- * @permissionScope Manage Stores
170
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
171
- * @permissionScope Manage Bookings Services and Settings
172
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
173
- * @permissionScope Manage Events
174
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
175
- * @permissionScope Manage Challenges
176
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
177
- * @permissionScope Manage Media Manager
178
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
179
- * @permissionScope Manage Portfolio
180
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
181
- * @permissionScope Access Verticals by Automations
182
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
183
- * @permissionScope Manage Restaurants - all permissions
184
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
185
- * @permissionScope Set Up Automations
186
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
187
- * @applicableIdentity APP
188
- * @fqn com.wix.media.site_media.v1.FilesService.GenerateFilesDownloadUrl
189
- */
190
- async function generateFilesDownloadUrl(fileIds) {
191
- // @ts-ignore
192
- const { httpClient, sideEffects } = arguments[1];
193
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ fileIds: fileIds });
194
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.generateFilesDownloadUrl(payload);
195
- sideEffects?.onSiteCall?.();
196
- try {
197
- const result = await httpClient.request(reqOpts);
198
- sideEffects?.onSuccess?.(result);
199
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
200
- }
201
- catch (err) {
202
- const transformedError = (0, transform_error_1.transformError)(err, {
203
- spreadPathsToArguments: {},
204
- explicitPathsToArguments: { fileIds: '$[0]' },
205
- singleArgumentUnchanged: false,
206
- }, ['fileIds']);
207
- sideEffects?.onError?.(err);
208
- throw transformedError;
209
- }
210
- }
211
- exports.generateFilesDownloadUrl = generateFilesDownloadUrl;
212
- /**
213
- * Generates one or more temporary URLs for downloading a specific file in the Media Manager.
214
- *
215
- * To download different assets of the file, specify the `assetKeys` parameter which generates a download URL for each asset.
216
- * If no `assetKey` is specified, it defaults to `src`, which generates one download URL in the original file's format and quality.
217
- *
218
- * Call this endpoint to grant external clients access to a private media file. Specify the `expirationInMinutes` parameter to set the URL expiration time, and the `expirationRedirectUrl` parameter to add a redirect url when the URL expires.
219
- *
220
- * To generate a permanent URL for downloading a compressed file that contains multiple files in the Media Manager, call the Generate Files Download URL endpoint.
221
- * Since this is a permanent URL, it is less secure.
222
- * Therefore, to download private files, call the Generate File Download URL endpoint for each private file that you want to generate a download URL for.
223
- * @public
224
- * @requiredField fileId
225
- * @param options - Options to use when generating a file's download URL.
226
- * @param fileId - File ID.
227
- *
228
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
229
- * Learn more in the File and Folder IDs article.
230
- * @permissionId MEDIA.SITE_MEDIA_FILES_DOWNLOAD_URL
231
- * @permissionScope Manage Stores
232
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
233
- * @permissionScope Manage Bookings Services and Settings
234
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
235
- * @permissionScope Manage Events
236
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
237
- * @permissionScope Manage Challenges
238
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
239
- * @permissionScope Manage Media Manager
240
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
241
- * @permissionScope Manage Portfolio
242
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
243
- * @permissionScope Access Verticals by Automations
244
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
245
- * @permissionScope Manage Restaurants - all permissions
246
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
247
- * @permissionScope Set Up Automations
248
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
249
- * @applicableIdentity APP
250
- * @fqn com.wix.media.site_media.v1.FilesService.GenerateFileDownloadUrl
251
- */
252
- async function generateFileDownloadUrl(fileId, options) {
253
- // @ts-ignore
254
- const { httpClient, sideEffects } = arguments[2];
255
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
256
- fileId: fileId,
257
- downloadFileName: options?.downloadFileName,
258
- expirationInMinutes: options?.expirationInMinutes,
259
- expirationRedirectUrl: options?.expirationRedirectUrl,
260
- assetKeys: options?.assetKeys,
261
- contentDisposition: options?.contentDisposition,
262
- });
263
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.generateFileDownloadUrl(payload);
264
- sideEffects?.onSiteCall?.();
265
- try {
266
- const result = await httpClient.request(reqOpts);
267
- sideEffects?.onSuccess?.(result);
268
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
269
- }
270
- catch (err) {
271
- const transformedError = (0, transform_error_1.transformError)(err, {
272
- spreadPathsToArguments: {},
273
- explicitPathsToArguments: {
274
- fileId: '$[0]',
275
- downloadFileName: '$[1].downloadFileName',
276
- expirationInMinutes: '$[1].expirationInMinutes',
277
- expirationRedirectUrl: '$[1].expirationRedirectUrl',
278
- assetKeys: '$[1].assetKeys',
279
- contentDisposition: '$[1].contentDisposition',
280
- },
281
- singleArgumentUnchanged: false,
282
- }, ['fileId', 'options']);
283
- sideEffects?.onError?.(err);
284
- throw transformedError;
285
- }
286
- }
287
- exports.generateFileDownloadUrl = generateFileDownloadUrl;
288
- /**
289
- * Gets information about a specific file in the Media Manager.
290
- * @public
291
- * @requiredField fileId
292
- * @param fileId - File ID.
293
- *
294
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
295
- * Learn more in the File and Folder IDs article.
296
- * @permissionId MEDIA.SITE_MEDIA_FILES_READ
297
- * @permissionScope Manage Stores
298
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
299
- * @permissionScope Manage Bookings Services and Settings
300
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
301
- * @permissionScope Manage Events
302
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
303
- * @permissionScope Manage Challenges
304
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
305
- * @permissionScope Read Media Manager
306
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
307
- * @permissionScope Manage Media Manager
308
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
309
- * @permissionScope Manage Portfolio
310
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
311
- * @permissionScope Access Verticals by Automations
312
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
313
- * @permissionScope Manage Restaurants - all permissions
314
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
315
- * @permissionScope Set Up Automations
316
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
317
- * @applicableIdentity APP
318
- * @returns Information about the file.
319
- * @fqn com.wix.media.site_media.v1.FilesService.GetFileDescriptor
320
- */
321
- async function getFileDescriptor(fileId) {
322
- // @ts-ignore
323
- const { httpClient, sideEffects } = arguments[1];
324
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ fileId: fileId });
325
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.getFileDescriptor(payload);
326
- sideEffects?.onSiteCall?.();
327
- try {
328
- const result = await httpClient.request(reqOpts);
329
- sideEffects?.onSuccess?.(result);
330
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
331
- {
332
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
333
- paths: [{ path: 'file.media.video' }],
334
- },
335
- {
336
- transformFn: document_2.transformRESTDocumentToSDKDocument,
337
- paths: [{ path: 'file.media.document' }],
338
- },
339
- {
340
- transformFn: image_2.transformRESTImageToSDKImage,
341
- paths: [
342
- { path: 'file.media.image.image' },
343
- { path: 'file.media.image.previewImage' },
344
- { path: 'file.media.vector.image' },
345
- { path: 'file.media.vector.previewImage' },
346
- { path: 'file.media.model3d.thumbnail' },
347
- { path: 'file.media.icon.image' },
348
- { path: 'file.media.icon.previewImage' },
349
- ],
350
- },
351
- {
352
- transformFn: audio_2.transformRESTAudioToSDKAudio,
353
- paths: [{ path: 'file.media.audio.assets', isRepeated: true }],
354
- },
355
- ]))?.file;
356
- }
357
- catch (err) {
358
- const transformedError = (0, transform_error_1.transformError)(err, {
359
- spreadPathsToArguments: {},
360
- explicitPathsToArguments: { fileId: '$[0]' },
361
- singleArgumentUnchanged: false,
362
- }, ['fileId']);
363
- sideEffects?.onError?.(err);
364
- throw transformedError;
365
- }
366
- }
367
- exports.getFileDescriptor = getFileDescriptor;
368
- /**
369
- * Gets information about specific files in the Media Manager.
370
- * @public
371
- * @requiredField fileIds
372
- * @param fileIds - File IDs.
373
- *
374
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
375
- * Learn more in the File and Folder IDs article.
376
- * @permissionId MEDIA.SITE_MEDIA_FILES_READ
377
- * @permissionScope Manage Stores
378
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
379
- * @permissionScope Manage Bookings Services and Settings
380
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
381
- * @permissionScope Manage Events
382
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
383
- * @permissionScope Manage Challenges
384
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
385
- * @permissionScope Read Media Manager
386
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
387
- * @permissionScope Manage Media Manager
388
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
389
- * @permissionScope Manage Portfolio
390
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
391
- * @permissionScope Access Verticals by Automations
392
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
393
- * @permissionScope Manage Restaurants - all permissions
394
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
395
- * @permissionScope Set Up Automations
396
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
397
- * @applicableIdentity APP
398
- * @fqn com.wix.media.site_media.v1.FilesService.GetFileDescriptors
399
- */
400
- async function getFileDescriptors(fileIds) {
401
- // @ts-ignore
402
- const { httpClient, sideEffects } = arguments[1];
403
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ fileIds: fileIds });
404
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.getFileDescriptors(payload);
405
- sideEffects?.onSiteCall?.();
406
- try {
407
- const result = await httpClient.request(reqOpts);
408
- sideEffects?.onSuccess?.(result);
409
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
410
- {
411
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
412
- paths: [{ path: 'files.media.video' }],
413
- },
414
- {
415
- transformFn: document_2.transformRESTDocumentToSDKDocument,
416
- paths: [{ path: 'files.media.document' }],
417
- },
418
- {
419
- transformFn: image_2.transformRESTImageToSDKImage,
420
- paths: [
421
- { path: 'files.media.image.image' },
422
- { path: 'files.media.image.previewImage' },
423
- { path: 'files.media.vector.image' },
424
- { path: 'files.media.vector.previewImage' },
425
- { path: 'files.media.model3d.thumbnail' },
426
- { path: 'files.media.icon.image' },
427
- { path: 'files.media.icon.previewImage' },
428
- ],
429
- },
430
- {
431
- transformFn: audio_2.transformRESTAudioToSDKAudio,
432
- paths: [{ path: 'files.media.audio.assets', isRepeated: true }],
433
- },
434
- ]));
435
- }
436
- catch (err) {
437
- const transformedError = (0, transform_error_1.transformError)(err, {
438
- spreadPathsToArguments: {},
439
- explicitPathsToArguments: { fileIds: '$[0]' },
440
- singleArgumentUnchanged: false,
441
- }, ['fileIds']);
442
- sideEffects?.onError?.(err);
443
- throw transformedError;
444
- }
445
- }
446
- exports.getFileDescriptors = getFileDescriptors;
447
- /**
448
- * Updates a file. <br />
449
- *
450
- * Specify the `parentFolderId` parameter to move a file from its current folder to a different folder.
451
- * @param file - The file to update.
452
- * @public
453
- * @requiredField file
454
- * @requiredField file._id
455
- * @permissionId MEDIA.SITE_MEDIA_FILES_UPDATE
456
- * @permissionScope Manage Stores
457
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
458
- * @permissionScope Manage Bookings Services and Settings
459
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
460
- * @permissionScope Manage Events
461
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
462
- * @permissionScope Manage Challenges
463
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
464
- * @permissionScope Manage Media Manager
465
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
466
- * @permissionScope Manage Portfolio
467
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
468
- * @permissionScope Access Verticals by Automations
469
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
470
- * @permissionScope Manage Restaurants - all permissions
471
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
472
- * @permissionScope Set Up Automations
473
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
474
- * @applicableIdentity APP
475
- * @returns Information about the updated file.
476
- * @fqn com.wix.media.site_media.v1.FilesService.UpdateFileDescriptor
477
- */
478
- async function updateFileDescriptor(file) {
479
- // @ts-ignore
480
- const { httpClient, sideEffects } = arguments[1];
481
- const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ file: file }), [
482
- {
483
- transformFn: video_v2_1.transformSDKVideoV2ToRESTVideoV2,
484
- paths: [{ path: 'file.media.video' }],
485
- },
486
- {
487
- transformFn: document_1.transformSDKDocumentToRESTDocument,
488
- paths: [{ path: 'file.media.document' }],
489
- },
490
- {
491
- transformFn: image_1.transformSDKImageToRESTImage,
492
- paths: [
493
- { path: 'file.media.image.image' },
494
- { path: 'file.media.image.previewImage' },
495
- { path: 'file.media.vector.image' },
496
- { path: 'file.media.vector.previewImage' },
497
- { path: 'file.media.model3d.thumbnail' },
498
- { path: 'file.media.icon.image' },
499
- { path: 'file.media.icon.previewImage' },
500
- ],
501
- },
502
- {
503
- transformFn: audio_1.transformSDKAudioToRESTAudio,
504
- paths: [{ path: 'file.media.audio.assets', isRepeated: true }],
505
- },
506
- ]);
507
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.updateFileDescriptor(payload);
508
- sideEffects?.onSiteCall?.();
509
- try {
510
- const result = await httpClient.request(reqOpts);
511
- sideEffects?.onSuccess?.(result);
512
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
513
- {
514
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
515
- paths: [{ path: 'file.media.video' }],
516
- },
517
- {
518
- transformFn: document_2.transformRESTDocumentToSDKDocument,
519
- paths: [{ path: 'file.media.document' }],
520
- },
521
- {
522
- transformFn: image_2.transformRESTImageToSDKImage,
523
- paths: [
524
- { path: 'file.media.image.image' },
525
- { path: 'file.media.image.previewImage' },
526
- { path: 'file.media.vector.image' },
527
- { path: 'file.media.vector.previewImage' },
528
- { path: 'file.media.model3d.thumbnail' },
529
- { path: 'file.media.icon.image' },
530
- { path: 'file.media.icon.previewImage' },
531
- ],
532
- },
533
- {
534
- transformFn: audio_2.transformRESTAudioToSDKAudio,
535
- paths: [{ path: 'file.media.audio.assets', isRepeated: true }],
536
- },
537
- ]))?.file;
538
- }
539
- catch (err) {
540
- const transformedError = (0, transform_error_1.transformError)(err, {
541
- spreadPathsToArguments: {},
542
- explicitPathsToArguments: { file: '$[0]' },
543
- singleArgumentUnchanged: false,
544
- }, ['file']);
545
- sideEffects?.onError?.(err);
546
- throw transformedError;
547
- }
548
- }
549
- exports.updateFileDescriptor = updateFileDescriptor;
550
- /**
551
- * Generates an upload URL to allow external clients to upload a file to the Media Manager. <br/>
552
- *
553
- * To learn how external clients can use the generated upload URL in the response to upload a file to the Media Manager, see Upload API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/upload-api) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/upload-api)).
554
- * > **Notes:**
555
- * > - When you upload a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
556
- * > - Any interruption in the upload process stops the file upload. For files larger than 10MB, or when network connection is poor, call Generate File Resumable Upload URL 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.
557
- * @param mimeType - File mime type.
558
- * @public
559
- * @requiredField mimeType
560
- * @param options - Options to use when generating a file's upload URL.
561
- * @permissionId MEDIA.SITE_MEDIA_FILES_UPLOAD
562
- * @permissionScope Manage Stores
563
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
564
- * @permissionScope Manage Bookings Services and Settings
565
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
566
- * @permissionScope Manage Events
567
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
568
- * @permissionScope Manage Challenges
569
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
570
- * @permissionScope Manage Media Manager
571
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
572
- * @permissionScope Manage Portfolio
573
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
574
- * @permissionScope Access Verticals by Automations
575
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
576
- * @permissionScope Manage Restaurants - all permissions
577
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
578
- * @permissionScope Set Up Automations
579
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
580
- * @applicableIdentity APP
581
- * @fqn com.wix.media.site_media.v1.FilesService.GenerateFileUploadUrl
582
- */
583
- async function generateFileUploadUrl(mimeType, options) {
584
- // @ts-ignore
585
- const { httpClient, sideEffects } = arguments[2];
586
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
587
- mimeType: mimeType,
588
- fileName: options?.fileName,
589
- sizeInBytes: options?.sizeInBytes,
590
- parentFolderId: options?.parentFolderId,
591
- private: options?.private,
592
- labels: options?.labels,
593
- externalInfo: options?.externalInfo,
594
- filePath: options?.filePath,
595
- });
596
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.generateFileUploadUrl(payload);
597
- sideEffects?.onSiteCall?.();
598
- try {
599
- const result = await httpClient.request(reqOpts);
600
- sideEffects?.onSuccess?.(result);
601
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
602
- }
603
- catch (err) {
604
- const transformedError = (0, transform_error_1.transformError)(err, {
605
- spreadPathsToArguments: {},
606
- explicitPathsToArguments: {
607
- mimeType: '$[0]',
608
- fileName: '$[1].fileName',
609
- sizeInBytes: '$[1].sizeInBytes',
610
- parentFolderId: '$[1].parentFolderId',
611
- private: '$[1].private',
612
- labels: '$[1].labels',
613
- externalInfo: '$[1].externalInfo',
614
- filePath: '$[1].filePath',
615
- },
616
- singleArgumentUnchanged: false,
617
- }, ['mimeType', 'options']);
618
- sideEffects?.onError?.(err);
619
- throw transformedError;
620
- }
621
- }
622
- exports.generateFileUploadUrl = generateFileUploadUrl;
623
- /**
624
- * Generates a resumable upload URL to allow external clients to easily upload large files over 10MB to the Media Manager. <br/>
625
- *
626
- * 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.
627
- * To learn how external clients can use the generated upload URL in the response to upload large files to the Media Manager, see Resumable Upload API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/resumable-upload-api) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/resumable-upload-api)).
628
- *
629
- * > **Note:** When you upload a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
630
- * @param mimeType - File mime type.
631
- * @public
632
- * @requiredField mimeType
633
- * @param options - Options to use when generating a resumable upload URL.
634
- * @permissionId MEDIA.SITE_MEDIA_FILES_UPLOAD
635
- * @permissionScope Manage Stores
636
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
637
- * @permissionScope Manage Bookings Services and Settings
638
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
639
- * @permissionScope Manage Events
640
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
641
- * @permissionScope Manage Challenges
642
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
643
- * @permissionScope Manage Media Manager
644
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
645
- * @permissionScope Manage Portfolio
646
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
647
- * @permissionScope Access Verticals by Automations
648
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
649
- * @permissionScope Manage Restaurants - all permissions
650
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
651
- * @permissionScope Set Up Automations
652
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
653
- * @applicableIdentity APP
654
- * @fqn com.wix.media.site_media.v1.FilesService.GenerateFileResumableUploadUrl
655
- */
656
- async function generateFileResumableUploadUrl(mimeType, options) {
657
- // @ts-ignore
658
- const { httpClient, sideEffects } = arguments[2];
659
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
660
- mimeType: mimeType,
661
- fileName: options?.fileName,
662
- sizeInBytes: options?.sizeInBytes,
663
- parentFolderId: options?.parentFolderId,
664
- private: options?.private,
665
- labels: options?.labels,
666
- uploadProtocol: options?.uploadProtocol,
667
- filePath: options?.filePath,
668
- });
669
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.generateFileResumableUploadUrl(payload);
670
- sideEffects?.onSiteCall?.();
671
- try {
672
- const result = await httpClient.request(reqOpts);
673
- sideEffects?.onSuccess?.(result);
674
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
675
- }
676
- catch (err) {
677
- const transformedError = (0, transform_error_1.transformError)(err, {
678
- spreadPathsToArguments: {},
679
- explicitPathsToArguments: {
680
- mimeType: '$[0]',
681
- fileName: '$[1].fileName',
682
- sizeInBytes: '$[1].sizeInBytes',
683
- parentFolderId: '$[1].parentFolderId',
684
- private: '$[1].private',
685
- labels: '$[1].labels',
686
- uploadProtocol: '$[1].uploadProtocol',
687
- filePath: '$[1].filePath',
688
- },
689
- singleArgumentUnchanged: false,
690
- }, ['mimeType', 'options']);
691
- sideEffects?.onError?.(err);
692
- throw transformedError;
693
- }
694
- }
695
- exports.generateFileResumableUploadUrl = generateFileResumableUploadUrl;
696
- /**
697
- * Imports a file to the Media Manager using an external url.
698
- *
699
- * Returns information about the imported file.
700
- * Specify the `parentFolderId` and `filePath` parameters to specify which folder you want the file to be imported to.
701
- * If no folder is specified, the file is imported to the `media-root` folder.
702
- *
703
- * >**Notes:**
704
- * > - The `media` property isn't returned in the `files` response object.
705
- * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
706
- *
707
- * To import a file, you need to do one of the following:
708
- * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
709
- * - Specify its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
710
- * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
711
- * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request. For example, `mediaType: 'IMAGE'`.
712
- * @param url - Publicly accessible external file URL.
713
- * @public
714
- * @requiredField url
715
- * @param options - Options to use when importing a single file.
716
- * @permissionId MEDIA.SITE_MEDIA_FILES_IMPORT
717
- * @permissionScope Manage Stores
718
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
719
- * @permissionScope Manage Bookings Services and Settings
720
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
721
- * @permissionScope Manage Events
722
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
723
- * @permissionScope Manage Challenges
724
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
725
- * @permissionScope Manage Media Manager
726
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
727
- * @permissionScope Manage Portfolio
728
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
729
- * @permissionScope Access Verticals by Automations
730
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
731
- * @permissionScope Manage Restaurants - all permissions
732
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
733
- * @permissionScope Set Up Automations
734
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
735
- * @applicableIdentity APP
736
- * @fqn com.wix.media.site_media.v1.FilesService.ImportFile
737
- */
738
- async function importFile(url, options) {
739
- // @ts-ignore
740
- const { httpClient, sideEffects } = arguments[2];
741
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
742
- url: url,
743
- mediaType: options?.mediaType,
744
- displayName: options?.displayName,
745
- parentFolderId: options?.parentFolderId,
746
- private: options?.private,
747
- labels: options?.labels,
748
- mimeType: options?.mimeType,
749
- externalInfo: options?.externalInfo,
750
- urlParams: options?.urlParams,
751
- urlHeaders: options?.urlHeaders,
752
- filePath: options?.filePath,
753
- });
754
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.importFile(payload);
755
- sideEffects?.onSiteCall?.();
756
- try {
757
- const result = await httpClient.request(reqOpts);
758
- sideEffects?.onSuccess?.(result);
759
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
760
- {
761
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
762
- paths: [{ path: 'file.media.video' }],
763
- },
764
- {
765
- transformFn: document_2.transformRESTDocumentToSDKDocument,
766
- paths: [{ path: 'file.media.document' }],
767
- },
768
- {
769
- transformFn: image_2.transformRESTImageToSDKImage,
770
- paths: [
771
- { path: 'file.media.image.image' },
772
- { path: 'file.media.image.previewImage' },
773
- { path: 'file.media.vector.image' },
774
- { path: 'file.media.vector.previewImage' },
775
- { path: 'file.media.model3d.thumbnail' },
776
- { path: 'file.media.icon.image' },
777
- { path: 'file.media.icon.previewImage' },
778
- ],
779
- },
780
- {
781
- transformFn: audio_2.transformRESTAudioToSDKAudio,
782
- paths: [{ path: 'file.media.audio.assets', isRepeated: true }],
783
- },
784
- ]));
785
- }
786
- catch (err) {
787
- const transformedError = (0, transform_error_1.transformError)(err, {
788
- spreadPathsToArguments: {},
789
- explicitPathsToArguments: {
790
- url: '$[0]',
791
- mediaType: '$[1].mediaType',
792
- displayName: '$[1].displayName',
793
- parentFolderId: '$[1].parentFolderId',
794
- private: '$[1].private',
795
- labels: '$[1].labels',
796
- mimeType: '$[1].mimeType',
797
- externalInfo: '$[1].externalInfo',
798
- urlParams: '$[1].urlParams',
799
- urlHeaders: '$[1].urlHeaders',
800
- filePath: '$[1].filePath',
801
- },
802
- singleArgumentUnchanged: false,
803
- }, ['url', 'options']);
804
- sideEffects?.onError?.(err);
805
- throw transformedError;
806
- }
807
- }
808
- exports.importFile = importFile;
809
- /**
810
- * Imports a bulk of files to the Media Manager using external urls. <br/>
811
- *
812
- * Returns information about the imported files.
813
- *
814
- * Use the `parentFolderId` and `filePath` parameters to specify the folder you want each file to be imported to.
815
- * If no folder is specified, the file is imported to the `media-root` folder.
816
- *
817
- * >**Notes:**
818
- * > - The `media` property isn't returned in the `files` response object.
819
- * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
820
- *
821
- * To import files, you need to do one of the following for each file:
822
- * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
823
- * - Include its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
824
- * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
825
- * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request. For example, `mediaType: 'IMAGE'`.
826
- * @param importFileRequests - Information about the files to import.
827
- * @public
828
- * @requiredField importFileRequests
829
- * @requiredField importFileRequests.url
830
- * @param options - Options to use when uploading multiple files.
831
- * @permissionId MEDIA.SITE_MEDIA_FILES_IMPORT
832
- * @permissionScope Manage Stores
833
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
834
- * @permissionScope Manage Bookings Services and Settings
835
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
836
- * @permissionScope Manage Events
837
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
838
- * @permissionScope Manage Challenges
839
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
840
- * @permissionScope Manage Media Manager
841
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
842
- * @permissionScope Manage Portfolio
843
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
844
- * @permissionScope Access Verticals by Automations
845
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
846
- * @permissionScope Manage Restaurants - all permissions
847
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
848
- * @permissionScope Set Up Automations
849
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
850
- * @applicableIdentity APP
851
- * @fqn com.wix.media.site_media.v1.FilesService.BulkImportFiles
852
- * @deprecated
853
- * @replacedBy com.wix.media.site_media.v1.FilesService.BulkImportFile
854
- * @targetRemovalDate 2024-03-31
855
- */
856
- async function bulkImportFiles(importFileRequests) {
857
- // @ts-ignore
858
- const { httpClient, sideEffects } = arguments[1];
859
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
860
- importFileRequests: importFileRequests,
861
- });
862
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkImportFiles(payload);
863
- sideEffects?.onSiteCall?.();
864
- try {
865
- const result = await httpClient.request(reqOpts);
866
- sideEffects?.onSuccess?.(result);
867
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
868
- {
869
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
870
- paths: [{ path: 'files.media.video' }],
871
- },
872
- {
873
- transformFn: document_2.transformRESTDocumentToSDKDocument,
874
- paths: [{ path: 'files.media.document' }],
875
- },
876
- {
877
- transformFn: image_2.transformRESTImageToSDKImage,
878
- paths: [
879
- { path: 'files.media.image.image' },
880
- { path: 'files.media.image.previewImage' },
881
- { path: 'files.media.vector.image' },
882
- { path: 'files.media.vector.previewImage' },
883
- { path: 'files.media.model3d.thumbnail' },
884
- { path: 'files.media.icon.image' },
885
- { path: 'files.media.icon.previewImage' },
886
- ],
887
- },
888
- {
889
- transformFn: audio_2.transformRESTAudioToSDKAudio,
890
- paths: [{ path: 'files.media.audio.assets', isRepeated: true }],
891
- },
892
- ]));
893
- }
894
- catch (err) {
895
- const transformedError = (0, transform_error_1.transformError)(err, {
896
- spreadPathsToArguments: {},
897
- explicitPathsToArguments: { importFileRequests: '$[0]' },
898
- singleArgumentUnchanged: false,
899
- }, ['importFileRequests']);
900
- sideEffects?.onError?.(err);
901
- throw transformedError;
902
- }
903
- }
904
- exports.bulkImportFiles = bulkImportFiles;
905
- /**
906
- * Imports a bulk of files to the Media Manager using external urls. <br/>
907
- *
908
- * Returns information about the imported files.
909
- *
910
- * Specify the `parentFolderId` and `filePath` parameters to specify the folder you want each file to be imported to.
911
- * If no folder is specified, the file is imported to the `media-root` folder.
912
- *
913
- * >**Notes:**
914
- * > - The `media` property isn't returned in the `files` response object.
915
- * > - When you import a file, it's not immediately available, meaning you can't manage or use the file straight away. Learn more about knowing when a file is ready ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/files/importing-files#backend-modules_media_files_knowing-when-a-file-is-ready) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/files/importing-files#knowing-when-a-file-is-ready)).
916
- *
917
- * To import files, you need to do one of the following for each file:
918
- * - Specify its [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) in the `mimeType` field of the request. For example, `mimeType: 'image/jpeg'`.
919
- * - Include its extension in either the `displayName` or `url` field of the request. For example, `displayName: 'Example Image.jpeg` or `url: https://www.example.com/image.jpeg`.
920
- * - Ensure the server hosting the file supports HEAD requests. In these cases the Wix servers can retrieve the MIME type from the hosting server.
921
- * > **Note:** If you want to validate the media type, specify the file's expected media type in the optional `mediaType` field of the request. For example, `mediaType: 'IMAGE'`.
922
- * @param importFileRequests - Information about the files to import.
923
- * @public
924
- * @requiredField importFileRequests
925
- * @requiredField importFileRequests.url
926
- * @param options - Options to include the file descriptor in the response.
927
- * @permissionId MEDIA.SITE_MEDIA_FILES_IMPORT
928
- * @permissionScope Manage Stores
929
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
930
- * @permissionScope Manage Bookings Services and Settings
931
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
932
- * @permissionScope Manage Events
933
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
934
- * @permissionScope Manage Challenges
935
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
936
- * @permissionScope Manage Media Manager
937
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
938
- * @permissionScope Manage Portfolio
939
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
940
- * @permissionScope Access Verticals by Automations
941
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
942
- * @permissionScope Manage Restaurants - all permissions
943
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
944
- * @permissionScope Set Up Automations
945
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
946
- * @applicableIdentity APP
947
- * @fqn com.wix.media.site_media.v1.FilesService.BulkImportFile
948
- */
949
- async function bulkImportFile(importFileRequests, options) {
950
- // @ts-ignore
951
- const { httpClient, sideEffects } = arguments[2];
952
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
953
- importFileRequests: importFileRequests,
954
- returnEntity: options?.returnEntity,
955
- });
956
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkImportFile(payload);
957
- sideEffects?.onSiteCall?.();
958
- try {
959
- const result = await httpClient.request(reqOpts);
960
- sideEffects?.onSuccess?.(result);
961
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
962
- {
963
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
964
- paths: [{ path: 'results.item.media.video' }],
965
- },
966
- {
967
- transformFn: document_2.transformRESTDocumentToSDKDocument,
968
- paths: [{ path: 'results.item.media.document' }],
969
- },
970
- {
971
- transformFn: image_2.transformRESTImageToSDKImage,
972
- paths: [
973
- { path: 'results.item.media.image.image' },
974
- { path: 'results.item.media.image.previewImage' },
975
- { path: 'results.item.media.vector.image' },
976
- { path: 'results.item.media.vector.previewImage' },
977
- { path: 'results.item.media.model3d.thumbnail' },
978
- { path: 'results.item.media.icon.image' },
979
- { path: 'results.item.media.icon.previewImage' },
980
- ],
981
- },
982
- {
983
- transformFn: audio_2.transformRESTAudioToSDKAudio,
984
- paths: [
985
- { path: 'results.item.media.audio.assets', isRepeated: true },
986
- ],
987
- },
988
- ]));
989
- }
990
- catch (err) {
991
- const transformedError = (0, transform_error_1.transformError)(err, {
992
- spreadPathsToArguments: {},
993
- explicitPathsToArguments: {
994
- importFileRequests: '$[0]',
995
- returnEntity: '$[1].returnEntity',
996
- },
997
- singleArgumentUnchanged: false,
998
- }, ['importFileRequests', 'options']);
999
- sideEffects?.onError?.(err);
1000
- throw transformedError;
1001
- }
1002
- }
1003
- exports.bulkImportFile = bulkImportFile;
1004
- /**
1005
- * Retrieves a list of files in the Media Manager.
1006
- *
1007
- * To retrieve a list of files within a specific folder in the Media Manager, specify the folder's ID in the `parentFolderId` parameter. If no folder is specified, the method retrieves the list of files in the root folder of the Media Manager.
1008
- * @public
1009
- * @param options - Options to use when listing media files.
1010
- * @permissionId MEDIA.SITE_MEDIA_FILES_LIST
1011
- * @permissionScope Manage Stores
1012
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1013
- * @permissionScope Manage Bookings Services and Settings
1014
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1015
- * @permissionScope Manage Events
1016
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1017
- * @permissionScope Manage Challenges
1018
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1019
- * @permissionScope Read Media Manager
1020
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
1021
- * @permissionScope Manage Media Manager
1022
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1023
- * @permissionScope Manage Portfolio
1024
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1025
- * @permissionScope Access Verticals by Automations
1026
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1027
- * @permissionScope Manage Restaurants - all permissions
1028
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1029
- * @permissionScope Set Up Automations
1030
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1031
- * @applicableIdentity APP
1032
- * @fqn com.wix.media.site_media.v1.FilesService.ListFiles
1033
- */
1034
- async function listFiles(options) {
1035
- // @ts-ignore
1036
- const { httpClient, sideEffects } = arguments[1];
1037
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
1038
- parentFolderId: options?.parentFolderId,
1039
- mediaTypes: options?.mediaTypes,
1040
- private: options?.private,
1041
- sort: options?.sort,
1042
- paging: options?.paging,
1043
- });
1044
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.listFiles(payload);
1045
- sideEffects?.onSiteCall?.();
1046
- try {
1047
- const result = await httpClient.request(reqOpts);
1048
- sideEffects?.onSuccess?.(result);
1049
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
1050
- {
1051
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
1052
- paths: [{ path: 'files.media.video' }],
1053
- },
1054
- {
1055
- transformFn: document_2.transformRESTDocumentToSDKDocument,
1056
- paths: [{ path: 'files.media.document' }],
1057
- },
1058
- {
1059
- transformFn: image_2.transformRESTImageToSDKImage,
1060
- paths: [
1061
- { path: 'files.media.image.image' },
1062
- { path: 'files.media.image.previewImage' },
1063
- { path: 'files.media.vector.image' },
1064
- { path: 'files.media.vector.previewImage' },
1065
- { path: 'files.media.model3d.thumbnail' },
1066
- { path: 'files.media.icon.image' },
1067
- { path: 'files.media.icon.previewImage' },
1068
- ],
1069
- },
1070
- {
1071
- transformFn: audio_2.transformRESTAudioToSDKAudio,
1072
- paths: [{ path: 'files.media.audio.assets', isRepeated: true }],
1073
- },
1074
- ]));
1075
- }
1076
- catch (err) {
1077
- const transformedError = (0, transform_error_1.transformError)(err, {
1078
- spreadPathsToArguments: {},
1079
- explicitPathsToArguments: {
1080
- parentFolderId: '$[0].parentFolderId',
1081
- mediaTypes: '$[0].mediaTypes',
1082
- private: '$[0].private',
1083
- sort: '$[0].sort',
1084
- paging: '$[0].paging',
1085
- },
1086
- singleArgumentUnchanged: false,
1087
- }, ['options']);
1088
- sideEffects?.onError?.(err);
1089
- throw transformedError;
1090
- }
1091
- }
1092
- exports.listFiles = listFiles;
1093
- /**
1094
- * Searches all folders in the Media Manager and returns a list of files that match the terms specified in the parameters. <br/>
1095
- *
1096
- * If no parameters are specified, the endpoint returns all files in the `MEDIA_ROOT` folder.
1097
- * @public
1098
- * @param options - Options to specify which folders to search.
1099
- * @permissionId MEDIA.SITE_MEDIA_FILES_LIST
1100
- * @permissionScope Manage Stores
1101
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1102
- * @permissionScope Manage Bookings Services and Settings
1103
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1104
- * @permissionScope Manage Events
1105
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1106
- * @permissionScope Manage Challenges
1107
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1108
- * @permissionScope Read Media Manager
1109
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
1110
- * @permissionScope Manage Media Manager
1111
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1112
- * @permissionScope Manage Portfolio
1113
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1114
- * @permissionScope Access Verticals by Automations
1115
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1116
- * @permissionScope Manage Restaurants - all permissions
1117
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1118
- * @permissionScope Set Up Automations
1119
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1120
- * @applicableIdentity APP
1121
- * @fqn com.wix.media.site_media.v1.FilesService.SearchFiles
1122
- */
1123
- async function searchFiles(options) {
1124
- // @ts-ignore
1125
- const { httpClient, sideEffects } = arguments[1];
1126
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
1127
- search: options?.search,
1128
- rootFolder: options?.rootFolder,
1129
- mediaTypes: options?.mediaTypes,
1130
- private: options?.private,
1131
- sort: options?.sort,
1132
- paging: options?.paging,
1133
- });
1134
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.searchFiles(payload);
1135
- sideEffects?.onSiteCall?.();
1136
- try {
1137
- const result = await httpClient.request(reqOpts);
1138
- sideEffects?.onSuccess?.(result);
1139
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
1140
- {
1141
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
1142
- paths: [{ path: 'files.media.video' }],
1143
- },
1144
- {
1145
- transformFn: document_2.transformRESTDocumentToSDKDocument,
1146
- paths: [{ path: 'files.media.document' }],
1147
- },
1148
- {
1149
- transformFn: image_2.transformRESTImageToSDKImage,
1150
- paths: [
1151
- { path: 'files.media.image.image' },
1152
- { path: 'files.media.image.previewImage' },
1153
- { path: 'files.media.vector.image' },
1154
- { path: 'files.media.vector.previewImage' },
1155
- { path: 'files.media.model3d.thumbnail' },
1156
- { path: 'files.media.icon.image' },
1157
- { path: 'files.media.icon.previewImage' },
1158
- ],
1159
- },
1160
- {
1161
- transformFn: audio_2.transformRESTAudioToSDKAudio,
1162
- paths: [{ path: 'files.media.audio.assets', isRepeated: true }],
1163
- },
1164
- ]));
1165
- }
1166
- catch (err) {
1167
- const transformedError = (0, transform_error_1.transformError)(err, {
1168
- spreadPathsToArguments: {},
1169
- explicitPathsToArguments: {
1170
- search: '$[0].search',
1171
- rootFolder: '$[0].rootFolder',
1172
- mediaTypes: '$[0].mediaTypes',
1173
- private: '$[0].private',
1174
- sort: '$[0].sort',
1175
- paging: '$[0].paging',
1176
- },
1177
- singleArgumentUnchanged: false,
1178
- }, ['options']);
1179
- sideEffects?.onError?.(err);
1180
- throw transformedError;
1181
- }
1182
- }
1183
- exports.searchFiles = searchFiles;
1184
- /**
1185
- * Generates a URL for streaming a specific video file in the Media Manager. <br/>
1186
- *
1187
- * To stream different assets of the file, specify the `assetKeys` parameter which generates a video streaming URL for each asset. If no assetKey is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
1188
- * @public
1189
- * @requiredField fileId
1190
- * @param options - Options to use when generating a video file's streaming URL.
1191
- * @param fileId - File ID.
1192
- *
1193
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
1194
- * Learn more in the File and Folder IDs article.
1195
- * @permissionId MEDIA.SITE_MEDIA_FILES_READ
1196
- * @permissionScope Manage Stores
1197
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1198
- * @permissionScope Manage Bookings Services and Settings
1199
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1200
- * @permissionScope Manage Events
1201
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1202
- * @permissionScope Manage Challenges
1203
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1204
- * @permissionScope Read Media Manager
1205
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
1206
- * @permissionScope Manage Media Manager
1207
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1208
- * @permissionScope Manage Portfolio
1209
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1210
- * @permissionScope Access Verticals by Automations
1211
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1212
- * @permissionScope Manage Restaurants - all permissions
1213
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1214
- * @permissionScope Set Up Automations
1215
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1216
- * @applicableIdentity APP
1217
- * @fqn com.wix.media.site_media.v1.FilesService.GenerateVideoStreamingUrl
1218
- */
1219
- async function generateVideoStreamingUrl(fileId, options) {
1220
- // @ts-ignore
1221
- const { httpClient, sideEffects } = arguments[2];
1222
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
1223
- fileId: fileId,
1224
- format: options?.format,
1225
- });
1226
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.generateVideoStreamingUrl(payload);
1227
- sideEffects?.onSiteCall?.();
1228
- try {
1229
- const result = await httpClient.request(reqOpts);
1230
- sideEffects?.onSuccess?.(result);
1231
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
1232
- }
1233
- catch (err) {
1234
- const transformedError = (0, transform_error_1.transformError)(err, {
1235
- spreadPathsToArguments: {},
1236
- explicitPathsToArguments: { fileId: '$[0]', format: '$[1].format' },
1237
- singleArgumentUnchanged: false,
1238
- }, ['fileId', 'options']);
1239
- sideEffects?.onError?.(err);
1240
- throw transformedError;
1241
- }
1242
- }
1243
- exports.generateVideoStreamingUrl = generateVideoStreamingUrl;
1244
- /**
1245
- * Deletes the specified files from the Media Manager. <br/>
1246
- *
1247
- * The deleted files are moved to the Media Manager's trash bin (`TRASH-ROOT` folder) unless permanently deleted. To permanently delete files, specify 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.
1248
- *
1249
- * Note the following:
1250
- * * The specified files can be from different folders.
1251
- * * Moving multiple files at once is an asynchronous action, and may take time for the changes to appear in the Media Manager.
1252
- * * Attempting to delete files that are already in the trash bin doesn't result in an error.
1253
- * * If a site contains deleted media files, the deleted media files still appear on the site as the files are still in the Media Manager (in the trash bin).
1254
- * * You can use Bulk Restore Files From Trash Bin to restore files from the Media Manager's trash bin.
1255
- * @public
1256
- * @requiredField fileIds
1257
- * @param options - Options to use when deleting files.
1258
- * @param fileIds - IDs of the files to move to the Media Manager's trash bin.
1259
- *
1260
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
1261
- * Learn more in the File and Folder IDs article.
1262
- * @permissionId MEDIA.SITE_MEDIA_FILES_MOVE_TO_TRASH
1263
- * @permissionScope Manage Stores
1264
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1265
- * @permissionScope Manage Bookings Services and Settings
1266
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1267
- * @permissionScope Manage Events
1268
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1269
- * @permissionScope Manage Challenges
1270
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1271
- * @permissionScope Manage Media Manager
1272
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1273
- * @permissionScope Manage Portfolio
1274
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1275
- * @permissionScope Access Verticals by Automations
1276
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1277
- * @permissionScope Manage Restaurants - all permissions
1278
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1279
- * @permissionScope Set Up Automations
1280
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1281
- * @applicableIdentity APP
1282
- * @fqn com.wix.media.site_media.v1.FilesService.BulkDeleteFiles
1283
- */
1284
- async function bulkDeleteFiles(fileIds, options) {
1285
- // @ts-ignore
1286
- const { httpClient, sideEffects } = arguments[2];
1287
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
1288
- fileIds: fileIds,
1289
- permanent: options?.permanent,
1290
- });
1291
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkDeleteFiles(payload);
1292
- sideEffects?.onSiteCall?.();
1293
- try {
1294
- const result = await httpClient.request(reqOpts);
1295
- sideEffects?.onSuccess?.(result);
1296
- }
1297
- catch (err) {
1298
- const transformedError = (0, transform_error_1.transformError)(err, {
1299
- spreadPathsToArguments: {},
1300
- explicitPathsToArguments: {
1301
- fileIds: '$[0]',
1302
- permanent: '$[1].permanent',
1303
- },
1304
- singleArgumentUnchanged: false,
1305
- }, ['fileIds', 'options']);
1306
- sideEffects?.onError?.(err);
1307
- throw transformedError;
1308
- }
1309
- }
1310
- exports.bulkDeleteFiles = bulkDeleteFiles;
1311
- /**
1312
- * Restores the specified files from the Media Manager's trash bin, and moves them to their original locations in the Media Manager.
1313
- * @public
1314
- * @requiredField fileIds
1315
- * @param fileIds - IDs of the files to restore from the Media Manager's trash bin.
1316
- *
1317
- * You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`.
1318
- * Learn more in the File and Folder IDs article.
1319
- * @permissionId MEDIA.SITE_MEDIA_FILES_RESTORE_FROM_TRASH
1320
- * @permissionScope Manage Stores
1321
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1322
- * @permissionScope Manage Bookings Services and Settings
1323
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1324
- * @permissionScope Manage Events
1325
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1326
- * @permissionScope Manage Challenges
1327
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1328
- * @permissionScope Manage Media Manager
1329
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1330
- * @permissionScope Manage Portfolio
1331
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1332
- * @permissionScope Access Verticals by Automations
1333
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1334
- * @permissionScope Manage Restaurants - all permissions
1335
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1336
- * @permissionScope Set Up Automations
1337
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1338
- * @applicableIdentity APP
1339
- * @fqn com.wix.media.site_media.v1.FilesService.BulkRestoreFilesFromTrashBin
1340
- */
1341
- async function bulkRestoreFilesFromTrashBin(fileIds) {
1342
- // @ts-ignore
1343
- const { httpClient, sideEffects } = arguments[1];
1344
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ fileIds: fileIds });
1345
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.bulkRestoreFilesFromTrashBin(payload);
1346
- sideEffects?.onSiteCall?.();
1347
- try {
1348
- const result = await httpClient.request(reqOpts);
1349
- sideEffects?.onSuccess?.(result);
1350
- }
1351
- catch (err) {
1352
- const transformedError = (0, transform_error_1.transformError)(err, {
1353
- spreadPathsToArguments: {},
1354
- explicitPathsToArguments: { fileIds: '$[0]' },
1355
- singleArgumentUnchanged: false,
1356
- }, ['fileIds']);
1357
- sideEffects?.onError?.(err);
1358
- throw transformedError;
1359
- }
1360
- }
1361
- exports.bulkRestoreFilesFromTrashBin = bulkRestoreFilesFromTrashBin;
1362
- /**
1363
- * Retrieves a list of files in the Media Manager's trash bin. <br/>
1364
- *
1365
- * >**Note:** The Media Manager's trash bin (`TRASH-ROOT` folder) only contains temporarily deleted files, not permanently deleted files.
1366
- * @public
1367
- * @param options - Options to use when listing deleted files from the trash bin.
1368
- * @permissionId MEDIA.SITE_MEDIA_FILES_LIST_DELETED
1369
- * @permissionScope Manage Stores
1370
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1371
- * @permissionScope Manage Bookings Services and Settings
1372
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
1373
- * @permissionScope Manage Events
1374
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
1375
- * @permissionScope Manage Challenges
1376
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
1377
- * @permissionScope Read Media Manager
1378
- * @permissionScopeId SCOPE.DC-MEDIA.READ-MEDIAMANAGER
1379
- * @permissionScope Manage Media Manager
1380
- * @permissionScopeId SCOPE.DC-MEDIA.MANAGE-MEDIAMANAGER
1381
- * @permissionScope Manage Portfolio
1382
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
1383
- * @permissionScope Access Verticals by Automations
1384
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
1385
- * @permissionScope Manage Restaurants - all permissions
1386
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1387
- * @permissionScope Set Up Automations
1388
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
1389
- * @applicableIdentity APP
1390
- * @fqn com.wix.media.site_media.v1.FilesService.ListDeletedFiles
1391
- */
1392
- async function listDeletedFiles(options) {
1393
- // @ts-ignore
1394
- const { httpClient, sideEffects } = arguments[1];
1395
- const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
1396
- parentFolderId: options?.parentFolderId,
1397
- mediaTypes: options?.mediaTypes,
1398
- private: options?.private,
1399
- sort: options?.sort,
1400
- paging: options?.paging,
1401
- });
1402
- const reqOpts = ambassadorWixMediaSiteMediaV1FileDescriptor.listDeletedFiles(payload);
1403
- sideEffects?.onSiteCall?.();
1404
- try {
1405
- const result = await httpClient.request(reqOpts);
1406
- sideEffects?.onSuccess?.(result);
1407
- return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
1408
- {
1409
- transformFn: video_v2_2.transformRESTVideoV2ToSDKVideoV2,
1410
- paths: [{ path: 'files.media.video' }],
1411
- },
1412
- {
1413
- transformFn: document_2.transformRESTDocumentToSDKDocument,
1414
- paths: [{ path: 'files.media.document' }],
1415
- },
1416
- {
1417
- transformFn: image_2.transformRESTImageToSDKImage,
1418
- paths: [
1419
- { path: 'files.media.image.image' },
1420
- { path: 'files.media.image.previewImage' },
1421
- { path: 'files.media.vector.image' },
1422
- { path: 'files.media.vector.previewImage' },
1423
- { path: 'files.media.model3d.thumbnail' },
1424
- { path: 'files.media.icon.image' },
1425
- { path: 'files.media.icon.previewImage' },
1426
- ],
1427
- },
1428
- {
1429
- transformFn: audio_2.transformRESTAudioToSDKAudio,
1430
- paths: [{ path: 'files.media.audio.assets', isRepeated: true }],
1431
- },
1432
- ]));
1433
- }
1434
- catch (err) {
1435
- const transformedError = (0, transform_error_1.transformError)(err, {
1436
- spreadPathsToArguments: {},
1437
- explicitPathsToArguments: {
1438
- parentFolderId: '$[0].parentFolderId',
1439
- mediaTypes: '$[0].mediaTypes',
1440
- private: '$[0].private',
1441
- sort: '$[0].sort',
1442
- paging: '$[0].paging',
1443
- },
1444
- singleArgumentUnchanged: false,
1445
- }, ['options']);
1446
- sideEffects?.onError?.(err);
1447
- throw transformedError;
1448
- }
1449
- }
1450
- exports.listDeletedFiles = listDeletedFiles;
1451
- //# sourceMappingURL=media-site-media-v1-file-descriptor-files.universal.js.map