spotify-finder
Advanced tools
Comparing version 0.1.2 to 1.0.0
@@ -25,7 +25,7 @@ var request = require('superagent') | ||
Client.prototype.search = function (query, type, callback) { | ||
Client.prototype.search = function (q, type, limit, callback) { | ||
/* istanbul ignore else */ | ||
if (type === 'all') type = 'artist,album,track' | ||
this._request('/search', { q: query, type: type }, callback) | ||
this._request('/search', { q, type, limit }, callback) | ||
} | ||
@@ -44,3 +44,3 @@ | ||
var ids = array_ids.toString() | ||
this._request('/albums', { ids: ids }, callback) | ||
this._request('/albums', { ids }, callback) | ||
} | ||
@@ -56,3 +56,3 @@ | ||
this._request(url, { country: country }, callback) | ||
this._request(url, { country }, callback) | ||
} | ||
@@ -62,3 +62,3 @@ | ||
var ids = array_ids.toString() | ||
this._request('/artists', { ids: ids }, callback) | ||
this._request('/artists', { ids }, callback) | ||
} | ||
@@ -73,5 +73,5 @@ | ||
var ids = array_ids.toString() | ||
this._request('/tracks', { ids: ids }, callback) | ||
this._request('/tracks', { ids }, callback) | ||
} | ||
module.exports = Client |
{ | ||
"name": "spotify-finder", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "A Spotify API Client", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -17,12 +17,18 @@ # spotify-finder | ||
Search for all types | ||
#### Search for all types | ||
```js | ||
client.search('Demi', 'all', function (err, data) { | ||
client.search('Demi', 'all', 10, function (err, data) { | ||
// do something with data | ||
}) | ||
``` | ||
Parameter 'Demi' is search, 'all' type of search '10' limit of results. | ||
##### types alowed: | ||
* artists | ||
* albums | ||
* tracks | ||
* all | ||
Search for type specific | ||
#### Search for type specific | ||
```js | ||
client.search('Stone Cold', 'track' function (err, tracks) { | ||
client.search('Stone Cold', 'track', 2, function (err, tracks) { | ||
// do something with tracks | ||
@@ -32,3 +38,3 @@ }) | ||
Get album by id | ||
#### Get album by id | ||
```js | ||
@@ -39,3 +45,3 @@ client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: false }, function (err, album) { | ||
``` | ||
Get an album's tracks | ||
#### Get an album's tracks | ||
```js | ||
@@ -47,3 +53,3 @@ client.getAlbum('41MnTivkwTO3UUJ8DrqEJJ', { tracks: true }, function (err, tracks) { | ||
Get several albums by id | ||
#### Get several albums by id | ||
```js | ||
@@ -55,3 +61,3 @@ client.getAlbums(['41MnTivkwTO3UUJ8DrqEJJ', '6UXCm6bOO4gFlDQZV5yL37'], function (err, albums) { | ||
Get artist by id | ||
#### Get artist by id | ||
```js | ||
@@ -63,3 +69,3 @@ client.getArtist('6S2OmqARrzebs0tKUEyXyp', {}, function (err, artist) { | ||
Get an artist's albums | ||
#### Get an artist's albums | ||
```js | ||
@@ -71,10 +77,10 @@ client.getArtist('6S2OmqARrzebs0tKUEyXyp', { albums: true }, null, function (err, albums) { | ||
Get an artist's top tracks | ||
#### Get an artist's top tracks | ||
```js | ||
client.getArtist('6S2OmqARrzebs0tKUEyXyp', { topTracks: true }, null, function (err, tracks) { | ||
// do something with tracks | ||
// do something with tracks | ||
}) | ||
``` | ||
Get an artist's related artists | ||
#### Get an artist's related artists | ||
```js | ||
@@ -86,3 +92,3 @@ client.getArtist('6S2OmqARrzebs0tKUEyXyp', { relatedArtists: true }, null, function (err, artists) { | ||
Get several artists by id | ||
#### Get several artists by id | ||
```js | ||
@@ -94,3 +100,3 @@ client.getArtists(['15deb326635d69d0505434', '934da7155ec15deb32663'], function (err, artists) { | ||
Get an track by id | ||
#### Get an track by id | ||
```js | ||
@@ -102,3 +108,3 @@ client.getTrack('934da7155ec15deb32663', function (err, track) { | ||
Get several tracks by id | ||
#### Get several tracks by id | ||
```js | ||
@@ -105,0 +111,0 @@ client.getTracks(['15deb326635d69d0505s', 'da7155ec15deb326635d69d'], function (err, tracks) { |
@@ -36,2 +36,3 @@ var test = require('tape') | ||
.query({ q: 'Demi Lovato' }) | ||
.query({ limit: 5 }) | ||
.query({ type: 'artist,album,track' }) | ||
@@ -42,3 +43,3 @@ .reply(200, [{ artists: 'Demi Lovato' }, | ||
client.search('Demi Lovato', 'all', function (err, data) { | ||
client.search('Demi Lovato', 'all', 5, function (err, data) { | ||
t.error(err, 'should not be an error') | ||
@@ -45,0 +46,0 @@ t.ok(Array.isArray(data), 'should be an Array') |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13560
243
0
129