UNPKG

yandex-music

Version:

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

64 lines (63 loc) 2.76 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.Playlists = void 0; const log_decorator_1 = require("../../../decorators/log.decorator"); class Playlists { constructor(likes) { this.likes = likes; } /** * Mark "I like" the playlist/playlists. * @param {List} ids The unique identifier of the playlist or playlists. * @param {string} user_id Unique user ID. * @returns OK if the request is successful. */ async add(ids, user_id = this.likes.client.uid) { return await this.likes.action("playlist", ids, false, user_id); } /** * Remove the "I like" mark from the playlist/playlists. * @param {List} ids The unique identifier of the playlist or playlists. * @param {string} user_id Unique user ID. * @returns OK if the request is successful. */ async remove(ids, user_id = this.likes.client.uid) { return await this.likes.action("playlist", ids, true, user_id); } /** * Getting playlists marked "I like". * @param {number} user_id Unique user ID. * @returns Playlists info. */ async get(user_id = this.likes.client.uid) { return await this.likes.get("playlist", user_id); } } __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, Number]), __metadata("design:returntype", Promise) ], Playlists.prototype, "add", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [Array, Number]), __metadata("design:returntype", Promise) ], Playlists.prototype, "remove", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise) ], Playlists.prototype, "get", null); exports.Playlists = Playlists;