@pubby.club/sdk
Version:
Pubby Development Kit
71 lines (70 loc) • 2.56 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Rest_1 = require("../../../lib/Rest");
var PlaylistService = /** @class */ (function (_super) {
__extends(PlaylistService, _super);
function PlaylistService(api) {
return _super.call(this, api, "me/playlists") || this;
}
PlaylistService.prototype.getMedias = function (playlistId, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "GET",
url: playlistId + "/items",
params: params,
});
};
PlaylistService.prototype.addMedia = function (playlistId, media, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "POST",
url: playlistId + "/items",
data: media,
params: params,
});
};
PlaylistService.prototype.deleteMedia = function (playlistId, mediaId, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "DELETE",
url: playlistId + "/items/" + mediaId,
params: params,
});
};
PlaylistService.prototype.updateMedia = function (playlistId, media, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "PATCH",
url: playlistId + "/items/" + media.id,
data: media,
params: params,
});
};
PlaylistService.prototype.moveMedia = function (playlistId, fromId, targetId, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "PATCH",
url: playlistId + "/items",
params: params,
data: {
from: fromId,
target: targetId,
},
});
};
return PlaylistService;
}(Rest_1.Rest));
exports.default = PlaylistService;