]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/typings/models/video/video.ts
Add missing button roles for the language chooser and keyboard shortcut menu items
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video.ts
CommitLineData
453e83ea
C
1import { VideoModel } from '../../../models/video/video'
2import { PickWith, PickWithOpt } from '../../utils'
1ca9f7c3
C
3import {
4 MChannelAccountDefault,
5 MChannelAccountLight,
6 MChannelAccountSummaryFormattable,
7 MChannelActor,
8 MChannelFormattable,
9 MChannelUserId
10} from './video-channels'
453e83ea
C
11import { MTag } from './tag'
12import { MVideoCaptionLanguage } from './video-caption'
b5fecbf4 13import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist'
453e83ea
C
14import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file'
15import { MThumbnail } from './thumbnail'
1ca9f7c3 16import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
453e83ea
C
17import { MScheduleVideoUpdate } from './schedule-video-update'
18import { MUserVideoHistoryTime } from '../user/user-video-history'
19
0283eaac
C
20type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
21
22// ############################################################################
23
453e83ea
C
24export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
25 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
26 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
27
0283eaac
C
28// ############################################################################
29
453e83ea
C
30export type MVideoId = Pick<MVideo, 'id'>
31export type MVideoUrl = Pick<MVideo, 'url'>
32export type MVideoUUID = Pick<MVideo, 'uuid'>
33
34export type MVideoIdUrl = MVideoId & MVideoUrl
35export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
36
0283eaac
C
37// ############################################################################
38
39// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
40
41// "With" to not confuse with the VideoFile model
453e83ea 42export type MVideoWithFile = MVideo &
0283eaac 43 Use<'VideoFiles', MVideoFile[]>
453e83ea
C
44
45export type MVideoThumbnail = MVideo &
0283eaac
C
46 Use<'Thumbnails', MThumbnail[]>
47
48export type MVideoIdThumbnail = MVideoId &
49 Use<'Thumbnails', MThumbnail[]>
50
51export type MVideoWithFileThumbnail = MVideo &
52 Use<'VideoFiles', MVideoFile[]> &
53 Use<'Thumbnails', MThumbnail[]>
453e83ea 54
d636ab58
C
55export type MVideoThumbnailBlacklist = MVideo &
56 Use<'Thumbnails', MThumbnail[]> &
57 Use<'VideoBlacklist', MVideoBlacklistLight>
58
453e83ea 59export type MVideoTag = MVideo &
0283eaac 60 Use<'Tags', MTag[]>
453e83ea
C
61
62export type MVideoWithSchedule = MVideo &
63 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
64
0283eaac
C
65export type MVideoWithCaptions = MVideo &
66 Use<'VideoCaptions', MVideoCaptionLanguage[]>
453e83ea 67
0283eaac
C
68export type MVideoWithStreamingPlaylist = MVideo &
69 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
453e83ea 70
0283eaac
C
71// ############################################################################
72
73// Associations with not all their attributes
74
75export type MVideoUserHistory = MVideo &
76 Use<'UserVideoHistories', MUserVideoHistoryTime[]>
453e83ea
C
77
78export type MVideoWithBlacklistLight = MVideo &
0283eaac 79 Use<'VideoBlacklist', MVideoBlacklistLight>
453e83ea
C
80
81export type MVideoAccountLight = MVideo &
0283eaac 82 Use<'VideoChannel', MChannelAccountLight>
453e83ea 83
0283eaac
C
84export type MVideoWithRights = MVideo &
85 Use<'VideoBlacklist', MVideoBlacklistLight> &
86 Use<'Thumbnails', MThumbnail[]> &
87 Use<'VideoChannel', MChannelUserId>
453e83ea 88
0283eaac 89// ############################################################################
453e83ea 90
0283eaac 91// All files with some additional associations
453e83ea 92
0283eaac
C
93export type MVideoWithAllFiles = MVideo &
94 Use<'VideoFiles', MVideoFile[]> &
95 Use<'Thumbnails', MThumbnail[]> &
96 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
453e83ea 97
0283eaac
C
98export type MVideoAccountLightBlacklistAllFiles = MVideo &
99 Use<'VideoFiles', MVideoFile[]> &
100 Use<'Thumbnails', MThumbnail[]> &
101 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
102 Use<'VideoChannel', MChannelAccountLight> &
103 Use<'VideoBlacklist', MVideoBlacklistLight>
453e83ea 104
0283eaac
C
105// ############################################################################
106
107// With account
453e83ea
C
108
109export type MVideoAccountDefault = MVideo &
0283eaac 110 Use<'VideoChannel', MChannelAccountDefault>
453e83ea 111
0283eaac
C
112export type MVideoThumbnailAccountDefault = MVideo &
113 Use<'Thumbnails', MThumbnail[]> &
114 Use<'VideoChannel', MChannelAccountDefault>
453e83ea
C
115
116export type MVideoWithChannelActor = MVideo &
0283eaac
C
117 Use<'VideoChannel', MChannelActor>
118
119export type MVideoFullLight = MVideo &
120 Use<'Thumbnails', MThumbnail[]> &
121 Use<'VideoBlacklist', MVideoBlacklistLight> &
122 Use<'Tags', MTag[]> &
123 Use<'VideoChannel', MChannelAccountLight> &
124 Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
125 Use<'VideoFiles', MVideoFile[]> &
126 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
127 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]>
128
129// ############################################################################
130
131// API
453e83ea
C
132
133export type MVideoAP = MVideo &
0283eaac
C
134 Use<'Tags', MTag[]> &
135 Use<'VideoChannel', MChannelAccountLight> &
136 Use<'VideoStreamingPlaylists', MStreamingPlaylist[]> &
137 Use<'VideoCaptions', MVideoCaptionLanguage[]> &
138 Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
139 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
453e83ea
C
140
141export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
142
143export type MVideoDetails = MVideo &
0283eaac
C
144 Use<'VideoBlacklist', MVideoBlacklistLight> &
145 Use<'Tags', MTag[]> &
146 Use<'VideoChannel', MChannelAccountLight> &
147 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
148 Use<'Thumbnails', MThumbnail[]> &
149 Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
150 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
151 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
152
153export type MVideoForUser = MVideo &
154 Use<'VideoChannel', MChannelAccountDefault> &
155 Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
156 Use<'VideoBlacklist', MVideoBlacklistLight> &
157 Use<'Thumbnails', MThumbnail[]>
1ca9f7c3
C
158
159// ############################################################################
160
161// Format for API or AP object
162
163export type MVideoFormattable = MVideo &
164 PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
165 Use<'VideoChannel', MChannelAccountSummaryFormattable> &
166 PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
167 PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
168
169export type MVideoFormattableDetails = MVideoFormattable &
170 Use<'VideoChannel', MChannelFormattable> &
171 Use<'Tags', MTag[]> &
b5fecbf4 172 Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
1ca9f7c3 173 Use<'VideoFiles', MVideoFileRedundanciesOpt[]>