typescript-rest
Version:
A Library to create RESTFul APIs with Typescript
68 lines • 2.33 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**
* The supported HTTP methods.
*/
var HttpMethod;
(function (HttpMethod) {
HttpMethod[HttpMethod["GET"] = 0] = "GET";
HttpMethod[HttpMethod["POST"] = 1] = "POST";
HttpMethod[HttpMethod["PUT"] = 2] = "PUT";
HttpMethod[HttpMethod["DELETE"] = 3] = "DELETE";
HttpMethod[HttpMethod["HEAD"] = 4] = "HEAD";
HttpMethod[HttpMethod["OPTIONS"] = 5] = "OPTIONS";
HttpMethod[HttpMethod["PATCH"] = 6] = "PATCH";
})(HttpMethod = exports.HttpMethod || (exports.HttpMethod = {}));
/**
* Represents the current context of the request being handled.
*/
var ServiceContext = (function () {
function ServiceContext() {
}
return ServiceContext;
}());
exports.ServiceContext = ServiceContext;
/**
* The Base class for all HTTP errors
*/
var HttpError = (function (_super) {
__extends(HttpError, _super);
function HttpError(name, statusCode, message) {
var _this = _super.call(this, message) || this;
_this.statusCode = statusCode;
_this.message = message;
_this.name = name;
return _this;
}
return HttpError;
}(Error));
exports.HttpError = HttpError;
/**
* Used to create a reference to a resource.
*/
var ReferencedResource = (function () {
/**
* Constructor. Receives the location of the resource.
* @param location To be added to the Location header on response
* @param statusCode the response status code to be sent
* @param body the body to be sent
*/
function ReferencedResource(location, statusCode, body) {
this.location = location;
this.statusCode = statusCode;
this.body = body;
}
return ReferencedResource;
}());
exports.ReferencedResource = ReferencedResource;
//# sourceMappingURL=server-types.js.map