activity.ts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import { ActivityPubActor } from './activitypub-actor'
  2. import { ActivityPubSignature } from './activitypub-signature'
  3. import { CacheFileObject, VideoTorrentObject } from './objects'
  4. import { DislikeObject } from './objects/dislike-object'
  5. import { VideoAbuseObject } from './objects/video-abuse-object'
  6. import { VideoCommentObject } from './objects/video-comment-object'
  7. import { ViewObject } from './objects/view-object'
  8. import { APObject } from './objects/object.model'
  9. import { PlaylistObject } from './objects/playlist-object'
  10. export type Activity = ActivityCreate | ActivityUpdate |
  11. ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |
  12. ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag
  13. export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' |
  14. 'View' | 'Dislike' | 'Flag'
  15. export interface ActivityAudience {
  16. to: string[]
  17. cc: string[]
  18. }
  19. export interface BaseActivity {
  20. '@context'?: any[]
  21. id: string
  22. to?: string[]
  23. cc?: string[]
  24. actor: string | ActivityPubActor
  25. type: ActivityType
  26. signature?: ActivityPubSignature
  27. }
  28. export interface ActivityCreate extends BaseActivity {
  29. type: 'Create'
  30. object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject
  31. }
  32. export interface ActivityUpdate extends BaseActivity {
  33. type: 'Update'
  34. object: VideoTorrentObject | ActivityPubActor | CacheFileObject | PlaylistObject
  35. }
  36. export interface ActivityDelete extends BaseActivity {
  37. type: 'Delete'
  38. object: string | { id: string }
  39. }
  40. export interface ActivityFollow extends BaseActivity {
  41. type: 'Follow'
  42. object: string
  43. }
  44. export interface ActivityAccept extends BaseActivity {
  45. type: 'Accept'
  46. object: ActivityFollow
  47. }
  48. export interface ActivityReject extends BaseActivity {
  49. type: 'Reject'
  50. object: ActivityFollow
  51. }
  52. export interface ActivityAnnounce extends BaseActivity {
  53. type: 'Announce'
  54. object: APObject
  55. }
  56. export interface ActivityUndo extends BaseActivity {
  57. type: 'Undo',
  58. object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce
  59. }
  60. export interface ActivityLike extends BaseActivity {
  61. type: 'Like',
  62. object: APObject
  63. }
  64. export interface ActivityView extends BaseActivity {
  65. type: 'View',
  66. actor: string
  67. object: APObject
  68. }
  69. export interface ActivityDislike extends BaseActivity {
  70. id: string
  71. type: 'Dislike'
  72. actor: string
  73. object: APObject
  74. }
  75. export interface ActivityFlag extends BaseActivity {
  76. type: 'Flag',
  77. content: string,
  78. object: APObject
  79. }