spotify-wrapper
Advanced tools
Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "spotify-wrapper", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A wrapper to work with the Spotify Web API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -31,6 +31,10 @@ # Spotify Wrapper | ||
// to import a specific method | ||
import { method } from 'spotify-wrapper'; | ||
import SpotifyWrapper from 'spotify-wrapper'; | ||
// to import everything | ||
import * as spotifyWrapper from 'spotify-wrapper'; | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
// using method | ||
spotify.search.artists('Incubus'); | ||
``` | ||
@@ -41,3 +45,7 @@ | ||
```js | ||
var spotifyWrapper = require('spotify-wrapper'); | ||
const spotifyWrapper = require('spotify-wrapper'); | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
``` | ||
@@ -55,6 +63,11 @@ | ||
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 albums = spotifyWrapper.searchAlbums('Choosen Artist'); | ||
const spotify = new SpotifyWrapper({ | ||
token: 'YOUR_TOKEN_HERE' | ||
}); | ||
const albums = spotify.search.albums('Choosen Artist'); | ||
``` | ||
@@ -66,24 +79,4 @@ | ||
### search(query, types) | ||
### search.albums(query) | ||
> 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*. | ||
@@ -101,3 +94,3 @@ | ||
```js | ||
searchAlbums('Incubus') | ||
spotify.search.albums('Incubus') | ||
.then(data => { | ||
@@ -108,3 +101,3 @@ // do what you want with the data | ||
### searchArtists(query) | ||
### search.artists(query) | ||
@@ -123,3 +116,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 | ||
searchArtists('Incubus') | ||
spotify.search.artists('Incubus') | ||
.then(data => { | ||
@@ -130,3 +123,3 @@ // do what you want with the data | ||
### searchTracks(query) | ||
### search.tracks(query) | ||
@@ -145,3 +138,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 | ||
searchTracks('Drive') | ||
spotify.search.tracks('Drive') | ||
.then(data => { | ||
@@ -152,3 +145,3 @@ // do what you want with the data | ||
### searchPlaylists(query) | ||
### search.playlists(query) | ||
@@ -167,3 +160,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 | ||
searchPlaylists('Happy Day') | ||
spotify.search.playlists('Happy Day') | ||
.then(data => { | ||
@@ -174,3 +167,3 @@ // do what you want with the data | ||
### getAlbum(id) | ||
### album.getAlbum(id) | ||
@@ -189,3 +182,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 | ||
getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
spotify.album.getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
.then(data => { | ||
@@ -196,3 +189,3 @@ // do what you want with the data | ||
### getAlbums(ids) | ||
### album.getAlbums(ids) | ||
@@ -210,3 +203,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 | ||
getAlbum(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo']) | ||
spotify.album.getAlbums(['4aawyAB9vmqN3uQ7FjRGTy', '1A2GTWGtFfWp7KSQTwWOyo']) | ||
.then(data => { | ||
@@ -217,3 +210,3 @@ // do what you want with the data | ||
### getAlbumTracks(id) | ||
### album.getTracks(id) | ||
@@ -231,3 +224,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 | ||
getAlbum('4aawyAB9vmqN3uQ7FjRGTy') | ||
spotify.album.getTracks('4aawyAB9vmqN3uQ7FjRGTy') | ||
.then(data => { | ||
@@ -234,0 +227,0 @@ // do what you want with the data |
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
44367
233