PeerTube/shared/models/activitypub/activity.ts

69 lines
1.8 KiB
TypeScript
Raw Normal View History

2018-01-03 16:38:50 +01:00
import { ActivityPubActor } from './activitypub-actor'
2017-11-09 17:51:58 +01:00
import { ActivityPubSignature } from './activitypub-signature'
2017-12-14 17:38:41 +01:00
import { VideoTorrentObject } from './objects'
2017-11-23 14:19:55 +01:00
import { DislikeObject } from './objects/dislike-object'
2017-11-15 15:12:23 +01:00
import { VideoAbuseObject } from './objects/video-abuse-object'
import { VideoCommentObject } from './objects/video-comment-object'
2017-11-22 16:25:03 +01:00
import { ViewObject } from './objects/view-object'
2017-11-09 17:51:58 +01:00
2017-12-14 17:38:41 +01:00
export type Activity = ActivityCreate | ActivityUpdate |
2017-11-20 09:43:39 +01:00
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
2017-11-23 14:19:55 +01:00
ActivityUndo | ActivityLike
2017-11-09 17:51:58 +01:00
2017-12-14 17:38:41 +01:00
export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like'
2017-11-09 17:51:58 +01:00
export interface ActivityAudience {
to: string[]
cc: string[]
}
2017-11-09 17:51:58 +01:00
export interface BaseActivity {
'@context'?: any[]
id: string
2017-11-17 11:35:10 +01:00
to?: string[]
2017-11-17 15:20:42 +01:00
cc?: string[]
2017-11-09 17:51:58 +01:00
actor: string
type: ActivityType
2017-11-17 11:35:10 +01:00
signature?: ActivityPubSignature
2017-11-09 17:51:58 +01:00
}
export interface ActivityCreate extends BaseActivity {
type: 'Create'
object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject
2017-11-09 17:51:58 +01:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
2018-01-03 16:38:50 +01:00
object: VideoTorrentObject | ActivityPubActor
2017-11-09 17:51:58 +01:00
}
2017-11-13 17:39:41 +01:00
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
2018-01-04 16:56:36 +01:00
object: string
2017-11-13 17:39:41 +01:00
}
export interface ActivityFollow extends BaseActivity {
type: 'Follow'
object: string
}
export interface ActivityAccept extends BaseActivity {
type: 'Accept'
2017-12-19 10:34:56 +01:00
object: ActivityFollow
2017-11-13 17:39:41 +01:00
}
2017-11-15 17:56:21 +01:00
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
2017-12-19 17:07:58 +01:00
object: ActivityCreate | string
2017-11-15 17:56:21 +01:00
}
2017-11-20 09:43:39 +01:00
export interface ActivityUndo extends BaseActivity {
type: 'Undo',
2017-11-23 14:19:55 +01:00
object: ActivityFollow | ActivityLike | ActivityCreate
}
export interface ActivityLike extends BaseActivity {
type: 'Like',
object: string
2017-11-20 09:43:39 +01:00
}