PeerTube/shared/models/activitypub/activity.ts

117 lines
2.6 KiB
TypeScript
Raw Normal View History

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