mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
✏️ 完善基本 Response 类型 #51
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request genAuthkey.ts
|
||||
* @file web/request/genAuthkey.ts
|
||||
* @description 生成 authkey
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ export async function genAuthkey(
|
||||
};
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", JSON.stringify(data), "lk2", true);
|
||||
return await http
|
||||
.fetch<TGApp.Game.Gacha.AuthkeyResponse>(url, {
|
||||
.fetch<TGApp.Game.Gacha.AuthkeyResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getAbyss.ts
|
||||
* @file web/request/getAbyss.ts
|
||||
* @description 获取深渊信息
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ export async function getAbyss(
|
||||
const params = { role_id, schedule_type, server: account.region };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.Game.Abyss.Response>(url, {
|
||||
.fetch<TGApp.Game.Abyss.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getCookieToken.ts
|
||||
* @file web/request/getCookieToken.ts
|
||||
* @description 获取 Cookie Token 的请求函数
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ export async function getCookieTokenBySToken(
|
||||
const params = { stoken: Stoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getCookieTokenBySToken>(url, {
|
||||
.fetch<TGApp.BBS.Response.getCookieTokenBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
@@ -53,7 +53,7 @@ export async function getCookieTokenByGameToken(
|
||||
const url = "https://api-takumi.mihoyo.com/auth/api/getCookieAccountInfoByGameToken";
|
||||
const data = { account_id: Number(accountId), game_token: gameToken };
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getCookieTokenByGameToken>(url, {
|
||||
.fetch<TGApp.BBS.Response.getCookieTokenByGameToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
body: http.Body.json(data),
|
||||
})
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/**
|
||||
* @file web request getGachaLog.ts
|
||||
* @file web/request/getGachaLog.ts
|
||||
* @description 获取抽卡记录请求函数
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
|
||||
// tauri
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
/**
|
||||
@@ -33,7 +31,7 @@ export async function getGachaLog(
|
||||
end_id: endId,
|
||||
};
|
||||
return await http
|
||||
.fetch<TGApp.Game.Gacha.GachaLogResponse>(url, {
|
||||
.fetch<TGApp.Game.Gacha.GachaLogResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
query: params,
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getGameAccounts.ts
|
||||
* @file web/request/getGameAccounts.ts
|
||||
* @description 获取游戏账号信息相关请求函数
|
||||
* @since Alpha v0.1.5
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ async function getGameAccounts(
|
||||
): Promise<TGApp.BBS.Response.Base | TGApp.User.Account.Game[]> {
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.User.Account.GameResponse>(url, {
|
||||
.fetch<TGApp.User.Account.GameResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file core utils getGameRecord.ts
|
||||
* @file core/utils/getGameRecord.ts
|
||||
* @description 获取游戏数据的函数
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ export async function getGameRecord(
|
||||
const params = { role_id: user.gameUid, server: user.region };
|
||||
const header = TGUtils.User.getHeader(ck, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.Game.Record.Response>(url, {
|
||||
.fetch<TGApp.Game.Record.Response | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @file web request getLToken.ts
|
||||
* @file web/request/getLToken.ts
|
||||
* @description 获取 ltoken 的请求
|
||||
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
|
||||
@@ -29,7 +28,7 @@ export async function getLTokenBySToken(
|
||||
const params = { stoken: Stoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getLTokenBySToken>(url, {
|
||||
.fetch<TGApp.BBS.Response.getLTokenBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getRoleList.ts
|
||||
* @file web/request/getRoleList.ts
|
||||
* @description 获取游戏角色列表的请求方法
|
||||
* @since Alpha v0.2.0
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ export async function getGameRoleListByLToken(
|
||||
};
|
||||
const header = TGUtils.User.getHeader(ck, "POST", JSON.stringify(data), "common");
|
||||
return await http
|
||||
.fetch<TGApp.Game.Character.ListResponse>(url, {
|
||||
.fetch<TGApp.Game.Character.ListResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getStoken.ts
|
||||
* @file web/request/getStoken.ts
|
||||
* @description 获取 stoken
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ export async function getStokenByGameToken(
|
||||
"x-rpc-app_id": TGConstant.BBS.APP_ID,
|
||||
};
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getStokenByGameToken>(url, {
|
||||
.fetch<TGApp.BBS.Response.getStokenByGameToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getTokens.ts
|
||||
* @file web/request/getTokens.ts
|
||||
* @description 获取游戏 Token
|
||||
* @since Alpha v0.1.5
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ export async function getTokensByLoginTicket(
|
||||
const params = { login_ticket: ticket, token_types: 3, uid };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.getTokens>(url, {
|
||||
.fetch<TGApp.BBS.Response.getTokens | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request getUserInfo.ts
|
||||
* @file web/request/getUserInfo.ts
|
||||
* @description 获取用户信息请求
|
||||
* @since Beta v0.3.4
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ export async function getUserInfoByCookie(
|
||||
const params = { gids: "2" };
|
||||
const header = TGUtils.User.getHeader(cookie, "GET", params, "common", true);
|
||||
return await http
|
||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse>(url, {
|
||||
.fetch<TGApp.Plugins.Mys.User.HomeResponse | TGApp.BBS.Response.Base>(url, {
|
||||
method: "GET",
|
||||
headers: header,
|
||||
query: params,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file web request verifyLToken.ts
|
||||
* @file web/request/verifyLToken.ts
|
||||
* @description 验证 stoken 的请求函数
|
||||
* @since Alpha v0.1.5
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ export async function verifyLToken(
|
||||
const data = { ltoken };
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common");
|
||||
return await http
|
||||
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken>(url, {
|
||||
.fetch<TGApp.BBS.Response.verifyUserInfoBySToken | TGApp.BBS.Response.Base>(url, {
|
||||
method: "POST",
|
||||
headers: header,
|
||||
body: http.Body.json(data),
|
||||
|
||||
Reference in New Issue
Block a user