Stacket-API
Build powerful systems integrating your services together like never before.
Creating a client
import Stacket from "stacket";
const Stacket = require("stacket").default;
const client = new Stacket("auth-token");
client.verify().then(() => {
console.log("Authenticated with Stacket");
}).catch(console.error);
Create service
client.createService({
"type": "minecraft",
"node": "fsn10",
"package": "pkg1",
"platform": "spigot",
"version": "1.8.8"
}).then(service => {
console.log(service);
}).catch(console.error);
Rename service
let serviceId = "5ef951de74eb7027994b585b";
client.getService(serviceId).then(service => {
service.setName("New service name!");
}).catch(console.error);
Delete service
let serviceId = "5ef951de74eb7027994b585b";
client.getService(serviceId).then(service => {
service.delete();
}).catch(console.error);
Create network
client.createNetwork({
"name": "Test Network",
"type": "ipv6"
}).then(network => {
console.log(network);
}).catch(console.error);
Rename network
let networkId = "5ea5d1f9c2c50957ceae7dfb";
client.getNetwork(networkId).then(network => {
network.setName("New network name!");
}).catch(console.error);
Delete network
let networkId = "5ea5d1f9c2c50957ceae7dfb";
client.getNetwork(networkId).then(network => {
network.delete();
}).catch(console.error);
Create Drive
client.createDrive({
"name": "Test Drive",
"size": 250
}).then(drive => {
console.log(drive);
}).catch(console.error);
Rename Drive
let driveId = "5ef5f7e771cdd7625a303da6";
client.getDrive(driveId).then(drive => {
drive.setName("New drive name!");
}).catch(console.error);
Resize Drive
let driveId = "5ef5f7e771cdd7625a303da6";
client.getDrive(driveId).then(drive => {
drive.setSize(500);
}).catch(console.error);
Delete Drive
let driveId = "5ef5f7e771cdd7625a303da6";
client.getDrive(driveId).then(drive => {
drive.delete();
}).catch(console.error);
Create Folder
client.createFolder({
"name": "Test Folder",
"disks": [],
"networks": [],
"services": ["5ef951de74eb7027994b585b"]
});
Rename Folder
let folderId = "5f177a83e355067a6dfa037a";
client.getFolder(folderId).then(folder => {
folder.setName("New folder name!");
}).catch(console.error);
Add Item to Folder
let folderId = "5f177a83e355067a6dfa037a";
client.getFolder(folderId).then(folder => {
folder.addItem({"id": "5ef951de74eb7027994b585b", "type": "service"});
}).catch(console.error);
Remove Item from Folder
let folderId = "5f177a83e355067a6dfa037a";
client.getFolder(folderId).then(folder => {
folder.removeItem({"id": "5ef951de74eb7027994b585b", "type": "service"});
}).catch(console.error);
Delete Folder
let folderId = "5f177a83e355067a6dfa037a";
client.getFolder(folderId).then(folder => {
folder.delete();
}).catch(console.error);