]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/models/activitypub/activity.ts
Federate likes/dislikes
[github/Chocobozzz/PeerTube.git] / shared / models / activitypub / activity.ts
index dc562c00a4c366e86054dff81783c1d496827fcf..cbfd6157a3723befa97b79d70dbff6828953bb42 100644 (file)
@@ -1,30 +1,33 @@
-import {
-  VideoChannelObject,
-  VideoTorrentObject
-} from './objects'
 import { ActivityPubSignature } from './activitypub-signature'
+import { VideoChannelObject, VideoTorrentObject } from './objects'
+import { DislikeObject } from './objects/dislike-object'
+import { VideoAbuseObject } from './objects/video-abuse-object'
+import { ViewObject } from './objects/view-object'
 
-export type Activity = ActivityCreate | ActivityUpdate | ActivityFlag
+export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
+  ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
+  ActivityUndo | ActivityLike
 
-// Flag -> report abuse
-export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag'
+export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like'
 
 export interface BaseActivity {
   '@context'?: any[]
   id: string
-  to: string[]
+  to?: string[]
+  cc?: string[]
   actor: string
   type: ActivityType
-  signature: ActivityPubSignature
+  signature?: ActivityPubSignature
 }
 
 export interface ActivityCreate extends BaseActivity {
   type: 'Create'
-  object: VideoChannelObject
+  object: VideoChannelObject | VideoAbuseObject | ViewObject | DislikeObject
 }
 
 export interface ActivityAdd extends BaseActivity {
   type: 'Add'
+  target: string
   object: VideoTorrentObject
 }
 
@@ -33,7 +36,30 @@ export interface ActivityUpdate extends BaseActivity {
   object: VideoTorrentObject | VideoChannelObject
 }
 
-export interface ActivityFlag extends BaseActivity {
-  type: 'Flag'
+export interface ActivityDelete extends BaseActivity {
+  type: 'Delete'
+}
+
+export interface ActivityFollow extends BaseActivity {
+  type: 'Follow'
+  object: string
+}
+
+export interface ActivityAccept extends BaseActivity {
+  type: 'Accept'
+}
+
+export interface ActivityAnnounce extends BaseActivity {
+  type: 'Announce'
+  object: ActivityCreate | ActivityAdd
+}
+
+export interface ActivityUndo extends BaseActivity {
+  type: 'Undo',
+  object: ActivityFollow | ActivityLike | ActivityCreate
+}
+
+export interface ActivityLike extends BaseActivity {
+  type: 'Like',
   object: string
 }