Handle follow/accept
[oweals/peertube.git] / shared / models / activitypub / activity.ts
1 import {
2   VideoChannelObject,
3   VideoTorrentObject
4 } from './objects'
5 import { ActivityPubSignature } from './activitypub-signature'
6
7 export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | ActivityFlag |
8   ActivityDelete | ActivityFollow | ActivityAccept
9
10 // Flag -> report abuse
11 export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag' | 'Delete' | 'Follow' | 'Accept'
12
13 export interface BaseActivity {
14   '@context'?: any[]
15   id: string
16   to: string[]
17   actor: string
18   type: ActivityType
19   signature: ActivityPubSignature
20 }
21
22 export interface ActivityCreate extends BaseActivity {
23   type: 'Create'
24   object: VideoChannelObject
25 }
26
27 export interface ActivityAdd extends BaseActivity {
28   type: 'Add'
29   object: VideoTorrentObject
30 }
31
32 export interface ActivityUpdate extends BaseActivity {
33   type: 'Update'
34   object: VideoTorrentObject | VideoChannelObject
35 }
36
37 export interface ActivityFlag extends BaseActivity {
38   type: 'Flag'
39   object: string
40 }
41
42 export interface ActivityDelete extends BaseActivity {
43   type: 'Delete'
44 }
45
46 export interface ActivityFollow extends BaseActivity {
47   type: 'Follow'
48   object: string
49 }
50
51 export interface ActivityAccept extends BaseActivity {
52   type: 'Accept'
53 }