UNPKG

ashi-smule

Version:

AshiTEAM Smule Song Downloader

471 lines 18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Stores the currently-being-typechecked object for error messages. var obj = null; var SmuleUserDataProxy = (function () { function SmuleUserDataProxy(d) { this.list = d.list; this.next_offset = d.next_offset; } SmuleUserDataProxy.Parse = function (d) { return SmuleUserDataProxy.Create(JSON.parse(d)); }; SmuleUserDataProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof (d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkArray(d.list, field + ".list"); if (d.list) { for (var i = 0; i < d.list.length; i++) { d.list[i] = ListEntityProxy.Create(d.list[i], field + ".list" + "[" + i + "]"); } } if (d.list === undefined) { d.list = null; } checkNumber(d.next_offset, false, field + ".next_offset"); return new SmuleUserDataProxy(d); }; return SmuleUserDataProxy; }()); exports.SmuleUserDataProxy = SmuleUserDataProxy; var ListEntityProxy = (function () { function ListEntityProxy(d) { this.key = d.key; this.performance_key = d.performance_key; this.join_link = d.join_link; this.type = d.type; this.title = d.title; this.artist = d.artist; this.message = d.message; this.created_at = d.created_at; this.expire_at = d.expire_at; this.seed = d.seed; this.closed = d.closed; this.ensemble_type = d.ensemble_type; this.child_count = d.child_count; this.app_uid = d.app_uid; this.arr_type = d.arr_type; this.arr_key = d.arr_key; this.song_id = d.song_id; this.perf_status = d.perf_status; this.artist_twitter = d.artist_twitter; this.orig_track_city = d.orig_track_city; this.media_url = d.media_url; this.video_media_url = d.video_media_url; this.video_media_mp4_url = d.video_media_mp4_url; this.cover_url = d.cover_url; this.web_url = d.web_url; this.song_info_url = d.song_info_url; this.stats = d.stats; this.performed_by = d.performed_by; this.performed_by_url = d.performed_by_url; this.owner = d.owner; this.other_performers = d.other_performers; this.duet = d.duet; this.other = d.other; this.featured = d.featured; this.rm = d.rm; this.private = d.private; } ListEntityProxy.Parse = function (d) { return ListEntityProxy.Create(JSON.parse(d)); }; ListEntityProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof (d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkString(d.key, false, field + ".key"); checkString(d.performance_key, true, field + ".performance_key"); checkNull(d.join_link, field + ".join_link"); if (d.join_link === undefined) { d.join_link = null; } checkString(d.type, true, field + ".type"); checkString(d.title, true, field + ".title"); checkString(d.artist, true, field + ".artist"); checkString(d.message, true, field + ".message"); if (d.message === undefined) { d.message = null; } checkString(d.created_at, true, field + ".created_at"); checkString(d.expire_at, true, field + ".expire_at"); if (d.expire_at === undefined) { d.expire_at = null; } checkBoolean(d.seed, true, field + ".seed"); checkBoolean(d.closed, true, field + ".closed"); checkString(d.ensemble_type, true, field + ".ensemble_type"); checkNumber(d.child_count, true, field + ".child_count"); checkString(d.app_uid, true, field + ".app_uid"); checkNull(d.arr_type, field + ".arr_type"); if (d.arr_type === undefined) { d.arr_type = null; } checkString(d.arr_key, true, field + ".arr_key"); checkString(d.song_id, true, field + ".song_id"); if (d.song_id === undefined) { d.song_id = null; } checkString(d.perf_status, true, field + ".perf_status"); checkNull(d.artist_twitter, field + ".artist_twitter"); if (d.artist_twitter === undefined) { d.artist_twitter = null; } d.orig_track_city = OrigTrackCityProxy.Create(d.orig_track_city, field + ".orig_track_city"); if (d.orig_track_city === undefined) { d.orig_track_city = null; } checkString(d.media_url, true, field + ".media_url"); checkString(d.video_media_url, true, field + ".video_media_url"); if (d.video_media_url === undefined) { d.video_media_url = null; } checkString(d.video_media_mp4_url, true, field + ".video_media_mp4_url"); if (d.video_media_mp4_url === undefined) { d.video_media_mp4_url = null; } checkString(d.cover_url, true, field + ".cover_url"); checkString(d.web_url, true, field + ".web_url"); checkNull(d.song_info_url, field + ".song_info_url"); if (d.song_info_url === undefined) { d.song_info_url = null; } d.stats = StatsProxy.Create(d.stats, field + ".stats"); checkString(d.performed_by, true, field + ".performed_by"); checkString(d.performed_by_url, true, field + ".performed_by_url"); d.owner = OwnerProxy.Create(d.owner, field + ".owner"); checkArray(d.other_performers, field + ".other_performers"); if (d.other_performers) { for (var i = 0; i < d.other_performers.length; i++) { d.other_performers[i] = OtherPerformersEntityOrDuetProxy.Create(d.other_performers[i], field + ".other_performers" + "[" + i + "]"); if (d.other_performers[i] === undefined) { d.other_performers[i] = null; } } } if (d.other_performers === undefined) { d.other_performers = null; } d.duet = OtherPerformersEntityOrDuet1Proxy.Create(d.duet, field + ".duet"); if (d.duet === undefined) { d.duet = null; } d.other = OtherProxy.Create(d.other, field + ".other"); if (d.other === undefined) { d.other = null; } checkBoolean(d.featured, false, field + ".featured"); //checkNull(d.rm, field + ".rm"); if (d.rm === undefined) { d.rm = null; } checkBoolean(d.private, false, field + ".private"); return new ListEntityProxy(d); }; return ListEntityProxy; }()); exports.ListEntityProxy = ListEntityProxy; var OrigTrackCityProxy = (function () { function OrigTrackCityProxy(d) { this.city = d.city; this.country = d.country; } OrigTrackCityProxy.Parse = function (d) { return OrigTrackCityProxy.Create(JSON.parse(d)); }; OrigTrackCityProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { return null; } else if (typeof (d) !== 'object') { throwNotObject(field, d, true); } else if (Array.isArray(d)) { throwIsArray(field, d, true); } checkString(d.city, true, field + ".city"); checkString(d.country, true, field + ".country"); return new OrigTrackCityProxy(d); }; return OrigTrackCityProxy; }()); exports.OrigTrackCityProxy = OrigTrackCityProxy; var StatsProxy = (function () { function StatsProxy(d) { this.total_performers = d.total_performers; this.truncated_other_performers = d.truncated_other_performers; this.total_listens = d.total_listens; this.truncated_listens = d.truncated_listens; this.total_loves = d.total_loves; this.truncated_loves = d.truncated_loves; this.total_comments = d.total_comments; this.truncated_comments = d.truncated_comments; } StatsProxy.Parse = function (d) { return StatsProxy.Create(JSON.parse(d)); }; StatsProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof (d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkNumber(d.total_performers, true, field + ".total_performers"); checkString(d.truncated_other_performers, true, field + ".truncated_other_performers"); checkNumber(d.total_listens, true, field + ".total_listens"); checkString(d.truncated_listens, true, field + ".truncated_listens"); checkNumber(d.total_loves, true, field + ".total_loves"); checkString(d.truncated_loves, true, field + ".truncated_loves"); checkNumber(d.total_comments, true, field + ".total_comments"); checkString(d.truncated_comments, true, field + ".truncated_comments"); return new StatsProxy(d); }; return StatsProxy; }()); exports.StatsProxy = StatsProxy; var OwnerProxy = (function () { function OwnerProxy(d) { this.account_id = d.account_id; this.handle = d.handle; this.pic_url = d.pic_url; this.lat = d.lat; this.lon = d.lon; this.url = d.url; this.is_vip = d.is_vip; this.is_verified = d.is_verified; } OwnerProxy.Parse = function (d) { return OwnerProxy.Create(JSON.parse(d)); }; OwnerProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof (d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkNumber(d.account_id, true, field + ".account_id"); checkString(d.handle, true, field + ".handle"); checkString(d.pic_url, true, field + ".pic_url"); checkNumber(d.lat, true, field + ".lat"); checkNumber(d.lon, true, field + ".lon"); checkString(d.url, true, field + ".url"); checkBoolean(d.is_vip, true, field + ".is_vip"); checkBoolean(d.is_verified, true, field + ".is_verified"); return new OwnerProxy(d); }; return OwnerProxy; }()); exports.OwnerProxy = OwnerProxy; var OtherPerformersEntityOrDuetProxy = (function () { function OtherPerformersEntityOrDuetProxy(d) { this.account_id = d.account_id; this.handle = d.handle; this.pic_url = d.pic_url; this.url = d.url; this.is_vip = d.is_vip; this.is_verified = d.is_verified; } OtherPerformersEntityOrDuetProxy.Parse = function (d) { return OtherPerformersEntityOrDuetProxy.Create(JSON.parse(d)); }; OtherPerformersEntityOrDuetProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { return null; } else if (typeof (d) !== 'object') { throwNotObject(field, d, true); } else if (Array.isArray(d)) { throwIsArray(field, d, true); } checkNumber(d.account_id, true, field + ".account_id"); checkString(d.handle, true, field + ".handle"); checkString(d.pic_url, true, field + ".pic_url"); checkString(d.url, true, field + ".url"); checkBoolean(d.is_vip, true, field + ".is_vip"); checkBoolean(d.is_verified, true, field + ".is_verified"); return new OtherPerformersEntityOrDuetProxy(d); }; return OtherPerformersEntityOrDuetProxy; }()); exports.OtherPerformersEntityOrDuetProxy = OtherPerformersEntityOrDuetProxy; var OtherPerformersEntityOrDuet1Proxy = (function () { function OtherPerformersEntityOrDuet1Proxy(d) { this.account_id = d.account_id; this.handle = d.handle; this.pic_url = d.pic_url; this.url = d.url; this.is_vip = d.is_vip; this.is_verified = d.is_verified; } OtherPerformersEntityOrDuet1Proxy.Parse = function (d) { return OtherPerformersEntityOrDuet1Proxy.Create(JSON.parse(d)); }; OtherPerformersEntityOrDuet1Proxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { return null; } else if (typeof (d) !== 'object') { throwNotObject(field, d, true); } else if (Array.isArray(d)) { throwIsArray(field, d, true); } checkNumber(d.account_id, true, field + ".account_id"); checkString(d.handle, true, field + ".handle"); checkString(d.pic_url, true, field + ".pic_url"); checkString(d.url, true, field + ".url"); checkBoolean(d.is_vip, true, field + ".is_vip"); checkBoolean(d.is_verified, true, field + ".is_verified"); return new OtherPerformersEntityOrDuet1Proxy(d); }; return OtherPerformersEntityOrDuet1Proxy; }()); exports.OtherPerformersEntityOrDuet1Proxy = OtherPerformersEntityOrDuet1Proxy; var OtherProxy = (function () { function OtherProxy(d) { this.pic_url = d.pic_url; this.url = d.url; this.label = d.label; this.vip = d.vip; this.id = d.id; this.verified_urls = d.verified_urls; } OtherProxy.Parse = function (d) { return OtherProxy.Create(JSON.parse(d)); }; OtherProxy.Create = function (d, field) { if (field === void 0) { field = 'root'; } if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { return null; } else if (typeof (d) !== 'object') { throwNotObject(field, d, true); } else if (Array.isArray(d)) { throwIsArray(field, d, true); } checkString(d.pic_url, true, field + ".pic_url"); if (d.pic_url === undefined) { d.pic_url = null; } checkString(d.url, true, field + ".url"); if (d.url === undefined) { d.url = null; } checkString(d.label, true, field + ".label"); checkBoolean(d.vip, true, field + ".vip"); checkNumber(d.id, true, field + ".id"); if (d.id === undefined) { d.id = null; } checkNull(d.verified_urls, field + ".verified_urls"); if (d.verified_urls === undefined) { d.verified_urls = null; } return new OtherProxy(d); }; return OtherProxy; }()); exports.OtherProxy = OtherProxy; function throwNull2NonNull(field, d) { return errorHelper(field, d, "non-nullable object", false); } function throwNotObject(field, d, nullable) { return errorHelper(field, d, "object", nullable); } function throwIsArray(field, d, nullable) { return errorHelper(field, d, "object", nullable); } function checkArray(d, field) { if (!Array.isArray(d) && d !== null && d !== undefined) { errorHelper(field, d, "array", true); } } function checkNumber(d, nullable, field) { if (typeof (d) !== 'number' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "number", nullable); } } function checkBoolean(d, nullable, field) { if (typeof (d) !== 'boolean' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "boolean", nullable); } } function checkString(d, nullable, field) { if (typeof (d) !== 'string' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "string", nullable); } } function checkNull(d, field) { if (d !== null && d !== undefined) { errorHelper(field, d, "null or undefined", false); } } function errorHelper(field, d, type, nullable) { if (nullable) { type += ", null, or undefined"; } throw new TypeError('Expected ' + type + " at " + field + " but found:\n" + JSON.stringify(d) + "\n\nFull object:\n" + JSON.stringify(obj)); } //# sourceMappingURL=SmuleUserData.js.map