]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/activitypub/activity.ts
Update server dependencies
[github/Chocobozzz/PeerTube.git] / shared / models / activitypub / activity.ts
1 import { ActivityPubActor } from './activitypub-actor'
2 import { ActivityPubSignature } from './activitypub-signature'
3 import { ActivityFlagReasonObject, CacheFileObject, VideoObject, WatchActionObject } from './objects'
4 import { AbuseObject } from './objects/abuse-object'
5 import { DislikeObject } from './objects/dislike-object'
6 import { APObject } from './objects/object.model'
7 import { PlaylistObject } from './objects/playlist-object'
8 import { VideoCommentObject } from './objects/video-comment-object'
9
10 export type Activity =
11 ActivityCreate |
12 ActivityUpdate |
13 ActivityDelete |
14 ActivityFollow |
15 ActivityAccept |
16 ActivityAnnounce |
17 ActivityUndo |
18 ActivityLike |
19 ActivityReject |
20 ActivityView |
21 ActivityDislike |
22 ActivityFlag
23
24 export type ActivityType =
25 'Create' |
26 'Update' |
27 'Delete' |
28 'Follow' |
29 'Accept' |
30 'Announce' |
31 'Undo' |
32 'Like' |
33 'Reject' |
34 'View' |
35 'Dislike' |
36 'Flag'
37
38 export interface ActivityAudience {
39 to: string[]
40 cc: string[]
41 }
42
43 export interface BaseActivity {
44 '@context'?: any[]
45 id: string
46 to?: string[]
47 cc?: string[]
48 actor: string | ActivityPubActor
49 type: ActivityType
50 signature?: ActivityPubSignature
51 }
52
53 export interface ActivityCreate extends BaseActivity {
54 type: 'Create'
55 object: VideoObject | AbuseObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject | WatchActionObject
56 }
57
58 export interface ActivityUpdate extends BaseActivity {
59 type: 'Update'
60 object: VideoObject | ActivityPubActor | CacheFileObject | PlaylistObject
61 }
62
63 export interface ActivityDelete extends BaseActivity {
64 type: 'Delete'
65 object: string | { id: string }
66 }
67
68 export interface ActivityFollow extends BaseActivity {
69 type: 'Follow'
70 object: string
71 }
72
73 export interface ActivityAccept extends BaseActivity {
74 type: 'Accept'
75 object: ActivityFollow
76 }
77
78 export interface ActivityReject extends BaseActivity {
79 type: 'Reject'
80 object: ActivityFollow
81 }
82
83 export interface ActivityAnnounce extends BaseActivity {
84 type: 'Announce'
85 object: APObject
86 }
87
88 export interface ActivityUndo extends BaseActivity {
89 type: 'Undo'
90 object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce
91 }
92
93 export interface ActivityLike extends BaseActivity {
94 type: 'Like'
95 object: APObject
96 }
97
98 export interface ActivityView extends BaseActivity {
99 type: 'View'
100 actor: string
101 object: APObject
102
103 // If sending a "viewer" event
104 expires?: string
105 }
106
107 export interface ActivityDislike extends BaseActivity {
108 id: string
109 type: 'Dislike'
110 actor: string
111 object: APObject
112 }
113
114 export interface ActivityFlag extends BaseActivity {
115 type: 'Flag'
116 content: string
117 object: APObject | APObject[]
118 tag?: ActivityFlagReasonObject[]
119 startAt?: number
120 endAt?: number
121 }