diffusion
Version:
Diffusion JavaScript client
62 lines (61 loc) • 2.73 kB
JavaScript
;
/**
* @module Services.TopicUpdate
*/
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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddTopicResultSerialiser = exports.AddTopicResultSerialiserClass = void 0;
var BEES = require("./../../serialisers/byte-encoded-enum-serialiser");
var serialiser_1 = require("./../../serialisers/serialiser");
var topic_update_1 = require("../../../topic-update/topic-update");
var add_topic_result_1 = require("./add-topic-result");
/**
* Server response code when adding a topic
*/
var AddTopicResultCode;
(function (AddTopicResultCode) {
AddTopicResultCode[AddTopicResultCode["CREATED"] = 0] = "CREATED";
AddTopicResultCode[AddTopicResultCode["EXISTS"] = 1] = "EXISTS";
})(AddTopicResultCode || (AddTopicResultCode = {}));
/**
* Serialiser for {@link AddTopicResult}
*/
var AddTopicResultSerialiserClass = /** @class */ (function (_super) {
__extends(AddTopicResultSerialiserClass, _super);
function AddTopicResultSerialiserClass() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Read a {@link AddTopicResult} from the stream
*
* @param bis the input stream
* @return the {@link AddTopicResult} that was read
*/
AddTopicResultSerialiserClass.prototype.read = function (bis) {
var addTopicResult = BEES.read(bis, AddTopicResultCode);
var result = (addTopicResult === AddTopicResultCode.CREATED)
? topic_update_1.TopicCreationResult.CREATED
: topic_update_1.TopicCreationResult.EXISTS;
return new add_topic_result_1.AddTopicResult(result);
};
return AddTopicResultSerialiserClass;
}(serialiser_1.AbstractSerialiser));
exports.AddTopicResultSerialiserClass = AddTopicResultSerialiserClass;
/**
* The {@link AddTopicResultSerialiser} singleton
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
exports.AddTopicResultSerialiser = new AddTopicResultSerialiserClass();