Skip to content

Commit 7eb826a

Browse files
JustRaus43574887JustRaus43574887
authored andcommitted
CCS-110446 feature: echo_file/files media quality
1 parent c8ca68a commit 7eb826a

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@expressms/smartapp-sdk",
3-
"version": "1.13.0-alpha.12",
3+
"version": "1.14.0-alpha.1",
44
"description": "Smartapp SDK",
55
"main": "build/main/index.js",
66
"typings": "build/main/index.d.ts",

src/lib/client/file.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import bridge from '@expressms/smartapp-bridge'
22
import {
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
*/
3638
const 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
*/
6470
const 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
})

src/types/events.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ export type SubscriptionPayload = {
1313
type: SubscriptionPayloadType
1414
id: string
1515
}
16+
17+
export enum FILE_MEDIA_QUALITY {
18+
LOW = 'low',
19+
MEDIUM = 'medium',
20+
HIGH = 'high',
21+
}

0 commit comments

Comments
 (0)