js-spotify-wrapper
Advanced tools
Comparing version 1.0.2 to 1.1.4
@@ -7,5 +7,5 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
else if(typeof exports === 'object') | ||
exports["spotifyWrapper"] = factory(); | ||
exports["SpotifyWrapper"] = factory(); | ||
else | ||
root["spotifyWrapper"] = factory(); | ||
root["SpotifyWrapper"] = factory(); | ||
})(typeof self !== 'undefined' ? self : this, function() { | ||
@@ -74,3 +74,3 @@ return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 2); | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
@@ -82,10 +82,5 @@ /************************************************************************/ | ||
"use strict"; | ||
module.exports = __webpack_require__(1).default; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var API_URL = exports.API_URL = 'https://api.spotify.com/v1'; | ||
/***/ }), | ||
@@ -101,6 +96,52 @@ /* 1 */ | ||
}); | ||
var toJSON = exports.toJSON = function toJSON(data) { | ||
return data.json(); | ||
}; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _search = __webpack_require__(2); | ||
var _search2 = _interopRequireDefault(_search); | ||
var _album = __webpack_require__(3); | ||
var _album2 = _interopRequireDefault(_album); | ||
var _config = __webpack_require__(4); | ||
var _utils = __webpack_require__(5); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var SpotifyWrapper = function () { | ||
function SpotifyWrapper(options) { | ||
_classCallCheck(this, SpotifyWrapper); | ||
this.apiURL = options.apiURL || _config.API_URL; | ||
this.token = options.token; | ||
this.album = _album2.default.bind(this)(); | ||
this.search = _search2.default.bind(this)(); | ||
} | ||
_createClass(SpotifyWrapper, [{ | ||
key: 'request', | ||
value: function request(url) { | ||
var headers = { | ||
method: 'GET', | ||
headers: { | ||
Accept: 'application/json', | ||
Authorization: 'Bearer ' + this.token | ||
} | ||
}; | ||
return fetch(url, headers).then(_utils.toJSON); | ||
} | ||
}]); | ||
return SpotifyWrapper; | ||
}(); | ||
exports.default = SpotifyWrapper; | ||
/***/ }), | ||
@@ -113,17 +154,21 @@ /* 2 */ | ||
var _search = __webpack_require__(3); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = search; | ||
function searchAll(type, query) { | ||
var queryStr = query.replace(/ /g, '+'); | ||
var typeConcat = type.toString(); | ||
return this.request(this.apiURL + '/search?q=' + queryStr + '&type=' + typeConcat); | ||
} | ||
var _album = __webpack_require__(4); | ||
function search() { | ||
return { | ||
searchAlbums: searchAll.bind(this, 'album'), | ||
searchArtists: searchAll.bind(this, 'artist'), | ||
searchPlaylists: searchAll.bind(this, 'playlist'), | ||
searchTracks: searchAll.bind(this, 'track') | ||
}; | ||
} | ||
module.exports = { | ||
searchAll: _search.searchAll, | ||
searchAlbums: _search.searchAlbums, | ||
searchArtists: _search.searchArtists, | ||
searchPlaylists: _search.searchPlaylists, | ||
searchTracks: _search.searchTracks, | ||
getAlbum: _album.getAlbum, | ||
getAlbums: _album.getAlbums, | ||
getAlbumTracks: _album.getAlbumTracks | ||
}; | ||
/***/ }), | ||
@@ -139,31 +184,18 @@ /* 3 */ | ||
}); | ||
exports.searchPlaylists = exports.searchTracks = exports.searchArtists = exports.searchAlbums = exports.searchAll = undefined; | ||
exports.default = album; | ||
function album() { | ||
var _this = this; | ||
var _config = __webpack_require__(0); | ||
var _utils = __webpack_require__(1); | ||
var searchAll = exports.searchAll = function searchAll(query, type) { | ||
var queryStr = query.replace(/ /g, '+'); | ||
var typeConcat = type.toString(); | ||
return fetch(_config.API_URL + '/search?q=' + queryStr + '&type=' + typeConcat, { | ||
method: 'GET', | ||
headers: { | ||
Accept: 'application/json', | ||
Authorization: 'Bearer ' + 'BQAwpBOhcpLarwnioHhMvlvXS0vm4KpYexccjobXtF_ew_oUoybQMvX1kRwnO2lsacApiR8eLPZo4eB1Baoj-iwHTk7UvkCZJRzOudGcE0ALHBayioqi47v_ubSnLA4n4zg7oDP2_WKkjwoE' | ||
return { | ||
getAlbum: function getAlbum(id) { | ||
return _this.request(_this.apiURL + "/albums/" + id); | ||
}, | ||
getAlbums: function getAlbums(ids) { | ||
return _this.request(_this.apiURL + "/albums/?ids=" + ids); | ||
}, | ||
getTracks: function getTracks(id) { | ||
return _this.request(_this.apiURL + "/albums/" + id + "/tracks"); | ||
} | ||
}).then(_utils.toJSON); | ||
}; | ||
var searchAlbums = exports.searchAlbums = function searchAlbums(query) { | ||
return searchAll(query, 'album'); | ||
}; | ||
var searchArtists = exports.searchArtists = function searchArtists(query) { | ||
return searchAll(query, 'artist'); | ||
}; | ||
var searchTracks = exports.searchTracks = function searchTracks(query) { | ||
return searchAll(query, 'track'); | ||
}; | ||
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) { | ||
return searchAll(query, 'playlist'); | ||
}; | ||
}; | ||
} | ||
@@ -180,17 +212,19 @@ /***/ }), | ||
}); | ||
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined; | ||
var API_URL = exports.API_URL = 'https://api.spotify.com/v1'; | ||
exports.default = API_URL; | ||
var _config = __webpack_require__(0); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var _utils = __webpack_require__(1); | ||
"use strict"; | ||
var getAlbum = exports.getAlbum = function getAlbum(id) { | ||
return fetch(_config.API_URL + '/albums/' + id).then(_utils.toJSON); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var toJSON = exports.toJSON = function toJSON(data) { | ||
return data.json(); | ||
}; | ||
var getAlbums = exports.getAlbums = function getAlbums(ids) { | ||
return fetch(_config.API_URL + '/albums/' + ids).then(_utils.toJSON); | ||
}; | ||
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) { | ||
return fetch(_config.API_URL + '/albums/' + id + '/tracks').then(_utils.toJSON); | ||
}; | ||
exports.default = toJSON; | ||
@@ -197,0 +231,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(s){if(r[s])return r[s].exports;var n=r[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,s){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.API_URL="https://api.spotify.com/v1"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.toJSON=function(e){return e.json()}},function(e,t,r){"use strict";var s=r(3),n=r(4);e.exports={searchAll:s.searchAll,searchAlbums:s.searchAlbums,searchArtists:s.searchArtists,searchPlaylists:s.searchPlaylists,searchTracks:s.searchTracks,getAlbum:n.getAlbum,getAlbums:n.getAlbums,getAlbumTracks:n.getAlbumTracks}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.searchPlaylists=t.searchTracks=t.searchArtists=t.searchAlbums=t.searchAll=void 0;var s=r(0),n=r(1),c=t.searchAll=function(e,t){var r=e.replace(/ /g,"+"),c=t.toString();return fetch(s.API_URL+"/search?q="+r+"&type="+c,{method:"GET",headers:{Accept:"application/json",Authorization:"Bearer BQAwpBOhcpLarwnioHhMvlvXS0vm4KpYexccjobXtF_ew_oUoybQMvX1kRwnO2lsacApiR8eLPZo4eB1Baoj-iwHTk7UvkCZJRzOudGcE0ALHBayioqi47v_ubSnLA4n4zg7oDP2_WKkjwoE"}}).then(n.toJSON)};t.searchAlbums=function(e){return c(e,"album")},t.searchArtists=function(e){return c(e,"artist")},t.searchTracks=function(e){return c(e,"track")},t.searchPlaylists=function(e){return c(e,"playlist")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAlbumTracks=t.getAlbums=t.getAlbum=void 0;var s=r(0),n=r(1);t.getAlbum=function(e){return fetch(s.API_URL+"/albums/"+e).then(n.toJSON)},t.getAlbums=function(e){return fetch(s.API_URL+"/albums/"+e).then(n.toJSON)},t.getAlbumTracks=function(e){return fetch(s.API_URL+"/albums/"+e+"/tracks").then(n.toJSON)}}])}); | ||
!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}])}); | ||
//# sourceMappingURL=spotify-wrapper.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,16 +6,17 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined; | ||
exports.default = album; | ||
function album() { | ||
var _this = this; | ||
var _config = require('./config'); | ||
var _utils = require('./utils'); | ||
var getAlbum = exports.getAlbum = function getAlbum(id) { | ||
return fetch(_config.API_URL + '/albums/' + id).then(_utils.toJSON); | ||
}; | ||
var getAlbums = exports.getAlbums = function getAlbums(ids) { | ||
return fetch(_config.API_URL + '/albums/' + ids).then(_utils.toJSON); | ||
}; | ||
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) { | ||
return fetch(_config.API_URL + '/albums/' + id + '/tracks').then(_utils.toJSON); | ||
}; | ||
return { | ||
getAlbum: function getAlbum(id) { | ||
return _this.request(_this.apiURL + "/albums/" + id); | ||
}, | ||
getAlbums: function getAlbums(ids) { | ||
return _this.request(_this.apiURL + "/albums/?ids=" + ids); | ||
}, | ||
getTracks: function getTracks(id) { | ||
return _this.request(_this.apiURL + "/albums/" + id + "/tracks"); | ||
} | ||
}; | ||
} |
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
var API_URL = exports.API_URL = 'https://api.spotify.com/v1'; | ||
var API_URL = exports.API_URL = 'https://api.spotify.com/v1'; | ||
exports.default = API_URL; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _search = require('./search'); | ||
var _search2 = _interopRequireDefault(_search); | ||
var _album = require('./album'); | ||
module.exports = { | ||
searchAll: _search.searchAll, | ||
searchAlbums: _search.searchAlbums, | ||
searchArtists: _search.searchArtists, | ||
searchPlaylists: _search.searchPlaylists, | ||
searchTracks: _search.searchTracks, | ||
getAlbum: _album.getAlbum, | ||
getAlbums: _album.getAlbums, | ||
getAlbumTracks: _album.getAlbumTracks | ||
}; | ||
var _album2 = _interopRequireDefault(_album); | ||
var _config = require('../src/config'); | ||
var _utils = require('../src/utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var SpotifyWrapper = function () { | ||
function SpotifyWrapper(options) { | ||
_classCallCheck(this, SpotifyWrapper); | ||
this.apiURL = options.apiURL || _config.API_URL; | ||
this.token = options.token; | ||
this.album = _album2.default.bind(this)(); | ||
this.search = _search2.default.bind(this)(); | ||
} | ||
_createClass(SpotifyWrapper, [{ | ||
key: 'request', | ||
value: function request(url) { | ||
var headers = { | ||
method: 'GET', | ||
headers: { | ||
Accept: 'application/json', | ||
Authorization: 'Bearer ' + this.token | ||
} | ||
}; | ||
return fetch(url, headers).then(_utils.toJSON); | ||
} | ||
}]); | ||
return SpotifyWrapper; | ||
}(); | ||
exports.default = SpotifyWrapper; |
@@ -6,30 +6,16 @@ 'use strict'; | ||
}); | ||
exports.searchPlaylists = exports.searchTracks = exports.searchArtists = exports.searchAlbums = exports.searchAll = undefined; | ||
var _config = require('./config'); | ||
var _utils = require('./utils'); | ||
var searchAll = exports.searchAll = function searchAll(query, type) { | ||
exports.default = search; | ||
function searchAll(type, query) { | ||
var queryStr = query.replace(/ /g, '+'); | ||
var typeConcat = type.toString(); | ||
return fetch(_config.API_URL + '/search?q=' + queryStr + '&type=' + typeConcat, { | ||
method: 'GET', | ||
headers: { | ||
Accept: 'application/json', | ||
Authorization: 'Bearer ' + 'BQAwpBOhcpLarwnioHhMvlvXS0vm4KpYexccjobXtF_ew_oUoybQMvX1kRwnO2lsacApiR8eLPZo4eB1Baoj-iwHTk7UvkCZJRzOudGcE0ALHBayioqi47v_ubSnLA4n4zg7oDP2_WKkjwoE' | ||
} | ||
}).then(_utils.toJSON); | ||
}; | ||
var searchAlbums = exports.searchAlbums = function searchAlbums(query) { | ||
return searchAll(query, 'album'); | ||
}; | ||
var searchArtists = exports.searchArtists = function searchArtists(query) { | ||
return searchAll(query, 'artist'); | ||
}; | ||
var searchTracks = exports.searchTracks = function searchTracks(query) { | ||
return searchAll(query, 'track'); | ||
}; | ||
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) { | ||
return searchAll(query, 'playlist'); | ||
}; | ||
return this.request(this.apiURL + '/search?q=' + queryStr + '&type=' + typeConcat); | ||
} | ||
function search() { | ||
return { | ||
searchAlbums: searchAll.bind(this, 'album'), | ||
searchArtists: searchAll.bind(this, 'artist'), | ||
searchPlaylists: searchAll.bind(this, 'playlist'), | ||
searchTracks: searchAll.bind(this, 'track') | ||
}; | ||
} |
@@ -8,2 +8,3 @@ "use strict"; | ||
return data.json(); | ||
}; | ||
}; | ||
exports.default = toJSON; |
{ | ||
"name": "js-spotify-wrapper", | ||
"version": "1.0.2", | ||
"version": "1.1.4", | ||
"description": "Uma aplicação para trabalhar com Spotify Web API.", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"babel-transpiler": "./node_modules/.bin/babel --out-dir lib src", | ||
"build-es5": "npm run clear && npm run babel-transpiler", | ||
"build-umd": "./node_modules/.bin/webpack --output-filename spotify-wrapper.umd.js", | ||
"build-umd:min": "./node_modules/.bin/webpack --output-filename spotify-wrapper.umd.min.js -p", | ||
"build": "npm run build-es5 && npm run build-umd && npm run build-umd:min", | ||
"clear": "rimraf lib", | ||
"es5": "./node_modules/.bin/babel --out-dir lib src", | ||
"build:es5": "npm run clear && npm run es5", | ||
"build:umd": "./node_modules/.bin/webpack --output-filename spotify-wrapper.umd.js", | ||
"build:umd:min": "./node_modules/.bin/webpack --output-filename spotify-wrapper.umd.min.js -p", | ||
"build": "npm run build:es5 && npm run build:umd && npm run build:umd:min", | ||
"prepush": "npm run lint && npm run nyc", | ||
"coveralls": "npm run test:coverage && nyc report --reporter=text-lcov | coveralls", | ||
"prepush": "npm run lint && npm run test:coverage", | ||
"lint": "./node_modules/.bin/eslint src/*.js", | ||
"test": "./node_modules/.bin/mocha tests/**/*.spec.js --require babel-register", | ||
"test:tdd": "./node_modules/.bin/mocha tests/**/*.spec.js --require babel-register --watch", | ||
"nyc": "nyc npm test", | ||
"coveralls": "npm run nyc && nyc report --reporter=text-lcov | coveralls" | ||
"test:coverage": "nyc npm test" | ||
}, | ||
@@ -20,0 +20,0 @@ "files": [ |
180
README.md
@@ -24,3 +24,2 @@ # Spotify Wrapper | ||
``` | ||
## Como utilizar | ||
@@ -31,7 +30,4 @@ | ||
```js | ||
// para importar um método especifico | ||
import { method } from 'js-spotify-wrapper'; | ||
// para importar tudo | ||
import * as spotifyWrapper from 'js-spotify-wrapper'; | ||
// para importar a biblioteca | ||
import SpotifyWrapper from 'js-spotify-wrapper'; | ||
``` | ||
@@ -42,3 +38,3 @@ | ||
```js | ||
var spotifyWrapper = require('spotify-wrapper'); | ||
var spotifyWrapper = require('js-spotify-wrapper'); | ||
``` | ||
@@ -56,6 +52,10 @@ | ||
Após isto, a API ficará disponível pelo nome de SpotifyWrapper, como mostra o exemplo: | ||
Após isto, a API ficará disponível pelo nome de SpotifyWrapper. | ||
Para utilizar a API é necessário um token que pode ser gerado [aqui](https://developer.spotify.com/web-api/console/get-search-item/). O token expira a cada duas horas. Como mostra o exemplo: | ||
```js | ||
const albums = spotifyWrapper.searchAlbums('Artista escolhido'); | ||
const spotify = new SpotifyWrapper({ | ||
token: 'Seu token gerado aqui' | ||
}); | ||
const albums = spotify.search.searchAlbums('Artista escolhido'); | ||
``` | ||
@@ -67,20 +67,11 @@ | ||
### searchAll(query, tipo) | ||
## Search | ||
> Procure por infromações de artistas, albums, faixas e playlists. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/). | ||
Os metódos *search* ficam disponíveis pelo atributo 'search'. | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|-------------------|-----------------------------------------| | ||
|`query` |*string* | 'Pesquise qualquer coisa' | | ||
|`tipo` |*Array de Strings* | ['artist', 'album', 'track', 'playlist']| | ||
**Exemplo** | ||
```js | ||
search('Veil of Maya', ['artist', 'album']) | ||
.then(data => { | ||
// faça o que quiser com o resultado | ||
}) | ||
const spotify = new SpotifyWrapper({ | ||
token: 'Seu token gerado aqui' | ||
}); | ||
const albums = spotify.search.metodoEscolhido(); | ||
``` | ||
@@ -90,3 +81,3 @@ | ||
> Procure informações sobre Albums. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *album*. | ||
> Pesquise por Albums. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *album*. | ||
@@ -99,3 +90,2 @@ **Argumentos** | ||
**Exemplo** | ||
@@ -112,3 +102,3 @@ | ||
> Procure informações sobre Artistas. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *artist*. | ||
> Pesquise por Artistas. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *artist*. | ||
@@ -121,3 +111,2 @@ **Argumentos** | ||
**Exemplo** | ||
@@ -134,3 +123,3 @@ | ||
> Procure informações sobre Faixas. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *track*. | ||
> Pesquise por Faixas. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *track*. | ||
@@ -143,3 +132,2 @@ **Argumentos** | ||
**Exemplo** | ||
@@ -156,3 +144,3 @@ | ||
> Procure informações sobre Playlists. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *playlist*. | ||
> Pesquise por Playlists. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) com o tipo definido como *playlist*. | ||
@@ -165,3 +153,2 @@ **Argumentos** | ||
**Exemplo** | ||
@@ -176,5 +163,16 @@ | ||
## Albums | ||
Os metódos *album* ficam disponíveis pelo atributo 'album'. | ||
```js | ||
const spotify = new SpotifyWrapper({ | ||
token: 'Seu token gerado aqui' | ||
}); | ||
const albums = spotify.album.metodoEscolhido(); | ||
``` | ||
### getAlbum(id) | ||
> Procure informações sobre um album especifico com seu determinado id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album/). | ||
> Retorne um album especifico informando o id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album/). | ||
@@ -187,3 +185,2 @@ **Argumentos** | ||
**Exemplo** | ||
@@ -200,3 +197,3 @@ | ||
> Procure informações sobre alguns albuns informando seus determinados id's. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-several-albums/). | ||
> Retorne vários albums especificos informando seus id's Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-several-albums/). | ||
@@ -209,3 +206,3 @@ **Argumentos** | ||
**Examplo** | ||
**Exemplo** | ||
@@ -221,3 +218,3 @@ ```js | ||
> Procure todas as faixas de um album informando seu id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album-tracks/). | ||
> Retorne a faixas de um album especifico informando o id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album-tracks/). | ||
@@ -239,5 +236,112 @@ **Argumentos** | ||
## Artists | ||
Os metódos de *artist* ficam disponíveis pelo atributo 'artist'. | ||
```js | ||
const spotify = new SpotifyWrapper({ | ||
token: 'Seu token gerado aqui' | ||
}); | ||
const artists = spotify.artist.metodoEscolhido(); | ||
``` | ||
### getArtist(id) | ||
> Retorne um artista especifico informando o id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-artist/). | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|---------|-------------------| | ||
|`id` |*string* | 'Id especifico' | | ||
**Exemplo** | ||
```js | ||
getArtist('0TnOYISbd1XYRBk9myaseg') | ||
.then(data => { | ||
// faça o que quiser com resultado | ||
}) | ||
``` | ||
### getArtists(ids) | ||
> Retorne vários artistas especificos informando seus id's. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-several-artists/). | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|-------------------|-------------------| | ||
|`ids` |*Array de Strings* | ['id1', 'id2'] | | ||
**Exemplo** | ||
```js | ||
getArtists(['2CIMQHirSU0MQqyYHq0eOx','57dN52uHvrHOxijzpIgu3E','1vCWHaC5f2uS3yhpwWbIA6']) | ||
.then(data => { | ||
// faça o que quiser com o resultado | ||
}) | ||
``` | ||
### getArtistAlbums(id, tipo) | ||
> Retorne todos os albums de um determinado artista informando o id. É possível escolher o tipo de album que deseja receber. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-artist-albums/). | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|---------|------------------------------------------------------------| | ||
|`id` |*string* | 'Id especifico' | | ||
|`tipo` |*string* | 'Tipo de dado (single, album, appears_on, compilation)' | | ||
**Exemplo** | ||
```js | ||
getArtistAlbums('0TnOYISbd1XYRBk9myaseg', 'single') | ||
.then(data => { | ||
// faça o que quiser com resultado | ||
}) | ||
``` | ||
### getArtistTopTracks(id) | ||
> Retorne o top 10 de um determinado artista informando o id. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-artist-top-tracks/). | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|---------|-------------------| | ||
|`id` |*string* | 'Id especifico' | | ||
**Exemplo** | ||
```js | ||
getArtistTopTracks('0TnOYISbd1XYRBk9myaseg') | ||
.then(data => { | ||
// faça o que quiser com resultado | ||
}) | ||
``` | ||
### getArtistRelated(id) | ||
> Retorne os artistas relacionados. Teste em: [Spotify Web Console](https://developer.spotify.com/web-api/console/get-artist-related-artists/). | ||
**Argumentos** | ||
| Argumento | Tipo | Opções | | ||
|-----------|---------|-------------------| | ||
|`id` |*string* | 'Id especifico' | | ||
**Exemplo** | ||
```js | ||
getArtistRelated('0TnOYISbd1XYRBk9myaseg') | ||
.then(data => { | ||
// faça o que quiser com resultado | ||
}) | ||
``` | ||
## Contribuições | ||
Por favor leia [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) para detalhes sobre nosso código de conduta, e o processo para enviar pedidos de commit para nós. | ||
Por favor leia [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) para detalhes sobre nosso código de conduta. | ||
@@ -244,0 +348,0 @@ ## Versionamento |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49939
13
302
344
10