Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

disconnect

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disconnect - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

8

HISTORY.md

@@ -0,1 +1,7 @@

0.8.0 / 2016-04-13
==================
* Added the new release rating endpoints
* Changed a lot of function names to more consistent ones. Old function calls still work, but a deprecation
notice is shown on the console and the old function names will be removed in the next major version.
0.7.2 / 2016-02-09

@@ -108,3 +114,3 @@ ==================

==================
* Fixed a litte bug in the calculation of free positions in the request queue
* Fixed a little bug in the calculation of free positions in the request queue
* Started adding unit tests using `wru`

@@ -111,0 +117,0 @@

8

lib/client.js

@@ -8,3 +8,4 @@ 'use strict';

error = require('./error.js'),
util = require('./util.js');
util = require('./util.js'),
deprecate = require('depd')('disconnect');

@@ -103,6 +104,9 @@ module.exports = DiscogsClient;

DiscogsClient.prototype.identity = function(callback){
DiscogsClient.prototype.getIdentity = function(callback){
this.get({url: '/oauth/identity', authLevel: 2}, callback);
};
DiscogsClient.prototype.identity = deprecate.function(DiscogsClient.prototype.getIdentity,
'client.identity: Use client.getIdentity instead');
/**

@@ -109,0 +113,0 @@ * Get info about the Discogs API and this client

'use strict';
var util = require('./util.js'),
deprecate = require('depd')('disconnect'),
AuthError = require('./error.js').AuthError;

@@ -11,3 +12,3 @@

* Get metadata for a specified collection folder or list all collection folders
* @param {string} user - The user name
* @param {string} user - The Discogs user name
* @param {number|string} [folder] - An optional folder ID

@@ -18,12 +19,8 @@ * @param {function} [callback] - The callback

collection.folders = function(user, folder, callback){
var url = '/users/'+user+'/collection/folders';
if((arguments.length === 2) && (typeof folder === 'function')){ // Get all folders
client.get(url, folder);
deprecate('collection.folders: Use collection.getFolders instead');
collection.getFolders(user, folder);
}else{ // Get a specific folder
if(client.authenticated(2) || (parseInt(folder, 10) === 0)){
url += '/'+folder;
client.get(url, callback);
}else{
callback(new AuthError());
}
deprecate('collection.folders: Use collection.getFolder instead');
collection.getFolder(user, folder, callback);
}

@@ -33,2 +30,27 @@ };

/**
* Get a list of all collection folders for the given user
* @param {string} user - The user name
* @param {function} callback - The callback
*/
collection.getFolders = function(user, callback){
client.get('/users/'+util.escape(user)+'/collection/folders', callback);
};
/**
* Get metadata for a specified collection folder
* @param {string} user - The Discogs user name
* @param {number|string} folder - A folder ID (0 = public folder)
* @param {function} callback - The callback
*/
collection.getFolder = function(user, folder, callback){
if(client.authenticated(2) || (parseInt(folder, 10) === 0)){
client.get('/users/'+util.escape(user)+'/collection/folders/'+folder, callback);
}else{
callback(new AuthError());
}
};
/**
* Add a new collection folder

@@ -52,6 +74,9 @@ * @param {string} user - The user name

collection.editFolder = function(user, folder, name, callback){
collection.setFolderName = function(user, folder, name, callback){
client.post({url: '/users/'+util.escape(user)+'/collection/folders/'+folder, authLevel: 2}, {name: name}, callback);
};
collection.editFolder = deprecate.function(collection.setFolderName,
'collection.editFolder: Use collection.setFolderName instead');
/**

@@ -76,3 +101,3 @@ * Delete a folder. A folder must be empty before it can be deleted.

collection.releases = function(user, folder, params, callback){
collection.getReleases = function(user, folder, params, callback){
if(client.authenticated(2) || (parseInt(folder, 10) === 0)){

@@ -91,4 +116,7 @@ var path = '/users/'+util.escape(user)+'/collection/folders/'+folder+'/releases';

collection.releases = deprecate.function(collection.getReleases,
'collection.releases: Use collection.getReleases instead');
/**
* Add a release instance to the given collection folder
* Add a release instance to the (optionally) given collection folder
* @param {string} user - The user name

@@ -101,4 +129,4 @@ * @param {(number|string)} [folder] - The folder ID (defaults to the "Uncategorized" folder)

collection.addRelease = function(user, folder, release, callback){
if((arguments.length === 3) && (typeof params === 'function')){
release = folder; folder = 1; callback = release;
if((arguments.length === 3) && (typeof release === 'function')){
callback = release; release = folder; folder = 1;
}

@@ -105,0 +133,0 @@ client.post({url: '/users/'+util.escape(user)+'/collection/folders/'+(folder||1)+'/releases/'+release, authLevel: 2}, null, callback);

'use strict';
var util = require('./util.js');
var util = require('./util.js'),
deprecate = require('depd')('disconnect');

@@ -21,5 +22,8 @@ module.exports = function(client){

database.artist = function(artist, callback){
database.getArtist = function(artist, callback){
client.get('/artists/'+artist, callback);
};
database.artist = deprecate.function(database.getArtist,
'database.artist: Use database.getArtist instead');

@@ -32,3 +36,3 @@ /**

*/
database.artistReleases = function(artist, params, callback){
database.getArtistReleases = function(artist, params, callback){
var path = '/artists/'+artist+'/releases';

@@ -42,2 +46,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

};
database.artistReleases = deprecate.function(database.getArtistReleases,
'database.artistReleases: Use database.getArtistReleases instead');

@@ -50,5 +57,36 @@ /**

database.release = function(release, callback){
database.getRelease = function(release, callback){
client.get('/releases/'+release, callback);
};
database.release = deprecate.function(database.getRelease,
'database.release: Use database.getRelease instead');
/**
* Get the release rating for the given user
* @param {(number|string)} release - The Discogs release ID
* @param {string} user - The Discogs user name
* @param {function} [callback] - Callback function
*/
database.getReleaseRating = function(release, user, callback){
client.get('/releases/'+release+'/rating/'+util.escape(user), callback);
};
/**
* Set (or remove) a release rating for the given logged in user
* @param {(number|string)} release - The Discogs release ID
* @param {string} user - The Discogs user name
* @param {number} rating - The new rating for a release between 1 and 5. Null = remove rating
* @param {function} [callback] - Callback function
*/
database.setReleaseRating = function(release, user, rating, callback){
var url = '/releases/'+release+'/rating/'+util.escape(user);
if(!rating){
client.delete({url: url, authLevel: 2}, callback);
}else{
client.put({url: url, authLevel: 2}, {rating: ((rating > 5) ? 5 : rating)}, callback);
}
};

@@ -61,5 +99,8 @@ /**

database.master = function(master, callback){
database.getMaster = function(master, callback){
client.get('/masters/'+master, callback);
};
database.master = deprecate.function(database.getMaster,
'database.master: Use database.getMaster instead');

@@ -73,3 +114,3 @@ /**

database.masterVersions = function(master, params, callback){
database.getMasterVersions = function(master, params, callback){
var path = '/masters/'+master+'/versions';

@@ -83,2 +124,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

};
database.masterVersions = deprecate.function(database.getMasterVersions,
'database.masterVersions: Use database.getMasterVersions instead');

@@ -91,5 +135,8 @@ /**

database.label = function(label, callback){
database.getLabel = function(label, callback){
client.get('/labels/'+label, callback);
};
database.label = deprecate.function(database.getLabel,
'database.label: Use database.getLabel instead');

@@ -103,3 +150,3 @@ /**

database.labelReleases = function(label, params, callback){
database.getLabelReleases = function(label, params, callback){
var path = '/labels/'+label+'/releases';

@@ -114,2 +161,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

database.labelReleases = deprecate.function(database.getLabelReleases,
'database.labelReleases: Use database.getLabelReleases instead');
/**

@@ -121,5 +171,8 @@ * Get an image

database.image = function(url, callback){
database.getImage = function(url, callback){
client.get({url: url, encoding: 'binary', queue: false, json: false}, callback);
};
database.image = deprecate.function(database.getImage,
'database.image: Use database.getImage instead');

@@ -126,0 +179,0 @@ /**

'use strict';
var util = require('./util.js');
var util = require('./util.js'),
deprecate = require('depd')('disconnect');

@@ -9,7 +10,10 @@ module.exports = function(client){

/**
* Copy the inventory function from the user module
* Copy the getInventory function from the user module
*/
marketplace.inventory = require('./user.js')(client).inventory;
marketplace.getInventory = require('./user.js')(client).getInventory;
marketplace.inventory = deprecate.function(marketplace.getInventory,
'marketplace.inventory: Use marketplace.getInventory instead');
/**

@@ -21,6 +25,9 @@ * Get a marketplace listing

marketplace.listing = function(listing, callback){
marketplace.getListing = function(listing, callback){
client.get('/marketplace/listings/'+listing, callback);
};
marketplace.listing = deprecate.function(marketplace.getListing,
'marketplace.listing: Use marketplace.getListing instead');
/**

@@ -64,12 +71,29 @@ * Create a marketplace listing

marketplace.orders = function(params, callback){
var path = '/marketplace/orders';
if((arguments.length === 1) && (typeof params === 'function')){
callback = params;
deprecate('marketplace.orders: Use marketplace.getOrders instead');
marketplace.getOrders(params);
}else if(params){
if(typeof params === 'object'){
path = util.addParams(path, params);
deprecate('marketplace.orders: Use marketplace.getOrders instead');
marketplace.getOrders(params, callback);
}else{ // Params is the order ID
path += '/'+params;
deprecate('marketplace.orders: Use marketplace.getOrder instead');
marketplace.getOrder(params);
}
}
};
/**
* Get a list of the authenticated user's orders
* @param {object} [params] - Optional sorting and pagination params
* @param {function} [callback] - The callback
*/
marketplace.getOrders = function(params, callback){
var path = '/marketplace/orders';
if((arguments.length === 1) && (typeof params === 'function')){
callback = params;
}else if(typeof params === 'object'){
path = util.addParams(path, params);
}
client.get({url: path, authLevel: 2}, callback);

@@ -79,2 +103,12 @@ };

/**
* Get details of a marketplace order
* @param {string} order - The order ID
* @param {function} [callback] - The callback
*/
marketplace.getOrder = function(order, callback){
client.get({url: '/marketplace/orders/'+order, authLevel: 2}, callback);
};
/**
* Edit a marketplace order

@@ -97,3 +131,3 @@ * @param {string} order - The order ID

marketplace.orderMessages = function(order, params, callback){
marketplace.getOrderMessages = function(order, params, callback){
var path = '/marketplace/orders/'+order+'/messages';

@@ -108,2 +142,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

marketplace.orderMessages = deprecate.function(marketplace.getOrderMessages,
'marketplace.orderMessages: Use marketplace.getOrderMessages instead');
/**

@@ -116,6 +153,9 @@ * Add a message to the given order ID

marketplace.orderAddMessage = function(order, data, callback){
marketplace.addOrderMessage = function(order, data, callback){
client.post({url: '/marketplace/orders/'+order+'/messages', authLevel: 2}, data, callback);
};
marketplace.orderAddMessage = deprecate.function(marketplace.addOrderMessage,
'marketplace.orderAddMessage: Use marketplace.addOrderMessage instead');
/**

@@ -128,3 +168,3 @@ * Get the marketplace fee for a given price

marketplace.fee = function(price, currency, callback){
marketplace.getFee = function(price, currency, callback){
var path = '/marketplace/fee/'+((typeof price === 'number') ? price.toFixed(2) : price);

@@ -139,4 +179,7 @@ if((arguments.length === 2) && (typeof currency === 'function')){

marketplace.fee = deprecate.function(marketplace.getFee,
'marketplace.fee: Use marketplace.getFee instead');
/**
* Get price suggestions for a given release ID
* Get price suggestions for a given release ID in the user's selling currency
* @param {(number|string)} release - The release ID

@@ -146,7 +189,10 @@ * @param {function} [callback] - The callback

marketplace.suggestPrice = function(release, callback){
marketplace.getPriceSuggestions = function(release, callback){
client.get({url: '/marketplace/price_suggestions/'+release, authLevel: 2}, callback);
};
marketplace.suggestPrice = deprecate.function(marketplace.getPriceSuggestions,
'marketplace.suggestPrice: Use marketplace.getPriceSuggestions instead');
return marketplace;
};
'use strict';
var util = require('./util.js');
var util = require('./util.js'),
deprecate = require('depd')('disconnect');

@@ -14,6 +15,9 @@ module.exports = function(client){

user.profile = function(user, callback){
user.getProfile = function(user, callback){
client.get('/users/'+util.escape(user), callback);
};
user.profile = deprecate.function(user.getProfile,
'user.profile: Use user.getProfile instead');
/**

@@ -26,3 +30,3 @@ * Get the inventory for the given user

user.inventory = function(user, params, callback){
user.getInventory = function(user, params, callback){
var path = '/users/'+util.escape(user)+'/inventory';

@@ -37,8 +41,13 @@ if((arguments.length === 2) && (typeof params === 'function')){

user.inventory = deprecate.function(user.getInventory,
'user.inventory: Use user.getInventory instead');
/**
* Copy the identity function to the user module
* Copy the client getIdentity function to the user module
*/
user.identity = client.identity;
user.getIdentity = client.getIdentity;
user.identity = deprecate.function(user.getIdentity,
'user.identity: Use user.getIdentity instead');

@@ -69,3 +78,4 @@ /**

*/
user.contributions = function(user, params, callback){
user.getContributions = function(user, params, callback){
var path = '/users/'+util.escape(user)+'/contributions';

@@ -80,2 +90,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

user.contributions = deprecate.function(user.getContributions,
'user.contributions: Use user.getContributions instead');
/**

@@ -87,3 +100,4 @@ * Get the submissions for the given user

*/
user.submissions = function(user, params, callback){
user.getSubmissions = function(user, params, callback){
var path = '/users/'+util.escape(user)+'/submissions';

@@ -98,3 +112,6 @@ if((arguments.length === 2) && (typeof params === 'function')){

user.submissions = deprecate.function(user.getSubmissions,
'user.submissions: Use user.getSubmissions instead');
return user;
};
'use strict';
var util = require('./util.js');
var util = require('./util.js'),
deprecate = require('depd')('disconnect');

@@ -15,3 +16,3 @@ module.exports = function(client){

wantlist.releases = function(user, params, callback){
wantlist.getReleases = function(user, params, callback){
var path = '/users/'+util.escape(user)+'/wants';

@@ -26,2 +27,5 @@ if((arguments.length === 2) && (typeof params === 'function')){

wantlist.releases = deprecate.function(wantlist.getReleases,
'wantlist.releases: Use wantlist.getReleases instead');
/**

@@ -28,0 +32,0 @@ * Add a release to the user's wantlist

{
"name": "disconnect",
"description": "A full featured Discogs API v2.0 client library",
"version": "0.7.2",
"version": "0.8.0",
"keywords": ["discogs", "api", "client", "oauth"],

@@ -22,3 +22,4 @@ "homepage": "https://github.com/bartve/disconnect",

"dependencies": {
"oauth-1.0a": "1.x.x"
"oauth-1.0a": "1.x.x",
"depd": "1.x.x"
},

@@ -25,0 +26,0 @@ "devDependencies": {

@@ -50,3 +50,3 @@ ## About

var db = new Discogs().database();
db.release(176126, function(err, data){
db.getRelease(176126, function(err, data){
console.log(data);

@@ -65,3 +65,3 @@ });

var col = new Discogs().user().collection();
col.releases('USER_NAME', 0, {page: 2, per_page: 75}, function(err, data){
col.getReleases('USER_NAME', 0, {page: 2, per_page: 75}, function(err, data){
console.log(data);

@@ -137,3 +137,3 @@ });

var dis = new Discogs(accessData);
dis.identity(function(err, data){
dis.getIdentity(function(err, data){
res.send(data);

@@ -148,5 +148,5 @@ });

var db = new Discogs(accessData).database();
db.release(176126, function(err, data){
db.getRelease(176126, function(err, data){
var url = data.images[0].resource_url;
db.image(url, function(err, data, rateLimit){
db.getImage(url, function(err, data, rateLimit){
// Data contains the raw binary image data

@@ -153,0 +153,0 @@ require('fs').writeFile('/tmp/image.jpg', data, 'binary', function(err){

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc