Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .doclets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dir: lib
articles:
- Readme: README.md
- Changelog: History.md
10 changes: 10 additions & 0 deletions lib/album.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/**
* Module dependencies.
* @private
*/

var util = require('./util');
Expand All @@ -9,12 +10,20 @@ var debug = require('debug')('spotify-web:album');

/**
* Module exports.
* @private
*/

/**
* @class Album
*
*/

exports = module.exports = Album;

/**
* Album URI getter.
* @member uri
* @memberof Album
*/

Object.defineProperty(Album.prototype, 'uri', {
Expand All @@ -28,6 +37,7 @@ Object.defineProperty(Album.prototype, 'uri', {
/**
* Loads all the metadata for this Album instance. Useful for when you get an only
* partially filled Album instance from an Album instance for example.
* @function
*
* @param {Function} fn callback function
* @api public
Expand Down
10 changes: 10 additions & 0 deletions lib/artist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/**
* Module dependencies.
* @private
*/

var util = require('./util');
Expand All @@ -9,12 +10,20 @@ var debug = require('debug')('spotify-web:artist');

/**
* Module exports.
* @private
*/

/**
* @class Artist
*
*/

exports = module.exports = Artist;

/**
* Artist URI getter.
* @member uri
* @memberof Artist
*/

Object.defineProperty(Artist.prototype, 'uri', {
Expand All @@ -28,6 +37,7 @@ Object.defineProperty(Artist.prototype, 'uri', {
/**
* Loads all the metadata for this Artist instance. Useful for when you get an only
* partially filled Artist instance from an Album instance for example.
* @function
*
* @param {Function} fn callback function
* @api public
Expand Down
1 change: 1 addition & 0 deletions lib/base62.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* From Spotify Web client code.
* See: https://gist.github.com/4463921#file-spotify-web-client-js-L3503-L3546
* @private
*/

module.exports = function () {
Expand Down
5 changes: 5 additions & 0 deletions lib/error.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

/**
* Module dependencies.
* @private
*/

var inherits = require('util').inherits;

/**
* Error "domains".
* @private
*/

var domains = {
Expand All @@ -18,6 +20,7 @@ var domains = {

/**
* Error "codes".
* @private
*/

var codes = {
Expand All @@ -30,12 +33,14 @@ var codes = {

/**
* Module exports.
* @private
*/

module.exports = SpotifyError;

/**
* Spotify error class.
* @private
*
* Sample `err` objects:
*
Expand Down
3 changes: 3 additions & 0 deletions lib/image.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@

/**
* Module dependencies.
* @private
*/

var gid2id = require('./util').gid2id;
var Image = require('./schemas').build('metadata','Image');

/**
* Module exports.
* @private
*/

exports = module.exports = Image;

/**
* Image HTTP link getter.
* @private
*/

Object.defineProperty(Image.prototype, 'uri', {
Expand Down
4 changes: 4 additions & 0 deletions lib/restriction.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@

/**
* Module dependencies.
* @private
*/

var util = require('./util');
var Restriction = require('./schemas').build('metadata','Restriction');

/**
* Module exports.
* @private
*/

exports = module.exports = Restriction;

/**
* Allowed countries 2-letter code Array getter.
* @private
*/

Object.defineProperty(Restriction.prototype, 'allowed', {
Expand All @@ -27,6 +30,7 @@ Object.defineProperty(Restriction.prototype, 'allowed', {

/**
* Forbidden countries 2-letter code Array getter.
* @private
*/

Object.defineProperty(Restriction.prototype, 'forbidden', {
Expand Down
2 changes: 2 additions & 0 deletions lib/schemas.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/**
* Module dependencies.
* @private
*/

var fs = require('fs');
Expand All @@ -17,6 +18,7 @@ try {

/**
* Protocol Buffer schemas.
* @private
*/

var library = (protobuf) ? 'protobuf' : 'protobufjs';
Expand Down
6 changes: 6 additions & 0 deletions lib/spotify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Module dependencies.
* @private
*/

var vm = require('vm');
Expand All @@ -17,12 +18,14 @@ var pkg = require('../package.json');

/**
* Module exports.
* @private
*/

module.exports = Spotify;

/**
* Protocol Buffer types.
* @private
*/

var MercuryMultiGetRequest = schemas.build('mercury','MercuryMultiGetRequest');
Expand All @@ -42,6 +45,7 @@ var StoryList = schemas.build('bartender','StoryList');

/**
* Re-export all the `util` functions.
* @private
*/

Object.keys(util).forEach(function (key) {
Expand Down Expand Up @@ -69,6 +73,7 @@ Spotify.login = function (un, pw, fn) {

/**
* Spotify Web base class.
* @class
*
* @api public
*/
Expand Down Expand Up @@ -689,6 +694,7 @@ Spotify.prototype.disconnect = function () {
/**
* Gets the "metadata" object for one or more URIs.
*
* @function
* @param {Array|String} uris A single URI, or an Array of URIs to get "metadata" for
* @param {Function} fn callback function
* @api public
Expand Down
12 changes: 12 additions & 0 deletions lib/track.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

/**
* Module dependencies.
* @private
*/

var util = require('./util');
Expand All @@ -13,12 +14,20 @@ if (!PassThrough) PassThrough = require('readable-stream/passthrough');

/**
* Module exports.
* @private
*/

/**
* @class Track
*
*/

exports = module.exports = Track;

/**
* Track URI getter.
* @member uri
* @memberof Track
*/

Object.defineProperty(Track.prototype, 'uri', {
Expand All @@ -31,6 +40,8 @@ Object.defineProperty(Track.prototype, 'uri', {

/**
* Track Preview URL getter
* @member previewUrl
* @memberof Track
*/
Object.defineProperty(Track.prototype, 'previewUrl', {
get: function () {
Expand All @@ -44,6 +55,7 @@ Object.defineProperty(Track.prototype, 'previewUrl', {
/**
* Loads all the metadata for this Track instance. Useful for when you get an only
* partially filled Track instance from an Album instance for example.
* @function
*
* @param {Function} fn callback function
* @api public
Expand Down
6 changes: 6 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

/**
* Module dependencies.
* @private
*/

var base62 = require('./base62');

/**
* Converts a GID Buffer to an ID hex string.
* Based off of Spotify.Utils.str2hex(), modified to work with Buffers.
* @private
*/

exports.gid2id = function (gid) {
Expand All @@ -19,6 +21,7 @@ exports.gid2id = function (gid) {

/**
* ID -> URI
* @private
*/

exports.id2uri = function (uriType, v) {
Expand All @@ -33,6 +36,7 @@ exports.id2uri = function (uriType, v) {
* 'd49fcea60d1f450691669b67af3bda24'
* >>> SpotifyUtil.uri2id('spotify:user:tootallnate:playlist:0Lt5S4hGarhtZmtz7BNTeX')
* '192803a20370c0995f271891a32da6a3'
* @private
*/

exports.uri2id = function (uri) {
Expand All @@ -49,6 +53,7 @@ exports.uri2id = function (uri) {

/**
* GID -> URI
* @private
*/

exports.gid2uri = function (uriType, gid) {
Expand All @@ -59,6 +64,7 @@ exports.gid2uri = function (uriType, gid) {
/**
* Accepts a String URI, returns the "type" of URI.
* i.e. one of "local", "playlist", "track", etc.
* @private
*/

exports.uriType = function (uri) {
Expand Down