This repository has been archived on 2020-08-13. You can view files and clone it, but cannot push or open issues or pull requests.

54 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-04-14 14:56:08 +02:00
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var consts_1 = __importDefault(require("@scode/consts"));
var Status = /** @class */ (function () {
function Status() {
this._status = -1;
}
Object.defineProperty(Status.prototype, "status", {
get: function () {
if (this._status === -1)
throw new Error('status undefined');
return this._status;
},
set: function (value) {
this._status = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Status.prototype, "has_status", {
get: function () {
return this._status !== -1;
},
enumerable: true,
configurable: true
});
/*
* Status setters
*/
Status.prototype.ok = function () {
this._status = consts_1.default.status_ok;
};
Status.prototype.ok_no_content = function () {
this._status = consts_1.default.status_ok_no_content;
};
Status.prototype.bad_request = function () {
this._status = consts_1.default.status_bad_request;
};
Status.prototype.unauthorized = function () {
this._status = consts_1.default.status_unauthorized;
};
Status.prototype.forbidden = function () {
this._status = consts_1.default.status_forbidden;
};
Status.prototype.not_found = function () {
this._status = consts_1.default.status_not_found;
};
return Status;
}());
exports.default = Status;