Add mock implementation for client/friend/request/cancel endpoint

Addec comments
This commit is contained in:
Dev 2023-07-14 13:03:55 +01:00
parent 162709a5b0
commit 2df0d44de5
3 changed files with 40 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import { inject, injectable } from "tsyringe";
import { DialogueController } from "../controllers/DialogueController";
import { OnUpdate } from "../di/OnUpdate";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IAcceptFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData";
import { IAcceptFriendRequestData, ICancelFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData";
import { IChatServer } from "../models/eft/dialog/IChatServer";
import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest";
import { IDeleteFriendRequest } from "../models/eft/dialog/IDeleteFriendRequest";
@ -140,24 +140,42 @@ export class DialogueCallbacks implements OnUpdate
return this.httpResponse.getBody([]);
}
/**
* Handle client/friend/request/list/inbox
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
return this.httpResponse.getBody([]);
}
/**
* Handle client/friend/request/send
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>
{
return this.httpResponse.getBody({status: 0, requestid: "12345", retryAfter: 600});
}
/**
* Handle client/friend/request/accept
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
/**
* Handle client/friend/request/cancel
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelFriendRequest(url: string, request: ICancelFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
{

View File

@ -1,4 +1,16 @@
export interface IAcceptFriendRequestData
// rome-ignore lint/suspicious/noEmptyInterface: <explanation>
export interface IAcceptFriendRequestData extends IBaseFriendRequest
{
}
// rome-ignore lint/suspicious/noEmptyInterface: <explanation>
export interface ICancelFriendRequestData extends IBaseFriendRequest
{
}
export interface IBaseFriendRequest
{
// eslint-disable-next-line @typescript-eslint/naming-convention
request_id: string

View File

@ -148,6 +148,14 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID);
}
),
new RouteAction(
"/client/friend/request/cancel",
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.dialogueCallbacks.cancelFriendRequest(url, info, sessionID);
}
),
new RouteAction(
"/client/friend/delete",
// eslint-disable-next-line @typescript-eslint/no-unused-vars