UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

131 lines (113 loc) 3.25 kB
export const ContentFeedType = Object.freeze({ STORY: 'story', CLIP: 'clip', CHAT: 'chat', POST: 'post', MESSAGE: 'message', }); export enum ContentFlagReasonEnum { CommunityGuidelines = 'Against community guidelines', HarassmentOrBullying = 'Harassment or bullying', SelfHarmOrSuicide = 'Self-harm or suicide', ViolenceOrThreateningContent = 'Violence or threatening content', SellingRestrictedItems = 'Selling and promoting restricted items', SexualContentOrNudity = 'Sexual message or nudity', SpamOrScams = 'Spam or scams', FalseInformation = 'False information or misinformation', Others = 'Others', } declare global { namespace Amity { type ContentFlagReason = | Exclude<`${ContentFlagReasonEnum}`, `${ContentFlagReasonEnum.Others}`> | (string & {}); type ContentType = | 'text' | 'image' | 'file' | 'video' | 'poll' | 'json' | 'liveStream' | 'clip' | string; type ContentFeedType = ValueOf<typeof ContentFeedType>; type ContentDataText = { title?: string | null; text: string; }; type ContentDataFile = { fileId: Amity.File<'file'>['fileId']; }; type ContentDataImage = { fileId: Amity.File<'image'>['fileId']; caption?: string; }; type Attachment = { type: 'image' | 'link'; url?: string; fileId?: Amity.File<'image'>['fileId']; }; type ContentDataVideo = { thumbnailFileId: Amity.File<'image'>['fileId']; videoFileId: { [K in Amity.VideoSize]?: Amity.File<'video'>['fileId']; }; }; type ContentDataClip = { thumbnailFileId: Amity.File<'image'>['fileId']; fileId: Amity.File<'clip'>['fileId']; isMuted?: boolean; displayMode?: Amity.ClipDisplayMode; }; type ContentDataPoll = { pollId: Amity.Poll['pollId']; }; type ContentDataStream = { streamId: Amity.Stream['streamId']; }; type ContentData<T extends ContentType> = T extends 'text' ? ContentDataText : T extends 'file' ? ContentDataFile : T extends 'image' ? ContentDataImage : T extends 'video' ? ContentDataVideo : T extends 'poll' ? ContentDataPoll : T extends 'liveStream' ? ContentDataStream : T extends 'clip' ? ContentDataClip : T extends 'json' ? Record<string, unknown> : T extends string ? string | Record<string, unknown> // custom type : never; type Content<T extends ContentType> = { // dataType still retained to maintain backward compatibility dataType?: T; dataTypes?: T[]; data?: ContentData<T>; }; type ContentSettingText = { contentType: 'text'; allowed: boolean; }; type ContentSettingVideo = { contentType: 'video'; allowed: boolean; maxDurationSeconds: number; transcodeConfig: { maxResolution: Amity.VideoResolution; minResolution: Amity.VideoResolution; }; }; type ContentSetting<T extends ContentType = 'text' | 'video'> = T extends 'text' ? ContentSettingText : T extends 'video' ? ContentSettingVideo : never; } }