PeerTube/shared/models/activitypub/activity.ts

57 lines
1.4 KiB
TypeScript
Raw Normal View History

2017-11-15 08:12:23 -06:00
import { VideoChannelObject, VideoTorrentObject } from './objects'
2017-11-09 10:51:58 -06:00
import { ActivityPubSignature } from './activitypub-signature'
2017-11-15 08:12:23 -06:00
import { VideoAbuseObject } from './objects/video-abuse-object'
2017-11-09 10:51:58 -06:00
2017-11-13 10:39:41 -06:00
export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | ActivityFlag |
2017-11-15 10:56:21 -06:00
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce
2017-11-09 10:51:58 -06:00
// Flag -> report abuse
2017-11-15 10:56:21 -06:00
export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
2017-11-09 10:51:58 -06:00
export interface BaseActivity {
'@context'?: any[]
id: string
to: string[]
actor: string
type: ActivityType
signature: ActivityPubSignature
}
export interface ActivityCreate extends BaseActivity {
type: 'Create'
2017-11-15 08:12:23 -06:00
object: VideoChannelObject | VideoAbuseObject
2017-11-10 07:34:45 -06:00
}
export interface ActivityAdd extends BaseActivity {
type: 'Add'
object: VideoTorrentObject
2017-11-09 10:51:58 -06:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
object: VideoTorrentObject | VideoChannelObject
}
export interface ActivityFlag extends BaseActivity {
type: 'Flag'
object: string
}
2017-11-13 10:39:41 -06: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 10:56:21 -06:00
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
object: VideoChannelObject | VideoTorrentObject
}