node-soundcloud-api
v1.0.0
Published
node-soundcloud-api is a node js utility module that supports most of the developer available for sound cloud
Downloads
2
Readme
#Node SoundCloud API(node-soundcloud-api) node-soundcloud-api: node-soundcloud-api is a node js utility module that supports most of the developer available for sound cloud. It is designed to get data from Sound Cloud API in the simplest way. The SoundCloud API exposes resources(rest api) to manage user data, sounds, and play-lists. To access public resources(API), you just need to pass a sound_cloud_clientId as a parameter. You can get the sound_cloud_clientId by registering the App over developer page. ##How to install
npm install node-soundcloud-api --save
##How to initialize module example
var soundCloud = require('node-soundcloud-api')(sound_cloud_clientId);
###User APIs: By using the 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