@@ -2,6 +2,7 @@ import bridge from '@expressms/smartapp-bridge'
22import {
33 ERROR_CODES ,
44 File ,
5+ FILE_MEDIA_QUALITY ,
56 METHODS ,
67 StatusResponse ,
78 UploadFilesTypeResponse ,
@@ -31,14 +32,17 @@ const openFile = async (file: File): Promise<StatusResponse> => {
3132 * Upload single file with client
3233 * @param mimeType Mime type of allowed files
3334 * @param maxSize Max file size in bytes
35+ * @param mediaQuality File media quality (For example: low mediaQuality - high compression ratio on client)
3436 * @returns Promise that'll be fullfilled with file metadata on success, otherwise rejected with reason
3537 */
3638const uploadFile = async ( {
3739 mimeType,
3840 maxSize,
41+ mediaQuality,
3942} : {
4043 mimeType : string
4144 maxSize ?: number
45+ mediaQuality ?: FILE_MEDIA_QUALITY | null
4246} ) : Promise < UploadFileTypeResponse > => {
4347 if ( ! bridge ) return Promise . reject ( ERROR_CODES . NO_BRIDGE )
4448
@@ -47,6 +51,7 @@ const uploadFile = async ({
4751 params : {
4852 type : mimeType ,
4953 maxSize,
54+ mediaQuality,
5055 } ,
5156 timeout : FILE_LOAD_TIMEOUT ,
5257 } )
@@ -59,16 +64,19 @@ const uploadFile = async ({
5964 * @param mimeType Mime type of allowed files
6065 * @param maxSize Max file size in bytes
6166 * @param totalSize Total files size in bytes
67+ * @param mediaQuality File media quality (For example: low mediaQuality - high compression ratio on client)
6268 * @returns Promise that'll be fullfilled with files metadata on success, otherwise rejected with reason
6369 */
6470const uploadFiles = async ( {
6571 mimeType,
6672 maxSize,
6773 totalSize,
74+ mediaQuality,
6875} : {
6976 mimeType : string
7077 maxSize ?: number ,
7178 totalSize ?: number ,
79+ mediaQuality ?: FILE_MEDIA_QUALITY | null
7280} ) : Promise < UploadFilesTypeResponse > => {
7381 if ( ! bridge ) return Promise . reject ( ERROR_CODES . NO_BRIDGE )
7482
@@ -78,6 +86,7 @@ const uploadFiles = async ({
7886 type : mimeType ,
7987 maxSize,
8088 totalSize,
89+ mediaQuality,
8190 } ,
8291 timeout : FILE_LOAD_TIMEOUT ,
8392 } )
0 commit comments