diffusion
Version:
Diffusion JavaScript client
58 lines (57 loc) • 1.68 kB
JavaScript
;
/**
* @module Services
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandHeader = void 0;
/**
* Data type for the command header
*/
var CommandHeader = /** @class */ (function () {
/**
* Create a new CommandHeader instance
*
* @param service the service identifier
* @param cid the conversation ID
*/
function CommandHeader(service, cid) {
this.service = service;
this.cid = cid;
}
/**
* Create a new CommandHeader instance
*
* @param service the service identifier
* @param cid the conversation ID
* @return the new command header
*/
CommandHeader.createRequestHeader = function (service, cid) {
return new CommandHeader(service, cid);
};
/**
* Create a response header from this command header
*
* @return the command header that can be used for a response
*/
CommandHeader.prototype.createResponseHeader = function () {
return new CommandHeader(this.service, this.cid);
};
/**
* Create a error header from this command header
*
* @return the command header that can be used for an error response
*/
CommandHeader.prototype.createErrorHeader = function () {
return new CommandHeader(this.service, this.cid);
};
/**
* Convert object to string
*
* @return a string representation of the CommandHeader object
*/
CommandHeader.prototype.toString = function () {
return '<' + this.service + ', ' + this.cid.toString() + '>';
};
return CommandHeader;
}());
exports.CommandHeader = CommandHeader;