UNPKG

yandex-music

Version:

Creative and progressive Node.js framework for applications that interact with yandex music

71 lines (70 loc) 3.38 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Track = void 0; const log_decorator_1 = require("../../decorators/log.decorator"); class Track { constructor(rotor) { this.rotor = rotor; } /** * * @param {string} station Station. * @param {Union} track_id The unique ID of the track. * @param {number} total How many seconds of the track were played before the action. * @param {string} batch_id Unique identifier of the batch of tracks. Returned when receiving tracks. * @returns OK if the request is successful */ async started(station, track_id, total = 0, batch_id) { return await this.rotor.feedback(station, "trackStarted", "", batch_id, total, track_id); } /** * * @param {string} station Station. * @param {Union} track_id The unique ID of the track. * @param {number} total How many seconds of the track were played before the action. * @param {string} batch_id Unique identifier of the batch of tracks. Returned when receiving tracks. * @returns OK if the request is successful */ async finished(station, track_id, total = 0, batch_id) { return await this.rotor.feedback(station, "trackFinished", "", batch_id, total, track_id); } /** * * @param {string} station Station. * @param {Union} track_id The unique ID of the track. * @param {number} total How many seconds of the track were played before the action. * @param {string} batch_id Unique identifier of the batch of tracks. Returned when receiving tracks. * @returns OK if the request is successful */ async skip(station, track_id, total = 0, batch_id) { return await this.rotor.feedback(station, "skip", "", batch_id, total, track_id); } } __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Number, String]), __metadata("design:returntype", Promise) ], Track.prototype, "started", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Number, String]), __metadata("design:returntype", Promise) ], Track.prototype, "finished", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object, Number, String]), __metadata("design:returntype", Promise) ], Track.prototype, "skip", null); exports.Track = Track;