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

120 lines
2.7 KiB
TypeScript
Raw Normal View History

2018-01-03 15:38:50 +00:00
import { ActivityPubActor } from './activitypub-actor'
2017-11-09 16:51:58 +00:00
import { ActivityPubSignature } from './activitypub-signature'
2020-09-17 11:59:02 +00:00
import { ActivityFlagReasonObject, CacheFileObject, VideoObject } from './objects'
2020-07-01 14:05:30 +00:00
import { AbuseObject } from './objects/abuse-object'
2017-11-23 13:19:55 +00:00
import { DislikeObject } from './objects/dislike-object'
import { APObject } from './objects/object.model'
2019-02-26 09:55:40 +00:00
import { PlaylistObject } from './objects/playlist-object'
2020-07-01 14:05:30 +00:00
import { VideoCommentObject } from './objects/video-comment-object'
import { ViewObject } from './objects/view-object'
2017-11-09 16:51:58 +00:00
2020-01-31 15:56:52 +00:00
export type Activity =
ActivityCreate |
ActivityUpdate |
ActivityDelete |
ActivityFollow |
ActivityAccept |
ActivityAnnounce |
ActivityUndo |
ActivityLike |
ActivityReject |
ActivityView |
ActivityDislike |
ActivityFlag
export type ActivityType =
'Create' |
'Update' |
'Delete' |
'Follow' |
'Accept' |
'Announce' |
'Undo' |
'Like' |
'Reject' |
'View' |
'Dislike' |
'Flag'
2017-11-09 16:51:58 +00:00
export interface ActivityAudience {
to: string[]
cc: string[]
}
2017-11-09 16:51:58 +00:00
export interface BaseActivity {
'@context'?: any[]
id: string
2017-11-17 10:35:10 +00:00
to?: string[]
2017-11-17 14:20:42 +00:00
cc?: string[]
actor: string | ActivityPubActor
2017-11-09 16:51:58 +00:00
type: ActivityType
2017-11-17 10:35:10 +00:00
signature?: ActivityPubSignature
2017-11-09 16:51:58 +00:00
}
export interface ActivityCreate extends BaseActivity {
type: 'Create'
2020-09-17 11:59:02 +00:00
object: VideoObject | AbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject
2017-11-09 16:51:58 +00:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
2020-09-17 11:59:02 +00:00
object: VideoObject | ActivityPubActor | CacheFileObject | PlaylistObject
2017-11-09 16:51:58 +00:00
}
2017-11-13 16:39:41 +00:00
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
2018-01-04 16:50:30 +00:00
object: string | { id: string }
2017-11-13 16:39:41 +00:00
}
export interface ActivityFollow extends BaseActivity {
type: 'Follow'
object: string
}
export interface ActivityAccept extends BaseActivity {
type: 'Accept'
2017-12-19 09:34:56 +00:00
object: ActivityFollow
2017-11-13 16:39:41 +00:00
}
2017-11-15 16:56:21 +00:00
2018-01-11 16:37:49 +00:00
export interface ActivityReject extends BaseActivity {
type: 'Reject'
object: ActivityFollow
}
2017-11-15 16:56:21 +00:00
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
object: APObject
2017-11-15 16:56:21 +00:00
}
2017-11-20 08:43:39 +00:00
export interface ActivityUndo extends BaseActivity {
2020-01-31 15:56:52 +00:00
type: 'Undo'
object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce
2017-11-23 13:19:55 +00:00
}
export interface ActivityLike extends BaseActivity {
2020-01-31 15:56:52 +00:00
type: 'Like'
object: APObject
}
export interface ActivityView extends BaseActivity {
2020-01-31 15:56:52 +00:00
type: 'View'
actor: string
object: APObject
}
export interface ActivityDislike extends BaseActivity {
id: string
type: 'Dislike'
actor: string
object: APObject
}
export interface ActivityFlag extends BaseActivity {
2020-01-31 15:56:52 +00:00
type: 'Flag'
content: string
2019-08-30 07:40:21 +00:00
object: APObject | APObject[]
tag?: ActivityFlagReasonObject[]
startAt?: number
endAt?: number
2017-11-20 08:43:39 +00:00
}