spotify-wrapper
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -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(); | ||
})(this, function() { | ||
@@ -121,4 +121,4 @@ return /******/ (function(modules) { // webpackBootstrap | ||
this.album = _album2.default.bind(this)(); | ||
this.search = _search2.default.bind(this)(); | ||
this.album = _album2.default.bind(this)(); | ||
} | ||
@@ -134,2 +134,3 @@ | ||
}; | ||
return fetch(url, headers).then(_utils2.default); | ||
@@ -136,0 +137,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!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()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return t[r].call(u.exports,u,u.exports,e),u.l=!0,u.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(4),s=r(o),a=n(2),f=r(a),c=n(3),l=r(c),p=n(5),d=r(p),b=function(){function t(e){u(this,t),this.apiURL=e.apiURL||l.default,this.token=e.token,this.search=s.default.bind(this)(),this.album=f.default.bind(this)()}return i(t,[{key:"request",value:function(t){var e={headers:{Authorization:"'Bearer "+this.token+"'"}};return fetch(t,e).then(d.default)}}]),t}();e.default=b},function(t,e,n){t.exports=n(0).default},function(t,e,n){"use strict";function r(){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=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default="https://api.spotify.com/v1"},function(t,e,n){"use strict";function r(t,e){return this.request(this.apiURL+"/search?q="+e+"&type="+t)}function u(){return{artists:r.bind(this,"artist"),albums:r.bind(this,"album"),tracks:r.bind(this,"track"),playlists:r.bind(this,"playlist")}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t.json()};e.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()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return t[r].call(u.exports,u,u.exports,e),u.l=!0,u.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(4),s=r(o),a=n(2),f=r(a),c=n(3),l=r(c),p=n(5),d=r(p),b=function(){function t(e){u(this,t),this.apiURL=e.apiURL||l.default,this.token=e.token,this.album=f.default.bind(this)(),this.search=s.default.bind(this)()}return i(t,[{key:"request",value:function(t){var e={headers:{Authorization:"'Bearer "+this.token+"'"}};return fetch(t,e).then(d.default)}}]),t}();e.default=b},function(t,e,n){t.exports=n(0).default},function(t,e,n){"use strict";function r(){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=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default="https://api.spotify.com/v1"},function(t,e,n){"use strict";function r(t,e){return this.request(this.apiURL+"/search?q="+e+"&type="+t)}function u(){return{artists:r.bind(this,"artist"),albums:r.bind(this,"album"),tracks:r.bind(this,"track"),playlists:r.bind(this,"playlist")}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t.json()};e.default=r}])}); | ||
//# sourceMappingURL=spotify-wrapper.umd.min.js.map |
@@ -37,4 +37,4 @@ 'use strict'; | ||
this.album = _album2.default.bind(this)(); | ||
this.search = _search2.default.bind(this)(); | ||
this.album = _album2.default.bind(this)(); | ||
} | ||
@@ -50,2 +50,3 @@ | ||
}; | ||
return fetch(url, headers).then(_utils2.default); | ||
@@ -52,0 +53,0 @@ } |
{ | ||
"name": "spotify-wrapper", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A wrapper to work with the Spotify Web API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -31,10 +31,6 @@ # Spotify Wrapper | ||
// to import a specific method | ||
import SpotifyWrapper from 'spotify-wrapper'; | ||
import { method } from 'spotify-wrapper'; | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
// using method | ||
spotify.search.artists('Incubus'); | ||
// to import everything | ||
import * as spotifyWrapper from 'spotify-wrapper'; | ||
``` | ||
@@ -45,7 +41,3 @@ | ||
```js | ||
const spotifyWrapper = require('spotify-wrapper'); | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
var spotifyWrapper = require('spotify-wrapper'); | ||
``` | ||
@@ -63,11 +55,6 @@ | ||
After that the library will be available to the Global as `SpotifyWrapper`. Follow an example: | ||
After that the library will be available to the Global as `spotifyWrapper`. Follow an example: | ||
```js | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
const albums = spotify.search.albums('Choosen Artist'); | ||
const albums = spotifyWrapper.searchAlbums('Choosen Artist'); | ||
``` | ||
@@ -79,4 +66,24 @@ | ||
### search.albums(query) | ||
### search(query, types) | ||
> Search for informations about artists, albums, tracks or playlists. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/). | ||
**Arguments** | ||
| Argument | Type | Options | | ||
|----------|-------------------|-----------------------------------------| | ||
|`query` |*string* | 'Any search query' | | ||
|`type` |*Array of strings* | ['artist', 'album', 'track', 'playlist']| | ||
**Example** | ||
```js | ||
search('Incubus', ['artist', 'album']) | ||
.then(data => { | ||
// do what you want with the data | ||
}) | ||
``` | ||
### searchAlbums(query) | ||
> Search for informations about Albums with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *album*. | ||
@@ -94,3 +101,3 @@ | ||
```js | ||
spotify.search.albums('Incubus') | ||
searchAlbums('Incubus') | ||
.then(data => { | ||
@@ -101,3 +108,3 @@ // do what you want with the data | ||
### search.artists(query) | ||
### searchArtists(query) | ||
@@ -116,3 +123,3 @@ > Search for informations about Artists with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *artist*. | ||
```js | ||
spotify.search.artists('Incubus') | ||
searchArtists('Incubus') | ||
.then(data => { | ||
@@ -123,3 +130,3 @@ // do what you want with the data | ||
### search.tracks(query) | ||
### searchTracks(query) | ||
@@ -138,3 +145,3 @@ > Search for informations about Tracks with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *track*. | ||
```js | ||
spotify.search.tracks('Drive') | ||
searchTracks('Drive') | ||
.then(data => { | ||
@@ -145,3 +152,3 @@ // do what you want with the data | ||
### search.playlists(query) | ||
### searchPlaylists(query) | ||
@@ -160,3 +167,3 @@ > Search for informations about Playlist with provided query. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-search-item/) with type defined as *playlist*. | ||
```js | ||
spotify.search.playlists('Happy Day') | ||
searchPlaylists('Happy Day') | ||
.then(data => { | ||
@@ -167,3 +174,3 @@ // do what you want with the data | ||
### album.getAlbum(id) | ||
### getAlbum(id) | ||
@@ -182,3 +189,3 @@ > Search for informations about a specific Album with provided id. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album/). | ||
```js | ||
spotify.album.getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
.then(data => { | ||
@@ -189,3 +196,3 @@ // do what you want with the data | ||
### album.getAlbums(ids) | ||
### getAlbums(ids) | ||
@@ -203,3 +210,3 @@ > Search for informations about some Albums with all id's. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-several-albums/). | ||
```js | ||
spotify.album.getAlbums(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo']) | ||
getAlbum(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo']) | ||
.then(data => { | ||
@@ -210,3 +217,3 @@ // do what you want with the data | ||
### album.getTracks(id) | ||
### getAlbumTracks(id) | ||
@@ -224,3 +231,3 @@ > Search for all tracks in a specific Album with provided id. Test in [Spotify Web Console](https://developer.spotify.com/web-api/console/get-album-tracks/). | ||
```js | ||
spotify.album.getTracks('4aawyAB9vmqN3uQ7FjRGTy') | ||
getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
.then(data => { | ||
@@ -227,0 +234,0 @@ // do what you want with the data |
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
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
44717
240
3