25 lines
867 B
TypeScript
25 lines
867 B
TypeScript
import { ApiClient } from "../client/ApiClient";
|
|
import type { Endpoint } from "../client/endpoints";
|
|
import type { ApiResponse } from "../client/types";
|
|
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
|
|
|
export class PlayerDataService {
|
|
private static _I: PlayerDataService | null = null;
|
|
public static get I(): PlayerDataService {
|
|
if (!PlayerDataService._I) PlayerDataService._I = new PlayerDataService();
|
|
return PlayerDataService._I;
|
|
}
|
|
private constructor(private api = ApiClient.I) {}
|
|
|
|
// 获取个人信息
|
|
public async reqMyInfo(req: proto.cs.ICSMyInfoReq): Promise<ApiResponse<proto.cs.ICSMyInfoRes>> {
|
|
let epData: Endpoint<proto.cs.ICSMyInfoReq, proto.cs.ICSMyInfoRes> = {
|
|
path: "api/acc/info",
|
|
method: "POST",
|
|
codec: "json",
|
|
needsAuth: true
|
|
};
|
|
return this.api.call(epData, req);
|
|
}
|
|
}
|