@hms-networks/kolibri-js-client
Version:
Kolibri Consumer API client for building kolibri based applications
877 lines • 40.2 kB
JavaScript
/*
* Copyright 2021 HMS Industrial Networks AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http: //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
import { cV32, isDefined, KolibriRpcRequest } from '@hms-networks/kolibri-js-core';
import { BaseClient } from './base_client';
var KOLIBRI_PROTOCOL = 'v3.2.c.kolibri';
var KolibriRpcClient = /** @class */ (function (_super) {
__extends(KolibriRpcClient, _super);
function KolibriRpcClient() {
return _super !== null && _super.apply(this, arguments) || this;
}
KolibriRpcClient.prototype.getKolibriProtocol = function () {
return KOLIBRI_PROTOCOL;
};
KolibriRpcClient.prototype.callKolibriRpc = function (server, method, params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new KolibriRpcRequest(this.getNextRpcId(), server, method, params);
return [4 /*yield*/, this.sendKolibriRpcRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- GENERAL -----------------------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.login = function (params) {
return __awaiter(this, void 0, void 0, function () {
var loginParams, request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (isDefined(this.config.auth)) {
loginParams = this.config.auth;
}
else if (isDefined(params)) {
loginParams = params;
}
else {
throw new Error('Authentication not provided. ClientConfig#auth or login params must be provided.');
}
request = new cV32.LoginRequest(this.getNextRpcId(), loginParams);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
this.storeLoginData(loginParams, response.result);
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.close = function () {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.connection.disableReconnect();
request = new cV32.CloseRequest(this.getNextRpcId());
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.write = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, firstQoSGroup, secondQoSGroup, tId, response, e_1, ex_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.WriteRequest(this.getNextRpcId(), params);
firstQoSGroup = false;
secondQoSGroup = false;
request.params.nodes.forEach(function (node) {
if (node.quality >= 0 && node.quality <= 2) {
firstQoSGroup = true;
}
else if (node.quality >= 3 && node.quality <= 4) {
secondQoSGroup = true;
}
// check for qos level mix
if (firstQoSGroup && secondQoSGroup) {
throw new Error('Points with QoS level 0, 1 or 2 ' +
'must not be mixed in the same kolibri.write RPC with points which have QoS level 3 or 4.');
}
});
if (secondQoSGroup) {
tId = this.getNextTid();
}
_a.label = 1;
case 1:
_a.trys.push([1, 5, , 10]);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 2:
response = _a.sent();
if (!tId) return [3 /*break*/, 4];
return [4 /*yield*/, this.commit(new cV32.CommitParams(tId))];
case 3:
_a.sent();
_a.label = 4;
case 4: return [2 /*return*/, response.result];
case 5:
e_1 = _a.sent();
if (!tId) return [3 /*break*/, 9];
_a.label = 6;
case 6:
_a.trys.push([6, 8, , 9]);
return [4 /*yield*/, this.cancel(new cV32.CancelParams(tId))];
case 7:
_a.sent();
return [3 /*break*/, 9];
case 8:
ex_1 = _a.sent();
throw ex_1;
case 9: throw e_1;
case 10: return [2 /*return*/];
}
});
});
};
KolibriRpcClient.prototype.read = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ReadRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.commit = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.CommitRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.cancel = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.CancelRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.subscribe = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.SubscribeRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
this.subscription.storeSubscribedNodes(response.result);
this.storeSubscribeData(params, response.result);
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.unsubscribe = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UnsubscribeRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
this.subscription.deleteSubscribedNodes(params);
this.clearSubscribeData();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- PERMISSION MANAGEMENT ---------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.permissionNodeSet = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionNodeSetRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.permissionNodeList = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionNodeListRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.permissionRpcAdd = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionRpcAddRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.permissionRpcRemove = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionRpcRemoveRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.permissionRpcList = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionRpcListRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.permissionUserList = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.PermissionUserListRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- PROJECT MANAGEMENT ------------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.projectBrowse = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectBrowseRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectCreate = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectCreateRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectDelete = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectDeleteRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectGetLiveUsage = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectGetLiveUsageRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectGetProperties = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectGetPropertiesRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectGetStatistics = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectGetStatisticsRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectModify = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectModifyRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.projectGetHistoryUsage = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.ProjectGetHistoryUsageRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- USER MANAGEMENT ---------------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.userSubscribe = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserSubscribeRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
this.storeUserSubscribeData(params, response.result);
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userUnsubscribe = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserUnsubscribeRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
this.clearUserSubscribeData();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userBrowse = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserBrowseRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userCreate = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserCreateRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userModify = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserModifyRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGetSessions = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGetSessionsRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGetHistory = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGetHistoryRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userDelete = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserDeleteRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGetProperties = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGetPropertiesRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- USERGROUP MANAGEMENT ----------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.userGroupBrowse = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupBrowseRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupCreate = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupCreateRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupModify = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupModifyRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupDelete = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupDeleteRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupGetProperties = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupGetPropertiesRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupAddMember = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupAddMemberRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupRemoveMember = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupRemoveMemberRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupListMembers = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupListMembersRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.userGroupIsMember = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.UserGroupIsMemberRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
// -------------------------------------------------------------------------------------
// ----------------------- NODE MANAGEMENT ----------------------------------------
// -------------------------------------------------------------------------------------
KolibriRpcClient.prototype.nodeBrowse = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeBrowseRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeCreate = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeCreateRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeModify = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeModifyRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeDelete = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeDeleteRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeGetProperties = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeGetPropertiesRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeGetHistory = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeGetHistoryRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
KolibriRpcClient.prototype.nodeDeleteHistory = function (params) {
return __awaiter(this, void 0, void 0, function () {
var request, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
request = new cV32.NodeDeleteHistoryRequest(this.getNextRpcId(), params);
return [4 /*yield*/, this.sendKolibriRequest(request)];
case 1:
response = _a.sent();
return [2 /*return*/, response.result];
}
});
});
};
return KolibriRpcClient;
}(BaseClient));
export { KolibriRpcClient };
//# sourceMappingURL=kolibri_rpc_client.js.map