@wix/auto_sdk_media_files 1.0.18 → 1.0.20

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