Rename response to model

This commit is contained in:
Merijn Hendriks 2021-12-28 15:28:43 +01:00
parent 4c3e91d9c1
commit 0ca900191d
2 changed files with 22 additions and 22 deletions

View File

@ -12,7 +12,7 @@ export class ResponseBody<T>
} }
} }
export class LogoutResponse export class LogoutModel
{ {
public status: string; public status: string;
@ -22,7 +22,7 @@ export class LogoutResponse
} }
} }
export class KeepAliveResponse export class KeepAliveModel
{ {
public msg: string; public msg: string;
public utc_time: number; public utc_time: number;
@ -37,7 +37,7 @@ export class KeepAliveResponse
} }
} }
export class ServerInfo export class ServerModel
{ {
public ip: string; public ip: string;
public port: number; public port: number;
@ -49,7 +49,7 @@ export class ServerInfo
} }
} }
export class PingNotification export class PingNotificationModel
{ {
public type: string; public type: string;
public eventId: string; public eventId: string;
@ -62,7 +62,7 @@ export class PingNotification
} }
// todo: implement this // todo: implement this
export class CheckVersionResponse export class CheckVersionModel
{ {
public isValid: boolean; public isValid: boolean;
public latestVersion: string; public latestVersion: string;
@ -74,7 +74,7 @@ export class CheckVersionResponse
} }
} }
export class MiniInfo export class MiniInfoModel
{ {
public Nickname: string; public Nickname: string;
public Side: string; public Side: string;
@ -90,21 +90,21 @@ export class MiniInfo
} }
} }
export class MiniProfile export class MiniProfileModel
{ {
public _id: string; public _id: string;
public Info: MiniInfo; public Info: MiniInfoModel;
public constructor(id: string, info: MiniInfo) public constructor(id: string, info: MiniInfoModel)
{ {
this._id = id; this._id = id;
this.Info = info; this.Info = info;
} }
} }
export class FriendList export class FriendListModel
{ {
public Friends: MiniProfile[]; public Friends: MiniProfileModel[];
public Ignore: string[]; public Ignore: string[];
public InIgnoreList: string[]; public InIgnoreList: string[];

View File

@ -1,7 +1,7 @@
import { IncomingMessage, ServerResponse } from "http"; import { IncomingMessage, ServerResponse } from "http";
import { Service } from "../common/Haru.Http"; import { Service } from "../common/Haru.Http";
import { Json } from "../common/Haru.Utils"; import { Json } from "../common/Haru.Utils";
import { CheckVersionResponse, FriendList, KeepAliveResponse, LogoutResponse, ResponseBody, ServerInfo } from "./Haru.Eft.Models"; import { CheckVersionModel, FriendListModel, KeepAliveModel, LogoutModel, ResponseBody, ServerModel } from "./Haru.Eft.Models";
export class FileResponseHelper export class FileResponseHelper
{ {
@ -42,29 +42,29 @@ export class CachedResponseHelper
private static getFriendList(): string private static getFriendList(): string
{ {
const data = new FriendList(); const data = new FriendListModel();
const body = new ResponseBody<FriendList>(data); const body = new ResponseBody<FriendListModel>(data);
return Json.serialize(body); return Json.serialize(body);
} }
private static getGameCheckVersion(): string private static getGameCheckVersion(): string
{ {
const data = new CheckVersionResponse(); const data = new CheckVersionModel();
const body = new ResponseBody<CheckVersionResponse>(data); const body = new ResponseBody<CheckVersionModel>(data);
return Json.serialize(body); return Json.serialize(body);
} }
private static getGameLogout(): string private static getGameLogout(): string
{ {
const data = new LogoutResponse(); const data = new LogoutModel();
const body = new ResponseBody<LogoutResponse>(data); const body = new ResponseBody<LogoutModel>(data);
return Json.serialize(body); return Json.serialize(body);
} }
private static getKeepAlive(): string private static getKeepAlive(): string
{ {
const data = new KeepAliveResponse(); const data = new KeepAliveModel();
const body = new ResponseBody<KeepAliveResponse>(data); const body = new ResponseBody<KeepAliveModel>(data);
return Json.serialize(body); return Json.serialize(body);
} }
@ -75,8 +75,8 @@ export class CachedResponseHelper
private static getServerList(): string private static getServerList(): string
{ {
const data = [ new ServerInfo() ]; const data = [ new ServerModel() ];
const body = new ResponseBody<ServerInfo[]>(data); const body = new ResponseBody<ServerModel[]>(data);
return Json.serialize(body); return Json.serialize(body);
} }
} }