1 import { VideoModel } from '../models/video/video'
3 type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none'
5 function fetchVideo (id: number | string, fetchType: VideoFetchType, userId?: number) {
6 if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId)
8 if (fetchType === 'only-video-with-rights') return VideoModel.loadWithRights(id)
10 if (fetchType === 'only-video') return VideoModel.load(id)
12 if (fetchType === 'id' || fetchType === 'none') return VideoModel.loadOnlyId(id)
15 type VideoFetchByUrlType = 'all' | 'only-video'
16 function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType) {
17 if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url)
19 if (fetchType === 'only-video') return VideoModel.loadByUrl(url)