]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/types/models/video/video-streaming-playlist.ts
Move typescript utils in its own directory
[github/Chocobozzz/PeerTube.git] / server / types / models / video / video-streaming-playlist.ts
CommitLineData
6b5f72be 1import { PickWith, PickWithOpt } from '@shared/typescript-utils'
453e83ea 2import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
d7a25329
C
3import { MVideo } from './video'
4import { MVideoFile } from './video-file'
6b5f72be 5import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
453e83ea 6
0283eaac
C
7type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
8
9// ############################################################################
10
d7a25329
C
11export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
12
a1587156
C
13export type MStreamingPlaylistFiles =
14 MStreamingPlaylist &
d7a25329 15 Use<'VideoFiles', MVideoFile[]>
453e83ea 16
a1587156
C
17export type MStreamingPlaylistVideo =
18 MStreamingPlaylist &
0283eaac 19 Use<'Video', MVideo>
453e83ea 20
a1587156
C
21export type MStreamingPlaylistFilesVideo =
22 MStreamingPlaylist &
d7a25329
C
23 Use<'VideoFiles', MVideoFile[]> &
24 Use<'Video', MVideo>
25
a1587156
C
26export type MStreamingPlaylistRedundanciesAll =
27 MStreamingPlaylist &
b764380a
C
28 Use<'VideoFiles', MVideoFile[]> &
29 Use<'RedundancyVideos', MVideoRedundancy[]>
30
a1587156
C
31export type MStreamingPlaylistRedundancies =
32 MStreamingPlaylist &
d7a25329 33 Use<'VideoFiles', MVideoFile[]> &
0283eaac 34 Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
b5fecbf4 35
a1587156
C
36export type MStreamingPlaylistRedundanciesOpt =
37 MStreamingPlaylist &
d7a25329 38 Use<'VideoFiles', MVideoFile[]> &
b5fecbf4 39 PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
d7a25329
C
40
41export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
764b1a14 42 return !!(value as MStreamingPlaylist).videoId
d7a25329 43}