@seayoo-web/gamer-api 2.12.5 → 2.13.1

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/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": "2.12.5",
4
+ "version": "2.13.1",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -31,16 +31,16 @@
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.13.1",
33
33
  "@seayoo-web/combo-webview": "2.8.0",
34
- "@seayoo-web/scripts": "3.1.5",
35
- "@seayoo-web/request": "3.4.0",
36
34
  "@seayoo-web/tsconfig": "1.0.5",
37
- "@seayoo-web/utils": "4.1.3",
38
- "@seayoo-web/validator": "1.1.1"
35
+ "@seayoo-web/request": "3.4.0",
36
+ "@seayoo-web/scripts": "3.1.5",
37
+ "@seayoo-web/validator": "1.1.1",
38
+ "@seayoo-web/utils": "4.1.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@seayoo-web/combo-webview": "^2.8.0",
42
- "@seayoo-web/utils": "^4.1.3",
43
- "@seayoo-web/validator": "^1.1.1"
42
+ "@seayoo-web/validator": "^1.1.1",
43
+ "@seayoo-web/utils": "^4.1.3"
44
44
  },
45
45
  "scripts": {
46
46
  "prebuild": "pnpm -F validator build && pnpm -F request build && pnpm -F combo-webview build",
@@ -1,3 +1,4 @@
1
+ import type { EventFeatureConfigOfUgcLike } from "../event";
1
2
  import type { EventFeatureConfigOfCashback } from "./feature.cashback";
2
3
  import type { EventFeatureConfigOfCheckIn } from "./feature.checkIn";
3
4
  import type { EventFeatureConfigOfClaimActivationKey } from "./feature.claimActivationKey";
@@ -41,5 +42,6 @@ export * from "./feature.vote";
41
42
  export * from "./feature.vote2";
42
43
  export * from "./feature.claimActivationKey";
43
44
  export * from "./feature.ugc";
44
- export type EventFeatureConfig = EventFeatureConfigOfCashback | EventFeatureConfigOfCheckIn | EventFeatureConfigOfClaimRewards | EventFeatureConfigOfComment | EventFeatureConfigOfFollow | EventFeatureConfigOfGiftCode | EventFeatureConfigOfInvite | EventFeatureConfigOfInvitedRegister | EventFeatureConfigOfLottery | EventFeatureConfigOfLotteryDraw | EventFeatureConfigOfPreregister | EventFeatureConfigOfQuest | EventFeatureConfigOfRegister | EventFeatureConfigOfShare | EventFeatureConfigOfSubscribe | EventFeatureConfigOfSurvey | EventFeatureConfigOfTeam | EventFeatureConfigOfVote | EventFeatureConfigOfVote2 | EventFeatureConfigOfClaimActivationKey | EventFeatureConfigOfZeroChatgpt | EventFeatureConfigOfUgc;
45
- export declare const EventFeatureConfigValidator: import("@seayoo-web/validator").UnionValidator<[import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfCashback, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfCheckIn, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfClaimRewards, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfComment, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfFollow, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfGiftCode, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfInvite, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfInvitedRegister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfLottery, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfLotteryDraw, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfPreregister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfQuest, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfRegister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfShare, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfSubscribe, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfSurvey, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfTeam, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfVote, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfVote2, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfClaimActivationKey, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfZeroChatgpt, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfUgc, false, false>], false, false>;
45
+ export * from "./feature.ugcLike";
46
+ export type EventFeatureConfig = EventFeatureConfigOfCashback | EventFeatureConfigOfCheckIn | EventFeatureConfigOfClaimRewards | EventFeatureConfigOfComment | EventFeatureConfigOfFollow | EventFeatureConfigOfGiftCode | EventFeatureConfigOfInvite | EventFeatureConfigOfInvitedRegister | EventFeatureConfigOfLottery | EventFeatureConfigOfLotteryDraw | EventFeatureConfigOfPreregister | EventFeatureConfigOfQuest | EventFeatureConfigOfRegister | EventFeatureConfigOfShare | EventFeatureConfigOfSubscribe | EventFeatureConfigOfSurvey | EventFeatureConfigOfTeam | EventFeatureConfigOfVote | EventFeatureConfigOfVote2 | EventFeatureConfigOfClaimActivationKey | EventFeatureConfigOfZeroChatgpt | EventFeatureConfigOfUgc | EventFeatureConfigOfUgcLike;
47
+ export declare const EventFeatureConfigValidator: import("@seayoo-web/validator").UnionValidator<[import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfCashback, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfCheckIn, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfClaimRewards, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfComment, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfFollow, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfGiftCode, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfInvite, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfInvitedRegister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfLottery, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfLotteryDraw, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfPreregister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfQuest, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfRegister, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfShare, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfSubscribe, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfSurvey, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfTeam, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfVote, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfVote2, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfClaimActivationKey, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfZeroChatgpt, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfUgc, false, false>, import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfUgcLike, false, false>], false, false>;
@@ -0,0 +1,12 @@
1
+ import type { EventFeatureBaseConfig } from "./feature.base";
2
+ declare const featureType: "ugc";
3
+ export interface FeatureUgcLikeConfig {
4
+ /** 关联的投稿玩法 ID */
5
+ ugc_feature_id: number;
6
+ }
7
+ export type EventFeatureConfigOfUgcLike = EventFeatureBaseConfig & {
8
+ feature_type: typeof featureType;
9
+ config: FeatureUgcLikeConfig;
10
+ };
11
+ export declare const EventFeatureConfigOfUgcLikeValidator: import("@seayoo-web/validator").ObjectValidator<EventFeatureConfigOfUgcLike, false, false>;
12
+ export {};
@@ -373,6 +373,29 @@ export declare class EventApi {
373
373
  image_url: string;
374
374
  } | {
375
375
  message: string;
376
- code: RequestInternalError | "event_not_found" | "feature_not_found";
376
+ error: RequestInternalError | "event_not_found" | "feature_not_found";
377
+ } | null>;
378
+ /**
379
+ * 获取推荐稿件列表,随机显示 N 条被接受的投稿记录
380
+ *
381
+ * https://www.kdocs.cn/l/ckWFDcOsYEUA?linkname=WzvcAPjHAh
382
+ */
383
+ getUgcRecommendation(featureId: number, requestOptions?: IRequestOptions): Promise<import("./event.engage").UgcRecordResponse | {
384
+ message: string;
385
+ error: RequestInternalError | "event_not_found" | "feature_not_found";
386
+ } | null>;
387
+ /**
388
+ * 获取指定活动玩法的 UGC 投稿排行榜数据
389
+ *
390
+ * 该接口仅在管理员在 Console 后台完成排行榜结算后才会返回有效数据。
391
+ * 结算前调用将返回空结果集。
392
+ * 排行榜结算通常在活动结束后由管理员在 Console 后台手动触发。
393
+ * 目前前端无法直接在投稿玩法中获得「是否已经结算」的状态。
394
+ *
395
+ * https://www.kdocs.cn/l/ckWFDcOsYEUA?linkname=KoB7S8omkC
396
+ */
397
+ getUgcLeaderboard(featureId: number, requestOptions?: IRequestOptions): Promise<import("./event.engage").UgcLeaderboardResponse | {
398
+ message: string;
399
+ error: RequestInternalError | "event_not_found" | "feature_not_found";
377
400
  } | null>;
378
401
  }
@@ -31,6 +31,7 @@ export * from "./engage.vote2";
31
31
  export * from "./engage.claimActivationKey";
32
32
  export * from "./engage.zeroChatGPT";
33
33
  export * from "./engage.ugc";
34
+ export * from "./engage.ugcLike";
34
35
  export type EmptyObject = Record<string | number | symbol, never>;
35
36
  export type UserEngagementData = PreregisterEngagementData | LotteryEngagementData | SurveyEngagementData | InviteEngagementData | ShareEngagementData | VoteEngagementData | Vote2EngagementData | WeixinSubscribeEngagementData | CashbackEngagementData | GiftCodeEngagementData | TeamEngagementData | QuestEngagementData | LotteryDrawEngagementData | ClaimActivationKeyEngagementData | ZeroChatGPTData | UgcEngagementData | EmptyObject;
36
37
  export declare const UserEngagementDataValidator: import("@seayoo-web/validator").UnionValidator<[import("@seayoo-web/validator").ObjectValidator<{
@@ -75,3 +75,26 @@ export declare const UgcUploadImageValidator: import("@seayoo-web/validator").Ob
75
75
  upload_url: string | undefined;
76
76
  image_url: string;
77
77
  }, false, false>;
78
+ export interface LeaderboardEntry {
79
+ /** 投稿记录 ID */
80
+ ugc_id: number;
81
+ /** 排名 */
82
+ rank: number;
83
+ /** 投稿记录获得的总赞数 */
84
+ total_likes: number;
85
+ /** 图片 URL 列表 */
86
+ image_urls?: string[];
87
+ /** 服务器 ID */
88
+ server_id?: number;
89
+ /** 服务器名称 */
90
+ server_name?: string;
91
+ /** 角色 ID */
92
+ role_id?: string;
93
+ /** 角色名称 */
94
+ role_name?: string;
95
+ }
96
+ export interface UgcLeaderboardResponse {
97
+ /** 投稿排行榜列表 */
98
+ ugcs: Array<LeaderboardEntry>;
99
+ }
100
+ export declare const UgcLeaderboardResponseValidator: import("@seayoo-web/validator").ObjectValidator<UgcLeaderboardResponse, false, false>;
@@ -0,0 +1,4 @@
1
+ export type UgcLikeEngagementParam = {
2
+ /** 投稿记录 ID */
3
+ ugc_id: number;
4
+ };
@@ -1,4 +1,4 @@
1
- import type { UserEngagementData, CommentEngagementParam, PreregisterEngagementParam, LotteryEngagementParam, LotteryDrawEngagementParam, ShareEngagementParam, SubscribeEngagementParam, TeamEngagementParam, VoteEngagementParam, Vote2EngagementParam, UgcEngagementParam, Vote2EngagementError, LotteryEngagementError, ClaimActivationKeyEngagementError, LotteryDrawEngagementError, TeamEngagementError, GiftCodeEngagementError } from "./engage";
1
+ import type { UserEngagementData, CommentEngagementParam, PreregisterEngagementParam, LotteryEngagementParam, LotteryDrawEngagementParam, ShareEngagementParam, SubscribeEngagementParam, TeamEngagementParam, VoteEngagementParam, Vote2EngagementParam, UgcEngagementParam, UgcLikeEngagementParam, Vote2EngagementError, LotteryEngagementError, ClaimActivationKeyEngagementError, LotteryDrawEngagementError, TeamEngagementError, GiftCodeEngagementError } from "./engage";
2
2
  import type { Reward } from "./reward";
3
3
  import type { FeatureType } from "../event.enums";
4
4
  import type { ZeroChatGPTEngagementParam } from "./engage.zeroChatGPT";
@@ -32,12 +32,12 @@ export declare const UserEngagementValidator: import("@seayoo-web/validator").Ob
32
32
  /**
33
33
  * 部分玩法参与时需要提供的参数
34
34
  */
35
- export type EngagementParam = null | PreregisterEngagementParam | LotteryEngagementParam | CommentEngagementParam | ShareEngagementParam | VoteEngagementParam | Vote2EngagementParam | SubscribeEngagementParam | TeamEngagementParam | LotteryDrawEngagementParam | ZeroChatGPTEngagementParam | UgcEngagementParam;
35
+ export type EngagementParam = null | PreregisterEngagementParam | LotteryEngagementParam | CommentEngagementParam | ShareEngagementParam | VoteEngagementParam | Vote2EngagementParam | SubscribeEngagementParam | TeamEngagementParam | LotteryDrawEngagementParam | ZeroChatGPTEngagementParam | UgcEngagementParam | UgcLikeEngagementParam;
36
36
  export type EngagementFeatureType = FeatureType | unknown;
37
37
  /**
38
38
  * 根据玩法类型推导需要提交的参数数据类型
39
39
  */
40
- export type InferEngagementParam<T extends EngagementFeatureType> = [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["vote2"] ? Vote2EngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : [T] extends ["ugc"] ? UgcEngagementParam : EngagementParam;
40
+ export type InferEngagementParam<T extends EngagementFeatureType> = [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["vote2"] ? Vote2EngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : [T] extends ["ugc"] ? UgcEngagementParam : [T] extends ["ugc_like"] ? UgcLikeEngagementParam : EngagementParam;
41
41
  export type EngagementCommonError = "invalid_token" | "event_not_found" | "feature_not_found" | "visit_record_not_found" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found";
42
42
  export type EngagementError = EngagementCommonError | TeamEngagementError | Vote2EngagementError | ClaimActivationKeyEngagementError | LotteryDrawEngagementError | LotteryEngagementError | GiftCodeEngagementError;
43
43
  /**
@@ -148,6 +148,8 @@ export declare const FeatureType: {
148
148
  readonly ZeroChatgpt: "zero_chatgpt";
149
149
  /** 投稿 */
150
150
  readonly Ugc: "ugc";
151
+ /** 投稿点赞 */
152
+ readonly UgcLike: "ugc_like";
151
153
  };
152
154
  export type FeatureType = ValueOf<typeof FeatureType>;
153
155
  export declare const FeatureTypeValidator: import("@seayoo-web/validator").StringValidator<FeatureType, false, false> & {
@@ -54,3 +54,4 @@ export declare const isUgcUploadImageResponse: (data: unknown) => data is {
54
54
  upload_url: string | undefined;
55
55
  image_url: string;
56
56
  };
57
+ export declare const isUgcLeaderboardResponse: (data: unknown) => data is import("./event.engage").UgcLeaderboardResponse;