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