aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/activitypub/activity.ts
blob: f8e982fbb79b0622d7e73cf8b3f9e7e8f0149dda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { VideoChannelObject, VideoTorrentObject } from './objects'
import { ActivityPubSignature } from './activitypub-signature'
import { VideoAbuseObject } from './objects/video-abuse-object'

export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | ActivityFlag |
  ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce

// Flag -> report abuse
export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag' | 'Delete' | 'Follow' | 'Accept' | 'Announce'

export interface BaseActivity {
  '@context'?: any[]
  id: string
  to: string[]
  actor: string
  type: ActivityType
  signature: ActivityPubSignature
}

export interface ActivityCreate extends BaseActivity {
  type: 'Create'
  object: VideoChannelObject | VideoAbuseObject
}

export interface ActivityAdd extends BaseActivity {
  type: 'Add'
  target: string
  object: VideoTorrentObject
}

export interface ActivityUpdate extends BaseActivity {
  type: 'Update'
  object: VideoTorrentObject | VideoChannelObject
}

export interface ActivityFlag extends BaseActivity {
  type: 'Flag'
  object: string
}

export interface ActivityDelete extends BaseActivity {
  type: 'Delete'
}

export interface ActivityFollow extends BaseActivity {
  type: 'Follow'
  object: string
}

export interface ActivityAccept extends BaseActivity {
  type: 'Accept'
}

export interface ActivityAnnounce extends BaseActivity {
  type: 'Announce'
  object: ActivityCreate | ActivityAdd
}