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