add some api methods

This commit is contained in:
beerpsi 2023-11-25 13:10:38 +07:00
parent 3cffcd1410
commit 176b2c3352
5 changed files with 44 additions and 6 deletions

View File

@ -20,7 +20,7 @@ import type { Request, Response } from "express";
const logger = CreateLogCtx(__filename);
export class Chunithm extends BaseTitle {
private readonly dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
protected readonly dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
constructor(gameCode?: string, version?: string, servletName?: string) {
super(gameCode ?? "SDBT", version ?? "100", servletName ?? "ChuniServlet");

View File

@ -0,0 +1,22 @@
import { Chunithm } from "./100-base";
import type { Request, Response } from "express";
export class ChunithmAir extends Chunithm {
constructor(gameCode?: string, version?: string, servletName?: string) {
super(gameCode ?? "SDBT", version ?? "110", servletName ?? "ChuniServlet");
}
/**
* @since AIR
* @deprecated AMAZON?
*/
handle_GetUserRecentPlayerApi(req: Request, res: Response) {
// TODO
return res.send({
userId: req.safeBody.userId,
length: 0,
nextIndex: -1,
userRecentPlayerList: [],
});
}
}

View File

@ -1,9 +1,9 @@
import { Chunithm } from "./100-base";
import { ChunithmAir } from "./110-air";
import type { Request, Response } from "express";
export class ChunithmAirPlus extends Chunithm {
export class ChunithmAirPlus extends ChunithmAir {
constructor(gameCode?: string, version?: string, servletName?: string) {
super(gameCode ?? "SDBT", version ?? "125", servletName ?? "ChuniServlet");
super(gameCode ?? "SDBT", version ?? "115", servletName ?? "ChuniServlet");
}
override createGetGameSettingsApiResponse(req: Request, res: Response) {

View File

@ -1,6 +1,9 @@
import { ChunithmAirPlus } from "./125-airplus";
import { ChunithmAirPlus } from "./115-airplus";
import CreateLogCtx from "lib/logger/logger";
import type { Request, Response } from "express";
const logger = CreateLogCtx(__filename);
export class ChunithmAmazon extends ChunithmAirPlus {
constructor(gameCode?: string, version?: string, servletName?: string) {
super(gameCode ?? "SDBT", version ?? "130", servletName ?? "ChuniServlet");
@ -20,4 +23,15 @@ export class ChunithmAmazon extends ChunithmAirPlus {
handle_GetUserDuelApi(req: Request, res: Response) {
throw new Error("Unimplemented");
}
override handle_GetUserRecentPlayerApi(req: Request, res: Response): Response {
// ARTEMiS discord says they've never seen this in AMAZON and newer...
logger.warn("Deprecated API method called.", {
method: "GetUserRecentPlayerApi",
gameCode: this.gameCode,
version: this.version,
});
return super.handle_GetUserRecentPlayerApi(req, res);
}
}

View File

@ -1,5 +1,6 @@
import { Chunithm } from "./100-base";
import { ChunithmAirPlus } from "./125-airplus";
import { ChunithmAir } from "./110-air";
import { ChunithmAirPlus } from "./115-airplus";
import { ChunithmAmazon } from "./130-amazon";
import { ChunithmAmazonPlus } from "./135-amazonplus";
import { ChunithmCrystal } from "./140-crystal";
@ -7,6 +8,7 @@ import type { BaseTitle } from "servers/titles/types/titles";
export const VERSIONS: Array<typeof BaseTitle> = [
Chunithm,
ChunithmAir,
ChunithmAirPlus,
ChunithmAmazon,
ChunithmAmazonPlus,