2020-02-05 03:27:46 +08:00
|
|
|
export enum HttpCode {
|
|
|
|
Ok = 200,
|
|
|
|
Redirect = 302,
|
|
|
|
NotFound = 404,
|
|
|
|
BadRequest = 400,
|
|
|
|
Unauthorized = 401,
|
|
|
|
LargePayload = 413,
|
|
|
|
ServerError = 500,
|
|
|
|
}
|
|
|
|
|
|
|
|
export class HttpError extends Error {
|
|
|
|
public constructor(message: string, public readonly code: number) {
|
|
|
|
super(message)
|
|
|
|
this.name = this.constructor.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum ApiEndpoint {
|
|
|
|
applications = "/applications",
|
|
|
|
recent = "/recent",
|
2020-02-14 06:38:05 +08:00
|
|
|
run = "/run",
|
2020-02-19 04:13:22 +08:00
|
|
|
running = "/running",
|
2020-02-05 03:27:46 +08:00
|
|
|
session = "/session",
|
2020-02-14 06:38:05 +08:00
|
|
|
status = "/status",
|
2020-02-05 03:27:46 +08:00
|
|
|
}
|