11 changed files with 1632 additions and 1888 deletions
@ -1,15 +1,13 @@
|
||||
{ |
||||
"env": { |
||||
"es2020": true, |
||||
"es2021": true, |
||||
"node": true |
||||
}, |
||||
"extends": "eslint:recommended", |
||||
"parserOptions": { |
||||
"ecmaVersion": 11, |
||||
"ecmaVersion": 12, |
||||
"sourceType": "module" |
||||
}, |
||||
"rules": { |
||||
"semi": ["error", "always"], |
||||
"quotes": ["error", "double"] |
||||
} |
||||
} |
||||
|
@ -1,115 +1,115 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node |
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node |
||||
|
||||
### Node ### |
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
lerna-debug.log* |
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html) |
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
||||
|
||||
# Runtime data |
||||
pids |
||||
*.pid |
||||
*.seed |
||||
*.pid.lock |
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
lib-cov |
||||
|
||||
# Coverage directory used by tools like istanbul |
||||
coverage |
||||
*.lcov |
||||
|
||||
# nyc test coverage |
||||
.nyc_output |
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) |
||||
.grunt |
||||
|
||||
# Bower dependency directory (https://bower.io/) |
||||
bower_components |
||||
|
||||
# node-waf configuration |
||||
.lock-wscript |
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html) |
||||
build/Release |
||||
|
||||
# Dependency directories |
||||
node_modules/ |
||||
jspm_packages/ |
||||
|
||||
# TypeScript v1 declaration files |
||||
typings/ |
||||
|
||||
# TypeScript cache |
||||
*.tsbuildinfo |
||||
|
||||
# Optional npm cache directory |
||||
.npm |
||||
|
||||
# Optional eslint cache |
||||
.eslintcache |
||||
|
||||
# Microbundle cache |
||||
.rpt2_cache/ |
||||
.rts2_cache_cjs/ |
||||
.rts2_cache_es/ |
||||
.rts2_cache_umd/ |
||||
|
||||
# Optional REPL history |
||||
.node_repl_history |
||||
|
||||
# Output of 'npm pack' |
||||
*.tgz |
||||
|
||||
# Yarn Integrity file |
||||
.yarn-integrity |
||||
|
||||
# dotenv environment variables file |
||||
.env |
||||
.env.test |
||||
|
||||
# parcel-bundler cache (https://parceljs.org/) |
||||
.cache |
||||
|
||||
# Next.js build output |
||||
.next |
||||
|
||||
# Nuxt.js build / generate output |
||||
.nuxt |
||||
dist |
||||
|
||||
# Gatsby files |
||||
.cache/ |
||||
# Comment in the public line in if your project uses Gatsby and not Next.js |
||||
# https://nextjs.org/blog/next-9-1#public-directory-support |
||||
# public |
||||
|
||||
# vuepress build output |
||||
.vuepress/dist |
||||
|
||||
# Serverless directories |
||||
.serverless/ |
||||
|
||||
# FuseBox cache |
||||
.fusebox/ |
||||
|
||||
# DynamoDB Local files |
||||
.dynamodb/ |
||||
|
||||
# TernJS port file |
||||
.tern-port |
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions |
||||
.vscode-test |
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/node |
||||
node_modules/.bin/prettier |
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node |
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node |
||||
|
||||
### Node ### |
||||
# Logs |
||||
logs |
||||
*.log |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
lerna-debug.log* |
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html) |
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
||||
|
||||
# Runtime data |
||||
pids |
||||
*.pid |
||||
*.seed |
||||
*.pid.lock |
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
lib-cov |
||||
|
||||
# Coverage directory used by tools like istanbul |
||||
coverage |
||||
*.lcov |
||||
|
||||
# nyc test coverage |
||||
.nyc_output |
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) |
||||
.grunt |
||||
|
||||
# Bower dependency directory (https://bower.io/) |
||||
bower_components |
||||
|
||||
# node-waf configuration |
||||
.lock-wscript |
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html) |
||||
build/Release |
||||
|
||||
# Dependency directories |
||||
node_modules/ |
||||
jspm_packages/ |
||||
|
||||
# TypeScript v1 declaration files |
||||
typings/ |
||||
|
||||
# TypeScript cache |
||||
*.tsbuildinfo |
||||
|
||||
# Optional npm cache directory |
||||
.npm |
||||
|
||||
# Optional eslint cache |
||||
.eslintcache |
||||
|
||||
# Microbundle cache |
||||
.rpt2_cache/ |
||||
.rts2_cache_cjs/ |
||||
.rts2_cache_es/ |
||||
.rts2_cache_umd/ |
||||
|
||||
# Optional REPL history |
||||
.node_repl_history |
||||
|
||||
# Output of 'npm pack' |
||||
*.tgz |
||||
|
||||
# Yarn Integrity file |
||||
.yarn-integrity |
||||
|
||||
# dotenv environment variables file |
||||
.env |
||||
.env.test |
||||
|
||||
# parcel-bundler cache (https://parceljs.org/) |
||||
.cache |
||||
|
||||
# Next.js build output |
||||
.next |
||||
|
||||
# Nuxt.js build / generate output |
||||
.nuxt |
||||
dist |
||||
|
||||
# Gatsby files |
||||
.cache/ |
||||
# Comment in the public line in if your project uses Gatsby and not Next.js |
||||
# https://nextjs.org/blog/next-9-1#public-directory-support |
||||
# public |
||||
|
||||
# vuepress build output |
||||
.vuepress/dist |
||||
|
||||
# Serverless directories |
||||
.serverless/ |
||||
|
||||
# FuseBox cache |
||||
.fusebox/ |
||||
|
||||
# DynamoDB Local files |
||||
.dynamodb/ |
||||
|
||||
# TernJS port file |
||||
.tern-port |
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions |
||||
.vscode-test |
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/node |
||||
node_modules/.bin/prettier |
||||
|
@ -1,65 +1,65 @@
|
||||
// SpookVooper API - modules/auth.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/auth */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://spookvooper.com/oauth2"; |
||||
let urlReturn; |
||||
|
||||
/** |
||||
* Generates a Oauth2 URL for you. This just builds a string and DOES NOT need a promise. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function authorize |
||||
* @param {string} response_type The type of response you get back. Currently the only one that is supported is "code". This argument is requried. |
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This argument is requried.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" perameter if successful. This argument is requried. |
||||
* @param {string} scope The scope of what you want to be able to recieve. Currently the only supported scope is "view". This argument is requried. |
||||
* @param {string} state The state parameter can have anything here. Will be returned to the server upon completion. This argument is optional. |
||||
* @returns {string} Will return a string containing a link to the Oauth2 authorization page. If there is an error, it will return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing." |
||||
*/ |
||||
function authorize(response_type, client_id, redirect_uri, scope, state) { |
||||
if (response_type === undefined || client_id === undefined || redirect_uri === undefined || scope === undefined) { |
||||
return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing."; |
||||
} else if (state === undefined) { |
||||
state = ""; |
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`; |
||||
urlReturn = urlReturn.split(" ").join("%20"); |
||||
return urlReturn; |
||||
} else { |
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`; |
||||
urlReturn = urlReturn.split(" ").join("%20"); |
||||
return urlReturn; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Gets a token that you can use for Oauth2. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function requestToken |
||||
* @param {string} grant_type The type of response you get back. Currently the one that is supported is "authorization_code" |
||||
* @param {string} code The code that was returned from the authorization. |
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" perameter if successful. |
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2.
|
||||
* @param {string} client_secret The client secret of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This WILL NOT get shared with anything other than the function it is in, and will not get sent anywhere other than https://spookvooper.com/. We take privacy very seriously. You must keep this safe.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object containing the token, expire time in seconds, and the svid of the authorized user). |
||||
*/ |
||||
function requestToken(grant_type, code, redirect_uri, client_id, client_secret, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/requestToken?grant_type=${grant_type}&code=${code}&redirect_uri=${redirect_uri}&client_id=${client_id}&client_secret=${client_secret}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
authorize, |
||||
requestToken |
||||
}; |
||||
// SpookVooper API - modules/auth.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/auth */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://spookvooper.com/oauth2"; |
||||
let urlReturn; |
||||
|
||||
/** |
||||
* Generates a Oauth2 URL for you. This just builds a string and DOES NOT need a promise. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function authorize |
||||
* @param {string} response_type The type of response you get back. Currently the only one that is supported is "code". This argument is requried. |
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This argument is requried.
|
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" perameter if successful. This argument is requried. |
||||
* @param {string} scope The scope of what you want to be able to recieve. Currently the only supported scope is "view". This argument is requried. |
||||
* @param {string} state The state parameter can have anything here. Will be returned to the server upon completion. This argument is optional. |
||||
* @returns {string} Will return a string containing a link to the Oauth2 authorization page. If there is an error, it will return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing." |
||||
*/ |
||||
function authorize(response_type, client_id, redirect_uri, scope, state) { |
||||
if (response_type === undefined || client_id === undefined || redirect_uri === undefined || scope === undefined) { |
||||
return "ERROR: Oauth2 URL Builder - A required variable is undefined or is missing."; |
||||
} else if (state === undefined) { |
||||
state = ""; |
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`; |
||||
urlReturn = urlReturn.split(" ").join("%20"); |
||||
return urlReturn; |
||||
} else { |
||||
urlReturn = `${baseURL}/authorize?response_type=${response_type}&client_id=${client_id}&redirect_uri=${redirect_uri}&scope=${scope}&state=${state}`; |
||||
urlReturn = urlReturn.split(" ").join("%20"); |
||||
return urlReturn; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Gets a token that you can use for Oauth2. For any updates on how this works, check #sv-developer in the discord server. https://discord.gg/spookvooper
|
||||
* @function requestToken |
||||
* @param {string} grant_type The type of response you get back. Currently the one that is supported is "authorization_code" |
||||
* @param {string} code The code that was returned from the authorization. |
||||
* @param {string} redirect_uri Where to redirect to once authorization has been granted. Will return a "code" and "state" perameter if successful. |
||||
* @param {string} client_id The client ID of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2.
|
||||
* @param {string} client_secret The client secret of your Oauth2 app. To get your client ID, go to https://spookvooper.com/oauth2. This WILL NOT get shared with anything other than the function it is in, and will not get sent anywhere other than https://spookvooper.com/. We take privacy very seriously. You must keep this safe.
|
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object containing the token, expire time in seconds, and the svid of the authorized user). |
||||
*/ |
||||
function requestToken(grant_type, code, redirect_uri, client_id, client_secret, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/requestToken?grant_type=${grant_type}&code=${code}&redirect_uri=${redirect_uri}&client_id=${client_id}&client_secret=${client_secret}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
authorize, |
||||
requestToken |
||||
}; |
||||
|
@ -1,137 +1,137 @@
|
||||
// SpookVooper API - modules/group.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/group */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://api.spookvooper.com/group"; |
||||
|
||||
/** |
||||
* Checks if a group exists. |
||||
* @function doesGroupExist |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function doesGroupExist(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/doesGroupExist?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets all members of a group. |
||||
* @function getGroupMembers |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getGroupMembers(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getGroupMembers?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets all members of a group. |
||||
* @function hasGroupPermission |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {string} usersvid The svid of the user you want to check |
||||
* @param {string} permission The permission you want to search for |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function hasGroupPermission(svid, usersvid, permission, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/hasGroupPermission?svid=${svid}&usersvid=${usersvid}&permission=${permission}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID from a name |
||||
* @function getSvidFromName |
||||
* @param {string} name The name of the group |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromName(name, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromName?name=${name}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the name of the group |
||||
* @function getGroupMembers |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getName(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getName?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
doesGroupExist, |
||||
getGroupMembers, |
||||
hasGroupPermission, |
||||
getSvidFromName, |
||||
getName |
||||
// SpookVooper API - modules/group.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/group */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://api.spookvooper.com/group"; |
||||
|
||||
/** |
||||
* Checks if a group exists. |
||||
* @function doesGroupExist |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function doesGroupExist(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/doesGroupExist?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets all members of a group. |
||||
* @function getGroupMembers |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getGroupMembers(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getGroupMembers?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets all members of a group. |
||||
* @function hasGroupPermission |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {string} usersvid The svid of the user you want to check |
||||
* @param {string} permission The permission you want to search for |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function hasGroupPermission(svid, usersvid, permission, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/hasGroupPermission?svid=${svid}&usersvid=${usersvid}&permission=${permission}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID from a name |
||||
* @function getSvidFromName |
||||
* @param {string} name The name of the group |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromName(name, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromName?name=${name}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the name of the group |
||||
* @function getGroupMembers |
||||
* @param {string} svid The svid of the group in question. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getName(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getName?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
doesGroupExist, |
||||
getGroupMembers, |
||||
hasGroupPermission, |
||||
getSvidFromName, |
||||
getName |
||||
}; |
@ -1,25 +1,25 @@
|
||||
// SpookVooper API - modules/premade.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/premade */ |
||||
import user from "./user.js"; |
||||
|
||||
let UserResponse; |
||||
|
||||
/** |
||||
* Gets the total XP of a user |
||||
* @function getTotalXP |
||||
* @param {string} svid The svid of the user you want to lookup. |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be an integer). |
||||
*/ |
||||
function getTotalXP(svid) { |
||||
return new Promise((resolve) => { |
||||
user.getUser(svid, true).then(value => { |
||||
resolve(value.post_likes + value.comment_likes + (value.twitch_message_xp * 4) + (value.discord_commends * 5) + (value.discord_message_xp * 2) + (value.discord_game_xp / 100)); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
getTotalXP |
||||
}; |
||||
// SpookVooper API - modules/premade.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/premade */ |
||||
import user from "./user.js"; |
||||
|
||||
let UserResponse; |
||||
|
||||
/** |
||||
* Gets the total XP of a user |
||||
* @function getTotalXP |
||||
* @param {string} svid The svid of the user you want to lookup. |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be an integer). |
||||
*/ |
||||
function getTotalXP(svid) { |
||||
return new Promise((resolve) => { |
||||
user.getUser(svid, true).then(value => { |
||||
resolve(value.post_likes + value.comment_likes + (value.twitch_message_xp * 4) + (value.discord_commends * 5) + (value.discord_message_xp * 2) + (value.discord_game_xp / 100)); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
getTotalXP |
||||
}; |
||||
|
@ -1,261 +1,261 @@
|
||||
// SpookVooper API - modules/user.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/user */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://api.spookvooper.com/user"; |
||||
|
||||
/** |
||||
* Gets information on the user |
||||
* @function getUser |
||||
* @param {string} svid The svid for the user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUser(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUser?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username of a user |
||||
* @function getUsername |
||||
* @param {string} svid The svid for the user lookup. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsername(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsername?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the svid of a user from their username |
||||
* @function getSvidFromUsername |
||||
* @param {string} username The username of the user |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromUsername(username, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromUsername?username=${username}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username from their linked discord account |
||||
* @function getUsernameFromDiscord |
||||
* @param {string} discordid The discord User ID for the user account. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsernameFromDiscord(discordid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsernameFromDiscord?discordid=${discordid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID of a user who has their discord account linked. |
||||
* @function getSvidFromDiscord |
||||
* @param {string} discordid The discord user ID |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromDiscord(discordid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromDiscord?discordid=${discordid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username from the minecraft UUID. |
||||
* @function getUsernameFromMinecraft |
||||
* @param {string} minecraftid The UUID of the minecraft user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsernameFromMinecraft(minecraftid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsernameFromMinecraft?minecraftid=${minecraftid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID from the minecraft UUID. |
||||
* @function getSvidFromMinecraft |
||||
* @param {string} minecraftid The UUID of the minecraft user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromMinecraft(minecraftid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromMinecraft?minecraftid=${minecraftid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Checks if the user has a discord role |
||||
* @function hasDiscordRole |
||||
* @param {string} userid The SVID of the user you want to lookup |
||||
* @param {string} role The name of the role you want to lookup. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function hasDiscordRole(userid, role, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/hasDiscordRole?userid=${userid}&role=${role}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the discord roles of a user |
||||
* @function getDiscordRoles |
||||
* @param {string} svid The svid of the user you want to lookup |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getDiscordRoles(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getDiscordRoles?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the days since the last move of a user |
||||
* @function getDiscordRoles |
||||
* @param {string} svid The svid of the user you want to lookup |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a integer). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getDaysSinceLastMove(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getDaysSinceLastMove?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
getUser, |
||||
getUsername, |
||||
getSvidFromUsername, |
||||
getUsernameFromDiscord, |
||||
getSvidFromDiscord, |
||||
getUsernameFromMinecraft, |
||||
getSvidFromMinecraft, |
||||
hasDiscordRole, |
||||
getDiscordRoles, |
||||
getDaysSinceLastMove |
||||
}; |
||||
// SpookVooper API - modules/user.js
|
||||
// Written by Brendan Lane
|
||||
|
||||
/** @module modules/user */ |
||||
import axios from "axios"; |
||||
|
||||
let baseURL = "https://api.spookvooper.com/user"; |
||||
|
||||
/** |
||||
* Gets information on the user |
||||
* @function getUser |
||||
* @param {string} svid The svid for the user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUser(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUser?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username of a user |
||||
* @function getUsername |
||||
* @param {string} svid The svid for the user lookup. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsername(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsername?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the svid of a user from their username |
||||
* @function getSvidFromUsername |
||||
* @param {string} username The username of the user |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromUsername(username, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromUsername?username=${username}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username from their linked discord account |
||||
* @function getUsernameFromDiscord |
||||
* @param {string} discordid The discord User ID for the user account. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsernameFromDiscord(discordid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsernameFromDiscord?discordid=${discordid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID of a user who has their discord account linked. |
||||
* @function getSvidFromDiscord |
||||
* @param {string} discordid The discord user ID |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromDiscord(discordid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromDiscord?discordid=${discordid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the username from the minecraft UUID. |
||||
* @function getUsernameFromMinecraft |
||||
* @param {string} minecraftid The UUID of the minecraft user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getUsernameFromMinecraft(minecraftid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getUsernameFromMinecraft?minecraftid=${minecraftid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the SVID from the minecraft UUID. |
||||
* @function getSvidFromMinecraft |
||||
* @param {string} minecraftid The UUID of the minecraft user. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a string). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getSvidFromMinecraft(minecraftid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getSvidFromMinecraft?minecraftid=${minecraftid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Checks if the user has a discord role |
||||
* @function hasDiscordRole |
||||
* @param {string} userid The SVID of the user you want to lookup |
||||
* @param {string} role The name of the role you want to lookup. |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a boolean). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function hasDiscordRole(userid, role, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/hasDiscordRole?userid=${userid}&role=${role}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the discord roles of a user |
||||
* @function getDiscordRoles |
||||
* @param {string} svid The svid of the user you want to lookup |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a JSON Object). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getDiscordRoles(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getDiscordRoles?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Gets the days since the last move of a user |
||||
* @function getDiscordRoles |
||||
* @param {string} svid The svid of the user you want to lookup |
||||
* @param {boolean} errToConsole If there is an error, send it to console, instead of returning. Defaults to false |
||||
* @returns {string} The data from the HTTP GET request, but because of the way it's handled, will always be a string (should be a integer). |
||||
* @author Brendan Lane <me@imbl.me> |
||||
*/ |
||||
function getDaysSinceLastMove(svid, errToConsole) { |
||||
return new Promise((resolve, reject) => { |
||||
axios.get(`${baseURL}/getDaysSinceLastMove?svid=${svid}`) |
||||
.then(function (response) { |
||||
resolve(response.data); |
||||
}) |
||||
.catch(function (error) { |
||||
if (errToConsole) { |
||||
console.warn(error); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
export default { |
||||
getUser, |
||||
getUsername, |
||||
getSvidFromUsername, |
||||
getUsernameFromDiscord, |
||||
getSvidFromDiscord, |
||||
getUsernameFromMinecraft, |
||||
getSvidFromMinecraft, |
||||
hasDiscordRole, |
||||
getDiscordRoles, |
||||
getDaysSinceLastMove |
||||
}; |
||||
|
@ -1,61 +1,61 @@
|
||||
# API Routes |
||||
|
||||
Allowed routes from the spookvooper api. |
||||
**Note:** All API routes are api.spookvooper.com OR spookvooper.com/api/ |
||||
|
||||
## /User Routes |
||||
|
||||
- /GetUser [svid]: Returns all user data |
||||
- /GetUsername [svid]: Returns username |
||||
- /GetSVIDFromUsername [username]: Returns SVID |
||||
- /GetUsernameFromDiscord [discordid]: Returns username |
||||
- /GetSVIDFromDiscord [discordid]: Returns SVID |
||||
- /GetUsernameFromMinecraft [minecraftid]: Returns username |
||||
- /GetSVIDFromMinecraft [minecraftid]: Returns SVID |
||||
- /HasDiscordRole [userid, role]: Returns true or false |
||||
- /GetDiscordRoles [svid]: Returns list of roles |
||||
- /GetDaysSinceLastMove [svid]: Returns an integer |
||||
|
||||
## Group Routes |
||||
|
||||
- /DoesGroupExist [svid]: Returns true or false |
||||
- /GetGroupMembers [svid]: Returns all member SVIDs, in a json list object |
||||
- /HasGroupPermission [svid, usersvid, permission]: Returns true or false |
||||
- /GetSVIDFromName [name]: Returns SVID |
||||
- /GetName [svid]: Returns name |
||||
|
||||
## /Eco Routes |
||||
|
||||
- /GetBalance [svid]: Returns decimal |
||||
- /SendTransactionByIDs [from, to, amount, auth, detail]: Returns a result. 'from' and 'to' are svids. Detail should include 'sale' if it is a sale. |
||||
- /GetStockValue [ticker]: Returns decimal |
||||
- /GetStockHistory [ticker, type, count, interval]: Returns list of stock history. Please do not use a count of over 60. Type can be "MINUTE", "HOUR", or "DAY". |
||||
- /SubmitStockBuy [ticker, count, price, accountid, auth]: Returns a result. Auth key must belong to accountid or have permission to it. |
||||
- /SubmitStockSell [ticker, count, price, accountid, auth]: Returns a result. Auth key must belong to accountid or have permission to it. |
||||
- /CancelOrder [orderid, accountid, auth]: Returns a result. |
||||
- /GetStockBuyPrice [ticker]: Returns decimal. Cheapest stock available for ticker. |
||||
- /GetQueueInfo [ticker, type]: Returns list of queue data. Type can be "BUY" or "SELL". |
||||
- /GetUserStockOffers [ticker, svid]: Returns list of stock offer data. |
||||
- /GetDistrictWealth [id]: Returns total wealth of a district |
||||
- /GetDistrictUserWealth [id]: Returns total user wealth of a district |
||||
- /GetDistrictGroupWealth [id]: Returns total group wealth of a district |
||||
|
||||
## Oauth2 |
||||
|
||||
What is Oauth2? |
||||
|
||||
- Oauth2 allows applications to verify and control accounts from another platform without ever sharing sensitive information. |
||||
How can I use Oauth2? |
||||
- SpookVooper is currently matching the standard Oauth configuration, although it is limited to only "code" response type and "authorization_code" grant type currently. |
||||
You can register apps at: <https://spookvooper.com/oauth2> |
||||
|
||||
### Oauth2 Routes |
||||
|
||||
- /Authorize [response_type, client_id, redirect_uri, scope, state]: Redirects back to 'redirect_uri' with a "code" and "state" parameter if successful |
||||
- /RequestToken [grant_type, code, redirect_uri, client_id, client_secret]: Returns a json object containing the token, expire time in seconds, and svid of the authorized user |
||||
|
||||
### What are the scopes |
||||
|
||||
Currently, the only scope is View. This will be extended to eco/plot/etc in the future. |
||||
|
||||
This is currently new and may have bugs. Try not to bug me without specific issues. |
||||
# API Routes |
||||
|
||||
Allowed routes from the spookvooper api. |
||||
**Note:** All API routes are api.spookvooper.com OR spookvooper.com/api/ |
||||
|
||||
## /User Routes |
||||
|
||||
- /GetUser [svid]: Returns all user data |
||||
- /GetUsername [svid]: Returns username |
||||
- /GetSVIDFromUsername [username]: Returns SVID |
||||
- /GetUsernameFromDiscord [discordid]: Returns username |
||||
- /GetSVIDFromDiscord [discordid]: Returns SVID |
||||
- /GetUsernameFromMinecraft [minecraftid]: Returns username |
||||
- /GetSVIDFromMinecraft [minecraftid]: Returns SVID |
||||