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