Skip to content

More documentation about hooks #3249

Open
@kontrollanten

Description

@kontrollanten

It'd be good with more details regarding when different hooks are triggered and which arguments are sent to the callback. Below is my proposed assumptions, correct me if I'm wrong. If I'm correct and it's welcome I'll create a PR to extend the documentation.

action:api.video.updated

Triggered when a video is updated via the REST API (i.e. transcoding doesn't count as an update). The callback is called with a VideoModel describing current and previous data.

{
   video: {
     dataValues: VideoModel,
     _previousDataValues: VideoModel,
     _changed: Object, // Describing which properties that changed.
     _modelOptions: {},
     _options: {},
     isNewRecord: bool,
     Thumbnails: [ [ThumbnailModel], [ThumbnailModel] ],
     VideoChannel: VideoChannelModel {
       dataValues: [Object],
       _previousDataValues: [Object],
       _changed: {},
       _modelOptions: [Object],
       _options: [Object],
       isNewRecord: false,
       Actor: [ActorModel],
       Account: [AccountModel]
     },
     VideoFiles: [ [VideoFileModel] ]
   }
 }

action:api.video.uploaded

Triggered when a upload is completed. It doesn't get triggered upon imports.

{
   video: {
     dataValues: VideoModel,
     _previousDataValues: VideoModel,
     _changed: Object, // Describing which properties that changed.
     _modelOptions: {},
     _options: {},
     isNewRecord: bool,
     Thumbnails: [ [ThumbnailModel], [ThumbnailModel] ],
     VideoChannel: VideoChannelModel {
       dataValues: [Object],
       _previousDataValues: [Object],
       _changed: {},
       _modelOptions: [Object],
       _options: [Object],
       isNewRecord: false,
       Actor: [ActorModel],
       Account: [AccountModel]
     },
     VideoFiles: [ [VideoFileModel] ]
   }
 }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions