kuzzle-sdk
Version:
Official Javascript SDK for Kuzzle
110 lines • 3.33 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerController = void 0;
const Base_1 = require("./Base");
/**
* @class ServerController
* @property {Kuzzle} kuzzle - The Kuzzle SDK Instance
*/
class ServerController extends Base_1.BaseController {
/**
* @param {Kuzzle} kuzzle - The Kuzzle SDK Instance
*/
constructor(kuzzle) {
super(kuzzle, "server");
}
/**
* Checks if an administrator user exists
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Boolean>}
*/
adminExists(options) {
return this.query({
action: "adminExists",
}, options).then((response) => response.result.exists);
}
/**
* Returns the Kuzzle capabilities
* @param {Object} options - {queuable: Boolean(true)}
* @example https://docs.kuzzle.io/core/2/api/controllers/server/capabilities/#response
* @returns {Promise<Object>}
*/
capabilities(options) {
return this.query({
action: "capabilities",
}, options).then((response) => response.result);
}
/**
* Returns all stored statistics frames
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Object>}
*/
getAllStats(options) {
return this.query({
action: "getAllStats",
}, options).then((response) => response.result);
}
/**
* Returns the Kuzzle configuration
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Object>}
*/
getConfig(options) {
return this.query({
action: "getConfig",
}, options).then((response) => response.result);
}
/**
* Returns the last statistics frame
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Object>}
*/
getLastStats(options) {
return this.query({
action: "getLastStats",
}, options).then((response) => response.result);
}
/**
* Returns the statistics frame from a date
*
* @param {Number|String} startTime - begining of statistics frame set (timestamp or datetime format)
* @param {Number|String} stopTime - end of statistics frame set (timestamp or datetime format)
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Object>}
*/
getStats(startTime, stopTime, options) {
return this.query({
action: "getStats",
startTime,
stopTime,
}, options).then((response) => response.result);
}
/**
* Returns the Kuzzle server information
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Object>}
*/
info(options) {
return this.query({
action: "info",
}, options).then((response) => response.result);
}
/**
* Get server's current timestamp
*
* @param {Object} options - {queuable: Boolean(true)}
* @returns {Promise<Number>}
*/
now(options) {
return this.query({
action: "now",
}, options).then((response) => response.result.now);
}
}
exports.ServerController = ServerController;
//# sourceMappingURL=Server.js.map
;