1
0
Fork 0
peertube/shared/models/activitypub/activity.ts

54 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-11-15 09:12:23 -05:00
import { VideoChannelObject, VideoTorrentObject } from './objects'
2017-11-09 11:51:58 -05:00
import { ActivityPubSignature } from './activitypub-signature'
2017-11-15 09:12:23 -05:00
import { VideoAbuseObject } from './objects/video-abuse-object'
2017-11-09 11:51:58 -05:00
2017-11-17 09:52:26 -05:00
export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
2017-11-15 11:56:21 -05:00
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce
2017-11-09 11:51:58 -05:00
// Flag -> report abuse
2017-11-17 09:52:26 -05:00
export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
2017-11-09 11:51:58 -05:00
export interface BaseActivity {
'@context'?: any[]
id: string
2017-11-17 05:35:10 -05:00
to?: string[]
2017-11-17 09:20:42 -05:00
cc?: string[]
2017-11-09 11:51:58 -05:00
actor: string
type: ActivityType
2017-11-17 05:35:10 -05:00
signature?: ActivityPubSignature
2017-11-09 11:51:58 -05:00
}
export interface ActivityCreate extends BaseActivity {
type: 'Create'
2017-11-15 09:12:23 -05:00
object: VideoChannelObject | VideoAbuseObject
2017-11-10 08:34:45 -05:00
}
export interface ActivityAdd extends BaseActivity {
type: 'Add'
2017-11-16 09:22:39 -05:00
target: string
2017-11-10 08:34:45 -05:00
object: VideoTorrentObject
2017-11-09 11:51:58 -05:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
object: VideoTorrentObject | VideoChannelObject
}
2017-11-13 11:39:41 -05:00
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
}
export interface ActivityFollow extends BaseActivity {
type: 'Follow'
object: string
}
export interface ActivityAccept extends BaseActivity {
type: 'Accept'
}
2017-11-15 11:56:21 -05:00
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
2017-11-16 09:22:39 -05:00
object: ActivityCreate | ActivityAdd
2017-11-15 11:56:21 -05:00
}