NodeJS wrapper for the SpinShare API
The documentation is available on https://spinsha.re/api/docs. Since SpinShare is in constant development, api responses and functions may change in the future. Join our https://spinsha.re/discord if you want to be updated on API changes.
This function overwrites the default api base.
This function sets the api key for your ConnectApp. Please refer to the documentation for more information.
getOpenData is used to receive any data from the open APIs through a GET method. If the apiresponse is wrapped inside a data property, you can use showResponseData
to directly go one level deeper.
const SSAPI = require('ssapi_node');
const api = new SSAPI();
// Get the first page of the newest charts
api.getOpenData('songs/new/0').then(data => {
console.log(data);
});
postOpenData is used to receive any data from the open APIs through a POST method. If the apiresponse is wrapped inside a data property, you can use showResponseData
to directly go one level deeper.
const SSAPI = require('ssapi_node');
const api = new SSAPI();
// Search for a user named "thatanimeweirdo"
api.postOpenData("searchUsers", {
searchQuery: "thatanimeweirdo",
}).then(data => {
console.log(data);
});
setConnectAppApiKey has to be set before using this function getConnectToken is used to receive a connect token for connect APIs.
const SSAPI = require('ssapi_node');
const api = new SSAPI();
// Trying to receive a connect token with the connect code AAEEDD
api.getConnectToken("AAEEDD").then(data => {
console.log(data);
});
setConnectAppApiKey has to be set before using this function validateConnectToken is used to validate if your connect token is still valid.
const SSAPI = require('ssapi_node');
const api = new SSAPI();
// Validating the connect token "435543nnh2f3223k85nv"
api.validateConnectToken("435543nnh2f3223k85nv").then(data => {
console.log(data);
});
This function requires a connectToken getConnectData is used to receive any data from the connect APIs through a GET method.
const SSAPI = require('ssapi_node');
const api = new SSAPI();
// Validating the connect token "435543nnh2f3223k85nv"
api.validateConnectToken("435543nnh2f3223k85nv").then(data => {
console.log(data);
});