feat, refac: 최근 메시지 API

This commit is contained in:
2022-11-29 02:06:57 +09:00
parent b4ac348645
commit 3d40df9755
3 changed files with 212 additions and 0 deletions
+6
View File
@@ -32,6 +32,7 @@ GetRecentRecordResponse,
import type { CachedMapResult, GeneralListResponse, ItemTypeKey, MapResult } from "./defs";
import type { VoteDetailResult, VoteListResult } from "./defs/API/Vote";
import type { ActiveResourceAuctionList, OpenAuctionResponse, UniqueItemAuctionDetail, UniqueItemAuctionList } from "./defs/API/Auction";
import type { MsgResponse } from "./defs/API/Message";
const apiRealPath = {
Auction: {
@@ -170,6 +171,11 @@ const apiRealPath = {
lastID: number
}, InheritLogResponse>
},
Message: {
GetRecentMessage: GET as APICallT<{
sequence?: number;
}, MsgResponse>,
},
Misc: {
UploadImage: POST as APICallT<
{
+54
View File
@@ -0,0 +1,54 @@
import type { ValidResponse } from "@/util/callSammoAPI";
export type MsgType = "private" | "public" | "national" | "diplomacy";
export const minMsgSeq: Record<MsgType, number> = {
private: 0x7fffffff,
public: 0x7fffffff,
national: 0x7fffffff,
diplomacy: 0x7fffffff,
};
export type MsgTarget = {
id: number;
name: string;
nation_id: number; //XXX: 왜 이 값은 nationID가 아니고 nation_id인가?
nation: string;
color: string;
icon: string;
};
export type MsgItem = {
id: number;
msgType: MsgType;
src: MsgTarget;
dest?: MsgTarget;
text: string;
option: Record<string, string | number>;
time: string;
};
export type MsgPrintItem = MsgItem & {
generalName: string;
nationID: number;
nationType: "local" | "src" | "dest";
myGeneralID: number;
allowButton: boolean;
last5min: string;
now: string;
invalidType: "msg_invalid" | "msg_valid";
deletable: boolean;
src: MsgTarget & { colorType: "bright" | "dark" };
dest: MsgTarget & { colorType: "bright" | "dark" };
defaultIcon: string;
};
export type MsgResponse = {
[v in MsgType]: MsgItem[];
} & {
result: true;
keepRecent: boolean;
nationID: number;
generalName: string;
sequence: number;
};