]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/activitypub/activity.ts
Correctly forward like/dislikes and undo
[github/Chocobozzz/PeerTube.git] / shared / models / activitypub / activity.ts
1 import { ActivityPubSignature } from './activitypub-signature'
2 import { VideoChannelObject, VideoTorrentObject } from './objects'
3 import { DislikeObject } from './objects/dislike-object'
4 import { VideoAbuseObject } from './objects/video-abuse-object'
5 import { ViewObject } from './objects/view-object'
6
7 export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
8 ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
9 ActivityUndo | ActivityLike
10
11 export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like'
12
13 export interface ActivityAudience {
14 to: string[]
15 cc: string[]
16 }
17
18 export interface BaseActivity {
19 '@context'?: any[]
20 id: string
21 to?: string[]
22 cc?: string[]
23 actor: string
24 type: ActivityType
25 signature?: ActivityPubSignature
26 }
27
28 export interface ActivityCreate extends BaseActivity {
29 type: 'Create'
30 object: VideoChannelObject | VideoAbuseObject | ViewObject | DislikeObject
31 }
32
33 export interface ActivityAdd extends BaseActivity {
34 type: 'Add'
35 target: string
36 object: VideoTorrentObject
37 }
38
39 export interface ActivityUpdate extends BaseActivity {
40 type: 'Update'
41 object: VideoTorrentObject | VideoChannelObject
42 }
43
44 export interface ActivityDelete extends BaseActivity {
45 type: 'Delete'
46 }
47
48 export interface ActivityFollow extends BaseActivity {
49 type: 'Follow'
50 object: string
51 }
52
53 export interface ActivityAccept extends BaseActivity {
54 type: 'Accept'
55 }
56
57 export interface ActivityAnnounce extends BaseActivity {
58 type: 'Announce'
59 object: ActivityCreate | ActivityAdd
60 }
61
62 export interface ActivityUndo extends BaseActivity {
63 type: 'Undo',
64 object: ActivityFollow | ActivityLike | ActivityCreate
65 }
66
67 export interface ActivityLike extends BaseActivity {
68 type: 'Like',
69 object: string
70 }