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

74 lines
2 KiB
TypeScript
Raw Normal View History

2018-01-03 10:38:50 -05:00
import { ActivityPubActor } from './activitypub-actor'
2017-11-09 11:51:58 -05:00
import { ActivityPubSignature } from './activitypub-signature'
2018-09-11 10:27:07 -04:00
import { CacheFileObject, VideoTorrentObject } from './objects'
2017-11-23 08:19:55 -05:00
import { DislikeObject } from './objects/dislike-object'
2017-11-15 09:12:23 -05:00
import { VideoAbuseObject } from './objects/video-abuse-object'
import { VideoCommentObject } from './objects/video-comment-object'
2017-11-22 10:25:03 -05:00
import { ViewObject } from './objects/view-object'
2017-11-09 11:51:58 -05:00
2017-12-14 11:38:41 -05:00
export type Activity = ActivityCreate | ActivityUpdate |
2017-11-20 03:43:39 -05:00
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
2018-01-11 11:37:49 -05:00
ActivityUndo | ActivityLike | ActivityReject
2017-11-09 11:51:58 -05:00
2018-01-11 11:37:49 -05:00
export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject'
2017-11-09 11:51:58 -05:00
export interface ActivityAudience {
to: string[]
cc: string[]
}
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[]
actor: string | ActivityPubActor
2017-11-09 11:51:58 -05:00
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'
2018-09-11 10:27:07 -04:00
object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject
2017-11-09 11:51:58 -05:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
2018-09-11 10:27:07 -04:00
object: VideoTorrentObject | ActivityPubActor | CacheFileObject
2017-11-09 11:51:58 -05:00
}
2017-11-13 11:39:41 -05:00
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
2018-01-04 11:50:30 -05:00
object: string | { id: string }
2017-11-13 11:39:41 -05:00
}
export interface ActivityFollow extends BaseActivity {
type: 'Follow'
object: string
}
export interface ActivityAccept extends BaseActivity {
type: 'Accept'
2017-12-19 04:34:56 -05:00
object: ActivityFollow
2017-11-13 11:39:41 -05:00
}
2017-11-15 11:56:21 -05:00
2018-01-11 11:37:49 -05:00
export interface ActivityReject extends BaseActivity {
type: 'Reject'
object: ActivityFollow
}
2017-11-15 11:56:21 -05:00
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
2018-01-26 06:02:18 -05:00
object: string | { id: string }
2017-11-15 11:56:21 -05:00
}
2017-11-20 03:43:39 -05:00
export interface ActivityUndo extends BaseActivity {
type: 'Undo',
2018-05-11 09:10:13 -04:00
object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce
2017-11-23 08:19:55 -05:00
}
export interface ActivityLike extends BaseActivity {
type: 'Like',
object: string
2017-11-20 03:43:39 -05:00
}