smartstatus/ts/smartstatus.classes.http.ts

27 lines
962 B
TypeScript
Raw Normal View History

2019-01-02 00:00:53 +00:00
export type TStatusGroup = 'clientError' | 'serverError';
2017-04-06 15:00:38 +00:00
export class HttpStatus {
2021-08-16 13:36:41 +00:00
public static statusMap: { [key: string]: any } = {};
public static addStatus(statusStringArg: string, statusArg: any) {
2019-01-02 01:08:12 +00:00
HttpStatus.statusMap[statusStringArg] = statusArg;
}
2021-08-16 13:36:41 +00:00
public static getHttpStatusByString(codeStringArg: string): HttpStatus {
const statusInstance = new HttpStatus.statusMap[codeStringArg]();
2019-01-02 01:08:12 +00:00
return statusInstance;
2019-01-02 00:00:53 +00:00
}
2019-01-02 00:29:35 +00:00
public code: number;
public text: string;
public description: string;
2019-01-02 00:00:53 +00:00
constructor(optionsArg: { code: number; text: string; description: string }) {
this.code = optionsArg.code;
this.text = optionsArg.text;
this.description = optionsArg.description;
2017-04-06 15:00:38 +00:00
}
}
2019-01-02 00:00:53 +00:00
export * from './smartstatus.classes.http.1xx';
export * from './smartstatus.classes.http.2xx';
export * from './smartstatus.classes.http.3xx';
export * from './smartstatus.classes.http.4xx';
export * from './smartstatus.classes.http.5xx';