tenebrous-sheets/static/scripts/ts/_proto/cofd_api_pb_service.js

63 lines
1.5 KiB
JavaScript

// package: models.proto.cofd.api
// file: cofd_api.proto
var cofd_api_pb = require("./cofd_api_pb");
var cofd_pb = require("./cofd_pb");
var grpc = require("@improbable-eng/grpc-web").grpc;
var CofdApi = (function () {
function CofdApi() {}
CofdApi.serviceName = "models.proto.cofd.api.CofdApi";
return CofdApi;
}());
CofdApi.UpdateSkillValue = {
methodName: "UpdateSkillValue",
service: CofdApi,
requestStream: false,
responseStream: false,
requestType: cofd_api_pb.UpdateSkillValueRequest,
responseType: cofd_pb.CofdSheet.Skill
};
exports.CofdApi = CofdApi;
function CofdApiClient(serviceHost, options) {
this.serviceHost = serviceHost;
this.options = options || {};
}
CofdApiClient.prototype.updateSkillValue = function updateSkillValue(requestMessage, metadata, callback) {
if (arguments.length === 2) {
callback = arguments[1];
}
var client = grpc.unary(CofdApi.UpdateSkillValue, {
request: requestMessage,
host: this.serviceHost,
metadata: metadata,
transport: this.options.transport,
debug: this.options.debug,
onEnd: function (response) {
if (callback) {
if (response.status !== grpc.Code.OK) {
var err = new Error(response.statusMessage);
err.code = response.status;
err.metadata = response.trailers;
callback(err, null);
} else {
callback(null, response.message);
}
}
}
});
return {
cancel: function () {
callback = null;
client.close();
}
};
};
exports.CofdApiClient = CofdApiClient;