UNPKG

yandex-music

Version:

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

89 lines (88 loc) 3.47 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.Account = void 0; const log_decorator_1 = require("../decorators/log.decorator"); class Account { constructor(client) { this.client = client; } /** * Getting account status. * @returns Account information if it is valid, otherwise null. */ async status() { return await this.client.request.get("/account/status"); } /** * Getting the current user's settings. * @returns User settings if the account is valid, otherwise null. */ async settings() { return await this.client.request.get("/account/settings"); } /** * Changing the settings of the current user. * @returns Updated user settings if the account is valid, otherwise null. */ async update(data) { return await this.client.request.post("/account/settings", null, data); } /** * Getting the values of experimental account functions. * @returns State of experimental functions. */ async experiments() { return await this.client.request.post("/account/experiments", null); } /** * Activation of the promo code. * @param {any} data * code: Promo code. * * language: API response language in ISO 639-1. * @returns Информация об активации промо-кода */ async promo(data) { return await this.client.request.post("/account/consume-promo-code", null, data); } } __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], Account.prototype, "status", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], Account.prototype, "settings", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], Account.prototype, "update", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Promise) ], Account.prototype, "experiments", null); __decorate([ (0, log_decorator_1.log)(), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], Account.prototype, "promo", null); exports.Account = Account;