PeerTube/shared/models/activitypub/activity.ts

71 lines
1.8 KiB
TypeScript
Raw Normal View History

2017-11-09 10:51:58 -06:00
import { ActivityPubSignature } from './activitypub-signature'
2017-11-22 09:25:03 -06:00
import { VideoChannelObject, 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'
2017-11-22 09:25:03 -06:00
import { ViewObject } from './objects/view-object'
2017-11-09 10:51:58 -06:00
2017-11-17 08:52:26 -06:00
export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
2017-11-20 02:43:39 -06:00
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
2017-11-23 07:19:55 -06:00
ActivityUndo | ActivityLike
2017-11-09 10:51:58 -06:00
2017-11-23 07:19:55 -06:00
export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like'
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[]
2017-11-09 10:51:58 -06:00
actor: string
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'
2017-11-23 07:19:55 -06:00
object: VideoChannelObject | VideoAbuseObject | ViewObject | DislikeObject
2017-11-10 07:34:45 -06:00
}
export interface ActivityAdd extends BaseActivity {
type: 'Add'
2017-11-16 08:22:39 -06:00
target: string
2017-11-10 07:34:45 -06:00
object: VideoTorrentObject
2017-11-09 10:51:58 -06:00
}
export interface ActivityUpdate extends BaseActivity {
type: 'Update'
object: VideoTorrentObject | VideoChannelObject
}
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'
2017-11-16 08:22:39 -06:00
object: ActivityCreate | ActivityAdd
2017-11-15 10:56:21 -06:00
}
2017-11-20 02:43:39 -06:00
export interface ActivityUndo extends BaseActivity {
type: 'Undo',
2017-11-23 07:19:55 -06:00
object: ActivityFollow | ActivityLike | ActivityCreate
}
export interface ActivityLike extends BaseActivity {
type: 'Like',
object: string
2017-11-20 02:43:39 -06:00
}