@amityco/ts-sdk-react-native
Version:
Amity Social Cloud Typescript SDK
55 lines (49 loc) • 1.39 kB
text/typescript
export function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'fileId' in post.data &&
post.dataType === 'image'
);
}
export function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'fileId' in post.data &&
post.dataType === 'file'
);
}
export function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'videoFileId' in post.data &&
'thumbnailFileId' in post.data &&
post.dataType === 'video'
);
}
export function isAmityLivestreamPost(post: Amity.InternalPost): post is Amity.Post<'liveStream'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'streamId' in post.data &&
post.dataType === 'liveStream'
);
}
export function isAmityPollPost(post: Amity.InternalPost): post is Amity.Post<'poll'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'pollId' in post.data &&
post.dataType === 'poll'
);
}
export function isAmityClipPost(post: Amity.InternalPost): post is Amity.Post<'clip'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'fileId' in post.data &&
post.dataType === 'clip'
);
}