Scorocode.System

Contents


new System()

Scorocode.System. Designer

var sys = new sc.System();

Note

To use system methods you need to initialize the SDK and indicate a MasterKey.


.getDataStats(callbacks)

Method to get the application stats.

Parameter Type Properties Description Variable Example
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var sys = new sc.System();

sys.getDataStats()
   .then((stats)=>{
        console.log(stats);
    })
    .catch((error)=>{
        console.log(error)
    });

Returns: promise.{dataSize: int, filesSize: int, indexSize: int, store: int} - Returns a promise, which returns an object with the application statistics:

  • dataSize - application data size;
  • fileSize - application files data size;
  • indexSixe - application indexes data size;
  • store - free data available for the application.

.getApp(callbacks)

Method to get full information about the application.

Parameter Type Properties Description Variable Example
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var sys = new sc.System();

sys.getApp()
   .then((app)=>{
        console.log(app);
    })
    .catch((error)=>{
        console.log(error)
    });

Returns: promise.<App> - Returns a promise, which returns the App object.


App.getCollections(callbacks)

Method to get a list of collections.

Parameter Type Properties Description Variable Example
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var system = new sc.System();
system.getApp()
  .then((app)=>{
        app.getCollections()
            .then((result) => {
                console.log(result);
          })
  })
  .catch((error)=>{
      console.log(error)
  });

Returns: promise.[Collection] - Returns a promise, which returns an array of Collection objects.


App.getFolderContent(path, callbacks)

Method to get a folder at the specified path.

Parameter Type Properties Description Variable Example
path String mandatory specified folder path "/"
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var system = new sc.System();
system.getApp()
  .then((app)=>{
        app.getFolderContent("/")
            .then((result) => {
                console.log(result);
          })
  })
  .catch((error)=>{
      console.log(error)
  });

Returns: promise.[Script, Folder] - Returns a promise, which returns an array of Script и Folder objects.


App.getScript(id, callbacks}

Method to get a script and its ID.

Parameter Type Properties Description Variable Example
id String mandatory script ID "574860d2781267d34f7a2415"
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var system = new sc.System();
system.getApp()
  .then((app)=>{
        app.getScript("57c941e50293e02aea8b5b14")
            .then((result) => {
                console.log(result);
          })
  })
  .catch((error)=>{
      console.log(error)
  });

Returns: promise.Script - Returns a promise, which returns the Script object.


App.getBots(skip, limit, callbacks)

Method to get a list of bots.

Parameter Type Properties Description Variable Example
skip Number optional, by-default 0 Number of skipped objects 1
limit Number optional, by-default 50 Sampling size limit 5
callbacks Object optional success and error callbacks for the executed query see example below
var sc = require('scorocode');

sc.Init({
    ApplicationID: "5c46ec2f6f94aa92sdfef83122ff1gc",
    JavaScriptKey: "86df1sd52d81dbhskn32f1d6a8e15936",
    MasterKey: "e9c6vf5b9d6acd5tyu3aav1405c1e6dc3"
});

var system = new sc.System();
system.getApp()
  .then((app)=>{
        app.getBots()
            .then((result) => {
                console.log(result);
          })
  })
  .catch((error)=>{
      console.log(error)
  });

Returns: promise.<Bot> - Returns a promise, which returns the Bot object.