@seayoo-web/gamer-api 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -719,7 +719,7 @@ class ha {
719
719
  bind(t) {
720
720
  const n = this;
721
721
  for (const [r, o] of Object.entries(t))
722
- n[r] = o.bind(this);
722
+ o && (n[r] = o.bind(this));
723
723
  return n;
724
724
  }
725
725
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seayoo-web/gamer-api",
3
3
  "description": "agent for gamer api",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.13.1",
33
+ "@seayoo-web/utils": "4.4.0",
33
34
  "@seayoo-web/request": "3.4.3",
34
- "@seayoo-web/scripts": "3.1.9",
35
35
  "@seayoo-web/combo-webview": "2.8.0",
36
36
  "@seayoo-web/tsconfig": "1.0.6",
37
- "@seayoo-web/utils": "4.4.0",
37
+ "@seayoo-web/scripts": "3.1.9",
38
38
  "@seayoo-web/validator": "2.3.0"
39
39
  },
40
40
  "peerDependencies": {
@@ -1,7 +1,8 @@
1
+ import type { ApiMethodNames } from "./event.methods";
1
2
  import type { AuthToken } from "./token";
2
3
  import type { NetRequestHandler } from "@seayoo-web/request";
3
- type ApiMethod = (this: EventApi, ...args: any[]) => any;
4
- /** EventApi */
4
+ export type ApiMethod = (this: EventApi, ...args: any[]) => any;
5
+ export type { ApiMethodNames } from "./event.methods";
5
6
  export declare class EventApi {
6
7
  token: AuthToken;
7
8
  req: NetRequestHandler;
@@ -11,8 +12,7 @@ export declare class EventApi {
11
12
  /**
12
13
  * 绑定指定的方法到当前实例上
13
14
  */
14
- bind<T extends Record<string, ApiMethod>>(methods: T): this & {
15
- [K in keyof T]: T[K] extends ApiMethod ? T[K] : never;
16
- };
15
+ bind<T extends {
16
+ [P in keyof ApiMethodNames]?: ApiMethod;
17
+ }>(methods: T): this & T;
17
18
  }
18
- export {};
@@ -3,6 +3,8 @@ import type { EngagementFeatureType, InferEngagementError, InferEngagementParam
3
3
  import type { GamerItemType, RewardSource, RewardStatus, UgcReviewStatus } from "./event.enums";
4
4
  import type { IRequestOptions, RequestInternalError } from "@seayoo-web/request";
5
5
  type ApiInstance = InstanceType<typeof EventApi>;
6
+ /** 支持的 api 方法,用于 TS 类型输入提示 */
7
+ export type ApiMethodNames = "verifyMobileAllowed" | "getConfig" | "getEngagementsUserCount" | "getEngagementsCount" | "getEngagements" | "visit" | "getUserFeatureStatus" | "getUserEngagementCount" | "getUserEngagements" | "engage" | "claimRewards" | "submitUserRewardAddress" | "getUnlimitQrcodeScene" | "getParamsByQrcodeScene" | "generateUnlimitQrcode" | "getQuestProgress" | "vote2Rewards" | "getVote2Leaderboard" | "getCashbackQuery" | "getUgcRecord" | "getUgcMyCount" | "claimRewardsV2" | "claimWeixinHongbao" | "verifyActivationKey" | "getUserRewards" | "getUserRewardsCount" | "getUserItemCount" | "ugcUploadImage" | "getUgcRecommendation" | "getUgcs" | "getUgcLeaderboard" | "getRedeemItemStocks";
6
8
  /**
7
9
  * 根据手机号白名单,检查手机号是否允许登录某个游戏
8
10
  *