]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/types/models/video/video-playlist.ts
Add server API to abuse messages
[github/Chocobozzz/PeerTube.git] / server / types / models / video / video-playlist.ts
... / ...
CommitLineData
1import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2import { PickWith } from '@shared/core-utils'
3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4import { MThumbnail } from './thumbnail'
5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
6import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
7
8type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
9
10// ############################################################################
11
12export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
13
14// ############################################################################
15
16export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
17export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
18export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
19export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
20
21// ############################################################################
22
23// With elements
24
25export type MVideoPlaylistWithElements =
26 MVideoPlaylist &
27 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
28
29export type MVideoPlaylistIdWithElements =
30 MVideoPlaylistId &
31 Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
32
33// ############################################################################
34
35// With account
36
37export type MVideoPlaylistOwner =
38 MVideoPlaylist &
39 Use<'OwnerAccount', MAccount>
40
41export type MVideoPlaylistOwnerDefault =
42 MVideoPlaylist &
43 Use<'OwnerAccount', MAccountDefault>
44
45// ############################################################################
46
47// With thumbnail
48
49export type MVideoPlaylistThumbnail =
50 MVideoPlaylist &
51 Use<'Thumbnail', MThumbnail>
52
53export type MVideoPlaylistAccountThumbnail =
54 MVideoPlaylist &
55 Use<'OwnerAccount', MAccountDefault> &
56 Use<'Thumbnail', MThumbnail>
57
58// ############################################################################
59
60// With channel
61
62export type MVideoPlaylistAccountChannelDefault =
63 MVideoPlaylist &
64 Use<'OwnerAccount', MAccountDefault> &
65 Use<'VideoChannel', MChannelDefault>
66
67// ############################################################################
68
69// With all associations
70
71export type MVideoPlaylistFull =
72 MVideoPlaylist &
73 Use<'OwnerAccount', MAccountDefault> &
74 Use<'VideoChannel', MChannelDefault> &
75 Use<'Thumbnail', MThumbnail>
76
77// ############################################################################
78
79// For API
80
81export type MVideoPlaylistAccountChannelSummary =
82 MVideoPlaylist &
83 Use<'OwnerAccount', MAccountSummary> &
84 Use<'VideoChannel', MChannelSummary>
85
86export type MVideoPlaylistFullSummary =
87 MVideoPlaylist &
88 Use<'Thumbnail', MThumbnail> &
89 Use<'OwnerAccount', MAccountSummary> &
90 Use<'VideoChannel', MChannelSummary>
91
92// ############################################################################
93
94// Format for API or AP object
95
96export type MVideoPlaylistFormattable =
97 MVideoPlaylistVideosLength &
98 Use<'OwnerAccount', MAccountSummaryFormattable> &
99 Use<'VideoChannel', MChannelSummaryFormattable>
100
101export type MVideoPlaylistAP =
102 MVideoPlaylist &
103 Use<'Thumbnail', MThumbnail> &
104 Use<'VideoChannel', MChannelUrl>