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

View File

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