diff --git a/HISTORY.md b/HISTORY.md index 73f0c83..50acdad 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +0.6.1 / 2015-02-17 +================== + * Added setting output format for user, artist and label profiles through `DiscogsClient.setConfig({outputFormat: 'html'})` + 0.6.0 / 2015-01-19 ================== * OAuth authentication is no longer embedded in `DiscogsClient` diff --git a/LICENSE b/LICENSE index bf5741b..8ddf542 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ (The MIT License) -Copyright (c) 2014 B. van Eijck +Copyright (c) 2014-2015 B. van Eijck Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index b58843e..1d26810 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,13 @@ col.releases('USER_NAME', 0, {page: 2, per_page: 75}, function(err, data){ }); ``` +### Output format +User, artist and label profiles can be formatted in different ways: `plaintext`, `html` and `discogs`. `disconnect` defaults to `discogs`, but the output format can be set for each client instance. +```javascript +// Set the output format to HTML +var dis = new Discogs().setConfig({outputFormat: 'html'}); +``` + ### Discogs Auth Just provide the client constructor with your preferred way of [authentication](http://www.discogs.com/developers/#page:authentication). ```javascript diff --git a/lib/client.js b/lib/client.js index 70433af..31e943a 100644 --- a/lib/client.js +++ b/lib/client.js @@ -17,7 +17,8 @@ module.exports = DiscogsClient; var defaultConfig = { host: 'api.discogs.com', port: 443, - userAgent: 'DisConnectClient/'+pkg.version+' +'+pkg.homepage + userAgent: 'DisConnectClient/'+pkg.version+' +'+pkg.homepage, + outputFormat: 'discogs' // Possible values: 'discogs' / 'plaintext' / 'html' }; /** @@ -127,7 +128,7 @@ DiscogsClient.prototype._rawRequest = function(options, callback){ // Build request headers var headers = { 'User-Agent': this.config.userAgent, - 'Accept': 'application/json; application/octet-stream', + 'Accept': 'application/json,application/vnd.discogs.v2.'+this.config.outputFormat+'+json,application/octet-stream', 'Accept-Encoding': 'gzip,deflate', 'Host': this.config.host, 'Connection': 'close', diff --git a/package.json b/package.json index 3717133..b65ea64 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "disconnect", "description": "An easy to use client library to connect with the discogs.com API v2.0", - "version": "0.6.0", + "version": "0.6.1", "keywords": ["discogs", "api", "client", "oauth"], "homepage": "https://github.com/bartve/disconnect", "bugs": "https://github.com/bartve/disconnect/issues",