diffusion
Version:
Diffusion JavaScript client
58 lines (57 loc) • 2.77 kB
JavaScript
;
/**
* @module Services.Control
*/
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.MessagingFilterSendResponseSerialiser = exports.MessagingFilterSendResponseSerialiserClass = void 0;
var Codec = require("./../../io/codec");
var serialiser_1 = require("./../../serialisers/serialiser");
var error_report_serialiser_1 = require("./../../services/error-report-serialiser");
var messaging_filter_send_response_1 = require("./messaging-filter-send-response");
/**
* Serialiser for {@link MessagingFilterSendResponse}
*/
var MessagingFilterSendResponseSerialiserClass = /** @class */ (function (_super) {
__extends(MessagingFilterSendResponseSerialiserClass, _super);
function MessagingFilterSendResponseSerialiserClass() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Read a {@link MessagingFilterSendResponse} from the stream
*
* @param bis the input stream
* @return the {@link MessagingFilterSendResponse} that was read
*/
MessagingFilterSendResponseSerialiserClass.prototype.read = function (bis) {
var code = Codec.readByte(bis);
if (code === 0) {
var numberSent = Codec.readInt32(bis);
return new messaging_filter_send_response_1.MessagingFilterSendResponse(numberSent, []);
}
else {
var errors = Codec.readCollection(bis, error_report_serialiser_1.ErrorReportSerialiser.read);
return new messaging_filter_send_response_1.MessagingFilterSendResponse(0, errors);
}
};
return MessagingFilterSendResponseSerialiserClass;
}(serialiser_1.AbstractSerialiser));
exports.MessagingFilterSendResponseSerialiserClass = MessagingFilterSendResponseSerialiserClass;
/**
* The {@link MessagingFilterSendResponseSerialiser} singleton
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
exports.MessagingFilterSendResponseSerialiser = new MessagingFilterSendResponseSerialiserClass();