@pubby/sdk
Version:
Pubby Development Kit
75 lines (72 loc) • 2.57 kB
JavaScript
import { __extends } from 'tslib';
import { Rest } from '../../../lib/Rest.js';
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.addMedias = function (playlistId, medias, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "POST",
url: playlistId + "/items",
data: medias,
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, target, direction, params) {
if (params === void 0) { params = {}; }
return this.request({
method: "PATCH",
url: playlistId + "/items/" + fromId + "/move",
params: params,
data: { target: target, direction: direction },
});
};
PlaylistService.prototype.getImportToken = function () {
return this.request({
method: "GET",
baseURL: this.baseURL + "/import",
url: "token",
}).then(function (res) { return res.token; });
};
PlaylistService.prototype.exportAll = function () {
return this.request({
method: "GET",
url: "/export",
});
};
PlaylistService.prototype.shuffle = function (playlistId) {
return this.request({
method: "PATCH",
url: playlistId + "/shuffle",
});
};
return PlaylistService;
}(Rest));
export { PlaylistService as default };