soundcloud-node-api
v0.0.9
Published
(soundcloud-node-api) ![](https://travis-ci.org/vineetasharma/soundcloud-node-api.svg)
Downloads
7
Readme
#SoundCloud Node API (soundcloud-node-api)
soundcloud-node-api : _soundcloud-node-api is a node js utility module which supports most of the resources available for sound cloud. It is designed get data from Sound Cloud API in a very simplest way. The SoundCloud API exposes resources(rest api) to manage user data, sounds and play-lists. To access public resources(API), you just have to pass a sound_cloud_clientId as parameter. You can get the sound_cloud_clientId by registering the App over developer page.
##How to install
npm install soundcloud-node-api --save
##How to initialize module example
var soundCloud = require('soundcloud-node-api')(sound_cloud_clientId);
###User APIs: By using user's APIs, you can access all the resources of User. ####Get All Users of SoundCloud
soundCloud.user.getAllUsers(function (err, result) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Result: ", JSON.parse(result));
}
});
#####Get a user details by userId
soundCloud.user.getUserDetails(userId,function (err, userDetails) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("userDetails: ", JSON.parse(userDetails));
}
});
#####Get tracks of a User
soundCloud.user.getUserTracks(userId,function (err, tracks) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Tracks: ", JSON.parse(tracks));
}
});
#####Get playLists of a User
soundCloud.user.getUserPlaylists(userId,function (err, playLists) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("PlayLists: ", JSON.parse(playLists));
}
});
#####Get Followings of a User
soundCloud.user.getUserFollowings(userId,function (err, followings) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Followings: ", JSON.parse(followings));
}
});
#####Get detail of a follower who follows another User, By user id and follower user id
soundCloud.user.getUserFollowingUser(userId,followingId,function (err, followingUser) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("FollowingUser: ", JSON.parse(followingUser));
}
});
#####Get list of users follows another User
soundCloud.user.getUserFollowers(userId,function (err, followers) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Followers: ", JSON.parse(followers));
}
});
#####Get a Follower's details of a User
soundCloud.user.getUserFollowerUser(userId,followerId,function (err, follower) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Follower: ", JSON.parse(follower));
}
});
#####Get Comments of a User
soundCloud.user.getUserComments(userId,function (err, comments) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Comments: ", JSON.parse(comments));
}
});
#####Get favorite tracks of a User
soundCloud.user.getUserFavorites(userId,trackId,function (err, tracks) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("FavoriteTracks: ", JSON.parse(tracks));
}
});
#####Get a FavoriteTrack of a User
soundCloud.user.getUserFavoriteTrack(userId,trackId,function (err, track) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("FavoriteTrack: ", JSON.parse(track));
}
});
#####Get Groups of a User
soundCloud.user.getUserGroups(userId,function (err, groups) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Groups: ", JSON.parse(groups));
}
});
#####Get WebProfiles of a User
soundCloud.user.getUserWebProfiles(userId,function (err, profiles) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Profiles: ", JSON.parse(profiles));
}
});
###PlayList APIs: By using Sets/PlayLists APIs, you can access all the resources of PlayList. #####Get a PlayList using playListId
soundCloud.playLists.getAPlaylist(playListId,function (err, playList) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("PlayList: ", JSON.parse(playList));
}
});
###Tracks APIs: By using Tracks APIs, you can access all the resources of tracks. #####Get a track details using trackId
soundCloud.tracks.getATrack(trackId,function (err, track) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Track details: ", JSON.parse(track));
}
});
#####Get a track's comments using trackId
soundCloud.tracks.getCommentsForTrack(trackId,function (err, comments) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Track comments: ", JSON.parse(comments));
}
});
#####Get a comment of a track using trackId & commentId
soundCloud.tracks.getACommentForTrack(trackId,commentId,function (err, comment) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Comment: ", JSON.parse(comment));
}
});
#####Get the list of users who marked a track as favorite
soundCloud.tracks.getFavoritersOfTrack(trackId,function (err, users) {
if (err) {
console.error("Error:", err);
}
if (result) {
console.log("Users: ", JSON.parse(users));
}
});
##How to test
To run tests type: npm test
To run tests with coverage type: npm run coverage
##Issues/Bugs :heart::
Sound Cloud Node API Issue Tracker