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