setFeaturedVideos.ts 805 B

123456789101112131415161718192021222324252627
  1. import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
  2. export default class SetFeaturedVideosCommand extends ContentDirectoryCommandBase {
  3. static description = 'Set featured videos. Requires lead access.'
  4. static args = [
  5. {
  6. name: 'featuredVideoIds',
  7. required: true,
  8. description: 'Comma-separated video IDs (ie. 1,2,3)',
  9. },
  10. ]
  11. async run() {
  12. const { featuredVideoIds } = this.parse(SetFeaturedVideosCommand).args
  13. const currentAccount = await this.getRequiredSelectedAccount()
  14. await this.requestAccountDecoding(currentAccount)
  15. const actor = await this.getActor('Lead')
  16. await this.sendAndFollowNamedTx(currentAccount, 'content', 'setFeaturedVideos', [
  17. actor,
  18. (featuredVideoIds as string).split(','),
  19. ])
  20. }
  21. }