js-spotify-wrapper
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -104,6 +104,10 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _config = __webpack_require__(4); | ||
var _artist = __webpack_require__(4); | ||
var _utils = __webpack_require__(5); | ||
var _artist2 = _interopRequireDefault(_artist); | ||
var _config = __webpack_require__(5); | ||
var _utils = __webpack_require__(6); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -122,2 +126,3 @@ | ||
this.search = _search2.default.bind(this)(); | ||
this.artist = _artist2.default.bind(this)(); | ||
} | ||
@@ -208,2 +213,36 @@ | ||
}); | ||
exports.default = artist; | ||
function artist() { | ||
var _this = this; | ||
return { | ||
getArtist: function getArtist(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id); | ||
}, | ||
getArtists: function getArtists(ids) { | ||
return _this.request(_this.apiURL + "/artists/?ids=" + ids); | ||
}, | ||
getArtistAlbums: function getArtistAlbums(id, tipo) { | ||
if (!tipo) return _this.request(_this.apiURL + "/artists/" + id + "/albums"); | ||
return _this.request(_this.apiURL + "/artists/" + id + "/albums?album_type=" + tipo); | ||
}, | ||
getArtistTopTracks: function getArtistTopTracks(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id + "/top-tracks"); | ||
}, | ||
getArtistRelated: function getArtistRelated(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id + "/related-artists"); | ||
} | ||
}; | ||
} | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var API_URL = exports.API_URL = 'https://api.spotify.com/v1'; | ||
@@ -213,3 +252,3 @@ exports.default = API_URL; | ||
/***/ }), | ||
/* 5 */ | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -216,0 +255,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SpotifyWrapper=t():e.SpotifyWrapper=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){e.exports=n(1).default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(2),s=r(o),a=n(3),c=r(a),f=n(4),l=n(5),p=function(){function e(t){u(this,e),this.apiURL=t.apiURL||f.API_URL,this.token=t.token,this.album=c.default.bind(this)(),this.search=s.default.bind(this)()}return i(e,[{key:"request",value:function(e){var t={method:"GET",headers:{Accept:"application/json",Authorization:"Bearer "+this.token}};return fetch(e,t).then(l.toJSON)}}]),e}();t.default=p},function(e,t,n){"use strict";function r(e,t){var n=t.replace(/ /g,"+"),r=e.toString();return this.request(this.apiURL+"/search?q="+n+"&type="+r)}function u(){return{searchAlbums:r.bind(this,"album"),searchArtists:r.bind(this,"artist"),searchPlaylists:r.bind(this,"playlist"),searchTracks:r.bind(this,"track")}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=u},function(e,t,n){"use strict";function r(){var e=this;return{getAlbum:function(t){return e.request(e.apiURL+"/albums/"+t)},getAlbums:function(t){return e.request(e.apiURL+"/albums/?ids="+t)},getTracks:function(t){return e.request(e.apiURL+"/albums/"+t+"/tracks")}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.API_URL="https://api.spotify.com/v1";t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.toJSON=function(e){return e.json()};t.default=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SpotifyWrapper=e():t.SpotifyWrapper=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){t.exports=r(1).default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=r(2),o=n(s),a=r(3),c=n(a),f=r(4),l=n(f),p=r(5),d=r(6),b=function(){function t(e){i(this,t),this.apiURL=e.apiURL||p.API_URL,this.token=e.token,this.album=c.default.bind(this)(),this.search=o.default.bind(this)(),this.artist=l.default.bind(this)()}return u(t,[{key:"request",value:function(t){var e={method:"GET",headers:{Accept:"application/json",Authorization:"Bearer "+this.token}};return fetch(t,e).then(d.toJSON)}}]),t}();e.default=b},function(t,e,r){"use strict";function n(t,e){var r=e.replace(/ /g,"+"),n=t.toString();return this.request(this.apiURL+"/search?q="+r+"&type="+n)}function i(){return{searchAlbums:n.bind(this,"album"),searchArtists:n.bind(this,"artist"),searchPlaylists:n.bind(this,"playlist"),searchTracks:n.bind(this,"track")}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i},function(t,e,r){"use strict";function n(){var t=this;return{getAlbum:function(e){return t.request(t.apiURL+"/albums/"+e)},getAlbums:function(e){return t.request(t.apiURL+"/albums/?ids="+e)},getTracks:function(e){return t.request(t.apiURL+"/albums/"+e+"/tracks")}}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=n},function(t,e,r){"use strict";function n(){var t=this;return{getArtist:function(e){return t.request(t.apiURL+"/artists/"+e)},getArtists:function(e){return t.request(t.apiURL+"/artists/?ids="+e)},getArtistAlbums:function(e,r){return r?t.request(t.apiURL+"/artists/"+e+"/albums?album_type="+r):t.request(t.apiURL+"/artists/"+e+"/albums")},getArtistTopTracks:function(e){return t.request(t.apiURL+"/artists/"+e+"/top-tracks")},getArtistRelated:function(e){return t.request(t.apiURL+"/artists/"+e+"/related-artists")}}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.API_URL="https://api.spotify.com/v1";e.default=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.toJSON=function(t){return t.json()};e.default=n}])}); | ||
//# sourceMappingURL=spotify-wrapper.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,23 +6,24 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.getArtistRelated = exports.getArtistTopTracks = exports.getArtistAlbums = exports.getArtists = exports.getArtist = undefined; | ||
exports.default = artist; | ||
function artist() { | ||
var _this = this; | ||
var _config = require('./config'); | ||
var _utils = require('./utils'); | ||
var getArtist = exports.getArtist = function getArtist(id) { | ||
return fetch(_config.API_URL + '/artists/' + id, _config.HEADERS).then(_utils.toJSON); | ||
}; | ||
var getArtists = exports.getArtists = function getArtists(ids) { | ||
return fetch(_config.API_URL + '/artists/' + ids, _config.HEADERS).then(_utils.toJSON); | ||
}; | ||
var getArtistAlbums = exports.getArtistAlbums = function getArtistAlbums(id, tipo) { | ||
if (!tipo) return fetch(_config.API_URL + '/artists/' + id + '/albums', _config.HEADERS).then(_utils.toJSON); | ||
return fetch(_config.API_URL + '/artists/' + id + '/albums?album_type=' + tipo, _config.HEADERS).then(_utils.toJSON); | ||
}; | ||
var getArtistTopTracks = exports.getArtistTopTracks = function getArtistTopTracks(id) { | ||
return fetch(_config.API_URL + '/artists/' + id + '/top-tracks', _config.HEADERS).then(_utils.toJSON); | ||
}; | ||
var getArtistRelated = exports.getArtistRelated = function getArtistRelated(id) { | ||
return fetch(_config.API_URL + '/artists/' + id + '/related-artists', _config.HEADERS).then(_utils.toJSON); | ||
}; | ||
return { | ||
getArtist: function getArtist(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id); | ||
}, | ||
getArtists: function getArtists(ids) { | ||
return _this.request(_this.apiURL + "/artists/?ids=" + ids); | ||
}, | ||
getArtistAlbums: function getArtistAlbums(id, tipo) { | ||
if (!tipo) return _this.request(_this.apiURL + "/artists/" + id + "/albums"); | ||
return _this.request(_this.apiURL + "/artists/" + id + "/albums?album_type=" + tipo); | ||
}, | ||
getArtistTopTracks: function getArtistTopTracks(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id + "/top-tracks"); | ||
}, | ||
getArtistRelated: function getArtistRelated(id) { | ||
return _this.request(_this.apiURL + "/artists/" + id + "/related-artists"); | ||
} | ||
}; | ||
} |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _artist = require('./artist'); | ||
var _artist2 = _interopRequireDefault(_artist); | ||
var _config = require('../src/config'); | ||
@@ -35,2 +39,3 @@ | ||
this.search = _search2.default.bind(this)(); | ||
this.artist = _artist2.default.bind(this)(); | ||
} | ||
@@ -37,0 +42,0 @@ |
{ | ||
"name": "js-spotify-wrapper", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Uma aplicação para trabalhar com Spotify Web API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
55687
343
3