allow limiting video-comments rss feeds to an account or video channel
[oweals/peertube.git] / shared / models / server / job.model.ts
1 import { SendEmailOptions } from './emailer.model'
2 import { VideoResolution } from '@shared/models'
3 import { ContextType } from '../activitypub/context'
4
5 export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed'
6
7 export type JobType =
8   | 'activitypub-http-unicast'
9   | 'activitypub-http-broadcast'
10   | 'activitypub-http-fetcher'
11   | 'activitypub-follow'
12   | 'video-file-import'
13   | 'video-transcoding'
14   | 'email'
15   | 'video-import'
16   | 'videos-views'
17   | 'activitypub-refresher'
18   | 'video-redundancy'
19
20 export interface Job {
21   id: number
22   state: JobState
23   type: JobType
24   data: any
25   error: any
26   createdAt: Date | string
27   finishedOn: Date | string
28   processedOn: Date | string
29 }
30
31 export type ActivitypubHttpBroadcastPayload = {
32   uris: string[]
33   signatureActorId?: number
34   body: any
35   contextType?: ContextType
36 }
37
38 export type ActivitypubFollowPayload = {
39   followerActorId: number
40   name: string
41   host: string
42   isAutoFollow?: boolean
43   assertIsChannel?: boolean
44 }
45
46 export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
47 export type ActivitypubHttpFetcherPayload = {
48   uri: string
49   type: FetchType
50   videoId?: number
51   accountId?: number
52 }
53
54 export type ActivitypubHttpUnicastPayload = {
55   uri: string
56   signatureActorId?: number
57   body: any
58   contextType?: ContextType
59 }
60
61 export type RefreshPayload = {
62   type: 'video' | 'video-playlist' | 'actor'
63   url: string
64 }
65
66 export type EmailPayload = SendEmailOptions
67
68 export type VideoFileImportPayload = {
69   videoUUID: string
70   filePath: string
71 }
72
73 export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
74 export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
75
76 export type VideoImportYoutubeDLPayload = {
77   type: VideoImportYoutubeDLPayloadType
78   videoImportId: number
79
80   generateThumbnail: boolean
81   generatePreview: boolean
82
83   fileExt?: string
84 }
85 export type VideoImportTorrentPayload = {
86   type: VideoImportTorrentPayloadType
87   videoImportId: number
88 }
89 export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
90
91 export type VideoRedundancyPayload = {
92   videoId: number
93 }
94
95 // Video transcoding payloads
96
97 interface BaseTranscodingPayload {
98   videoUUID: string
99   isNewVideo?: boolean
100 }
101
102 interface HLSTranscodingPayload extends BaseTranscodingPayload {
103   type: 'hls'
104   isPortraitMode?: boolean
105   resolution: VideoResolution
106   copyCodecs: boolean
107 }
108
109 export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
110   type: 'new-resolution'
111   isPortraitMode?: boolean
112   resolution: VideoResolution
113 }
114
115 export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
116   type: 'merge-audio'
117   resolution: VideoResolution
118 }
119
120 export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
121   type: 'optimize'
122 }
123
124 export type VideoTranscodingPayload =
125   HLSTranscodingPayload
126   | NewResolutionTranscodingPayload
127   | OptimizeTranscodingPayload
128   | MergeAudioTranscodingPayload